man(1) Manual page archive


     OPMUX(2)                                                 OPMUX(2)

     NAME
          Opmux, rpc - RPC multiplexor for the Op file protocol

     SYNOPSIS
          include "op.m";
          include "opmux.m";
          opmux := load Opmux Opmux->PATH;

          init:     fn(ofd: ref Sys->FD, op: Op, endc: chan of string);
          rpc: fn(t: ref Op->Tmsg) : chan of ref Op->Rmsg;
          term: fn();

          recoverfn:     ref fn(): ref Sys->FD;
          dump: fn();
          debug: int;

     DESCRIPTION
          Opmux provides a multiplexor for Op connections. It permits
          issuing concurrent requests through the same connection.

          Init initializes and prepares the module for operation. The
          other end of the connection reached through ofd should be a
          server speaking Op. See intro(O). An implementation for the
          op(2) module must be supplied in the op argument. The chan-
          nel endc can be used to terminate the multiplexor, by send-
          ing anything through it.  Usually, the error condition caus-
          ing the termination is sent through.

          The function rpc makes an Op RPC to the server reached
          through ofd (given to init). It must receive a valid Tmsg
          and returns a channel that can be used to obtain the reply
          as received from the server. Errors are signaled by means of
          Rmsg.Error adts sent through this channel. The reply channel
          has enough buffering to permit callers of rpc to ignore one
          reply message. But note that Tget requests asking to read
          data from a directory may receive a potentially infinite
          number of replies, see get(O) for details.

          The global debug may be set to a non-zero value to cause
          Opmux to print Op messages as they are sent/received. As an
          additional aid, dump prints the internal state of the multi-
          plexor (ie., messages sent with pending replies) for debug-
          ging.

          The function term terminates the operation of the module,
          aborting any outstanding RPC.

          You may set the pointer recoverfn to point to a function
          that returns a new descriptor open to reach the same server,
          and opmux will try to recover by calling it, should it lose

     OPMUX(2)                                                 OPMUX(2)

          the connection. This feature is experimental and not tested
          enough to be trusted.

     SOURCE
          /usr/octopus/port/lib/opmux.b

     SEE ALSO
          intro(O), op(2), and intro(5).