Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rpc_clnt_cl(3N) — svr4 — mips UMIPS RISC/os 5.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

printf(3S)

rpc(3N)

rpc_clnt_auth(3N)

rpc_clnt_create(3N)



RPCCLNTCL(3N-SVR4)RISC/os Reference Manual RPCCLNTCL(3N-SVR4)



NAME
     rpc_clnt_calls:  clnt_call, clnt_freeres, clnt_geterr,
          clnt_perrno, clnt_perror, clnt_sperrno, clnt_sperror,
          rpc_broadcast, rpc_call - library routines for client
          side calls

DESCRIPTION
     RPC library routines allow C language programs to make pro-
     cedure calls on other machines across the network.  First,
     the client calls a procedure to send a data packet to the
     server.  Upon receipt of the packet, the server calls a
     dispatch routine to perform the requested service, and then
     sends back a reply.

     The clntcall, rpccall and rpcbroadcast routines handle
     the client side of the procedure call.  The remaining rou-
     tines deal with error handling in the case of errors.

   Routines
     See rpc(3N) for the definition of the CLIENT data structure.

     #include <rpc/rpc.h>

     enum clntstat
     clntcall(CLIENT *clnt, const ulong procnum, const xdrproct inproc,
          caddrt in, const xdrproct outproc, caddrt out,
          const struct timeval tout);

          A function macro that calls the remote procedure proc-
          num associated with the client handle, clnt, which is
          obtained with an RPC client creation routine such as
          clnt_create [see rpc_clnt_create(3N)].  The parameter
          in is the address of the procedure's argument(s), and
          out is the address of where to place the result(s);
          inproc is used to encode the procedure's parameters,
          and outproc is used to decode the procedure's results;
          tout is the time allowed for results to be returned.

          If the remote call succeeds, the status is returned in
          RPC_SUCCESS, otherwise an appropriate status is
          returned.

     int clntfreeres(CLIENT *clnt, const xdrproct outproc, caddrt out);

          A function macro that frees any data allocated by the
          RPC/XDR system when it decoded the results of an RPC
          call.  The parameter out is the address of the results,
          and outproc is the XDR routine describing the results.
          This routine returns 1 if the results were successfully
          freed, and 0 otherwise.





                        Printed 11/19/92                   Page 1





RPCCLNTCL(3N-SVR4)RISC/os Reference Manual RPCCLNTCL(3N-SVR4)



     void
     clntgeterr(const CLIENT *clnt, struct rpcerr *errp);

          A function macro that copies the error structure out of
          the client handle to the structure at address errp.

     void
     clntperrno(const enum clntstat stat);

          Print a message to standard error corresponding to the
          condition indicated by stat.  A newline is appended at
          the end of the message.  Normally used after a pro-
          cedure call fails, for instance rpccall.

     void
     clntperror(const CLIENT *clnt, const char *s);

          Print a message to standard error indicating why an RPC
          call failed; clnt is the handle used to do the call.
          The message is prepended with string s and a colon.  A
          newline is appended at the end of the message.  Nor-
          mally used after a procedure call fails, for instance
          clntcall.

     char *
     clntsperrno(const enum clntstat stat);

          Take the same arguments as clntperrno, but instead of
          sending a message to the standard error indicating why
          an RPC call failed, return a pointer to a string which
          contains the message.

          clntsperrno is normally used instead of clntperrno
          when the program does not have a standard error (as a
          program running as a server quite likely does not), or
          if the programmer does not want the message to be out-
          put with printf [see printf(3S)], or if a message for-
          mat different than that supported by clntperrno is to
          be used.  Note:  unlike clntsperror and
          clnt_spcreaterror [see rpc_clnt_create(3N)],
          clntsperrno does not return pointer to static data so
          the result will not get overwritten on each call.

     char *
     clntsperror(const CLIENT *clnt, const char *s);

          Like clntperror, except that (like clntsperrno) it
          returns a string instead of printing to standard error.
          However, clntsperror does not append a newline at the
          end of the message.

          Warning:  returns pointer to static data that is



 Page 2                 Printed 11/19/92





RPCCLNTCL(3N-SVR4)RISC/os Reference Manual RPCCLNTCL(3N-SVR4)



          overwritten on each call.

     enum clntstat
     rpcbroadcast(const ulong prognum, const ulong versnum,
          const ulong procnum, const xdrproct inproc, caddrt in,
          const xdrproct outproc, caddrt out, const resultproct eachresult,
          const char *nettype);

          Like rpccall, except the call message is broadcast to
          the connectionless network specified by nettype.  If
          nettype is NULL, it defaults to netpath.  Each time it
          receives a response, this routine calls eachresult,
          whose form is:

          boolt
          eachresult(const caddrt out, const struct netbuf *addr,
               struct netconfig *netconf);

          where out is the same as out passed to rpcbroadcast,
          except that the remote procedure's output is decoded
          there; addr points to the address of the machine that
          sent the results, and netconf is the netconfig struc-
          ture of the transport on which the remote server
          responded.  If eachresult returns 0, rpcbroadcast
          waits for more replies; otherwise it returns with
          appropriate status.

          Warning:  broadcast file descriptors are limited in
          size to the maximum transfer size of that transport.
          For Ethernet, this value is 1500 bytes.

     enum clntstat
     rpccall(const char *host, const ulong prognum,
          const ulong versnum, const ulong procnum,
          const xdrproct inproc, const xdrproct outproc,
          const char *in, char *out, const char *nettype);

          Call the remote procedure associated with prognum,
          versnum, and procnum on the machine, host.  The parame-
          ter in is the address of the procedure's argument(s),
          and out is the address of where to place the result(s);
          inproc is used to encode the procedure's parameters,
          and outproc is used to decode the procedure's results.
          nettype can be any of the values listed on rpc(3N).  If
          nettype is NULL, it defaults to netpath.  This routine
          returns 0 if it succeeds, or the value of enum
          clnt_stat cast to an integer if it fails.  Use the
          clntperrno routine to translate failure statuses into
          messages.

          Warning:  rpc_call uses the first available transport
          belonging to the class nettype, on which it can create
          a connection.  You do not have control of timeouts or



                        Printed 11/19/92                   Page 3




RPCCLNTCL(3N-SVR4)RISC/os Reference Manual RPCCLNTCL(3N-SVR4)



          authentication using this routine.  There is also no
          way to destroy the client handle.

SEE ALSO
     printf(3S), rpc(3N), rpc_clnt_auth(3N), rpc_clnt_create(3N).


















































 Page 4                 Printed 11/19/92



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026