Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rpc(3n) — NEWS-os 5.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

environ(5)

getnetconfig(3N)

getnetpath(3N)

rpcbind(3N)

rpc(3N)

xdr(3N)

netconfig(4)



rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



NAME
     rpc - library routines for remote procedure calls

DESCRIPTION
     RPC routines allow C language  programs  to  make  procedure
     calls on other machines across a network.  First, the client
     calls a procedure to send a data packet to the  server.   On
     receipt  of  the packet, the server calls a dispatch routine
     to perform the requested service,  and  then  sends  back  a
     reply.   The following sections describe data objects use by
     the RPC package.

  Nettype
     Some of the high-level RPC interface routines take a nettype
     string  as  one of the parameters [for example, clntcreate,
     svccreate, rpcreg, rpccall].  This string defines a class
     of  transports  which  can be used for a particular applica-
     tion.  The transports are tried in left to  right  order  in
     the  NETPATH  variable  or  in  top  to  down  order  in the
     /etc/netconfig file.

     nettype can be one of the following:

     netpath   Choose from the transports which have  been  indi-
               cated  by  their  token names in the NETPATH vari-
               able.  If NETPATH is unset or NULL, it defaults to
               visible.  netpath is the default nettype.

     visible   Choose the transports which have the visible  flag
               (v) set in the /etc/netconfig file.

     circuitv This is same as visible  except  that  it  chooses
               only  the  connection oriented transports from the
               entries in /etc/netconfig file.

     datagramv
               This is same as visible  except  that  it  chooses
               only  the  connectionless datagram transports from
               the entries in /etc/netconfig file.

     circuitn This is same as netpath  except  that  it  chooses
               only the connection oriented datagram transports

     datagramn
               This is same as netpath  except  that  it  chooses
               only the connectionless datagram transports.

     udp       It refers to Internet UDP.

     tcp       It refers to Internet TCP.

     raw       This  is  for  memory  based   RPC,   mainly   for



                                                                1





rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



               performance evaluation.

     If nettype is NULL, it defaults to netpath.




















































                                                                2





rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



  Data Structures
     Some of the data structures used  by  the  RPC  package  are
     shown below.

  The AUTH Structure
     union desblock {
         struct {
             uint32 high;
             uint32 low;
         } key;
         char c[8];
     };
     typedef union desblock desblock;
     extern boolt xdrdesblock();

     /*
      * Authentication info. Opaque to client.
      */
     struct opaqueauth {
         enumt  oaflavor;  /* flavor of auth */
         caddrt oabase;    /* address of more auth stuff */
         uint   oalength;  /* not to exceed MAXAUTHBYTES */
     };

     /*
      * Auth handle, interface to client side authenticators.
      */
     typedef struct {
         struct  opaqueauth  ahcred;
         struct  opaqueauth  ahverf;
         union   desblock    ahkey;
         struct authops {
             void   (*ahnextverf)();
             int    (*ahmarshal)();  /* nextverf & serialize */
             int    (*ahvalidate)(); /* validate varifier */
             int    (*ahrefresh)();  /* refresh credentials */
             void   (*ahdestroy)();  /* destroy this structure */
         } *ahops;
         caddrt ahprivate;
     } AUTH;















                                                                3





rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



  The CLIENT Structure
     /*
      * Client rpc handle.
      * Created by individual implementations
      * Client is responsible for initializing auth, see e.g. authnone.c.
      */
     typedef struct {
         AUTH           *clauth;             /* authenticator */
         struct clntops {
             enum clntstat  (*clcall)();    /* call remote procedure */
             void            (*clabort)();   /* abort a call */
             void            (*clgeterr)();  /* get specific error code */
             boolt          (*clfreeres)(); /* frees results */
             void            (*cldestroy)(); /* destroy this structure */
             boolt          (*clcontrol)(); /* the ioctl() of rpc */
         } *clops;
         caddrt         clprivate;          /* private stuff */
         char            *clnetid;           /* network token */
         char            *cltp;              /* device name */
     } CLIENT;

  The SVCXPRT Structure
     enum xprtstat {
         XPRTDIED,
         XPRTMOREREQS,
         XPRTIDLE
     };

     /*
      * Server side transport handle
      */
     typedef struct {
         int                 xpfd;
     #define xpsock         xpfd
     #endif
         ushort             xpport;         /* associated port number.
                                               * Obsolete, but still used to
                                               * specify whether rendezvouser
                                               * or normal connection
                                               */
                             (continued)














                                                                4





rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



         struct xpops {
             boolt         (*xprecv)();     /* receive incoming requests */
             enum xprtstat (*xpstat)();     /* get transport status */
             boolt         (*xpgetargs)();  /* get arguments */
             boolt         (*xpreply)();    /* send reply */
             boolt         (*xpfreeargs)(); /* free mem allocated for args */
             void           (*xpdestroy)();  /* destroy this struct */
         } *xpops;
         int         xpaddrlen;      /* length of remote addr. Obsolete */
         char        *xptp;          /* transport provider device name */
         char        *xpnetid;       /* network token */
         struct netbuf       xpltaddr;   /* local transport address */
         struct netbuf       xprtaddr;   /* remote transport address */
         char                xpraddr[16];    /* remote address. Obsolete */
         struct opaqueauth xpverf;  /* raw response verifier */
         caddrt             xpp1;   /* private: for use by svc ops */
         caddrt             xpp2;   /* private: for use by svc ops */
         caddrt             xpp3;   /* private: for use by svc lib */
     } SVCXPRT;

  The XDR Structure
     /*
      * Xdr operations.  XDRENCODE causes the type to be encoded into the
      * stream.  XDRDECODE causes the type to be extracted from the stream.
      * XDRFREE can be used to release the space allocated by an XDRDECODE
      * request.
      */
     enum xdrop {
         XDRENCODE=0,
         XDRDECODE=1,
         XDRFREE=2
     };

     /*
      * This is the number of bytes per unit of external data.
      */
     #define BYTESPERXDRUNIT    (4)
     #define RNDUP(x)  ((((x) + BYTESPERXDRUNIT - 1) / BYTESPERXDRUNIT) \
                 * BYTESPERXDRUNIT)

     /*
      * A xdrproct exists for each data type which is to be encoded or decoded.
      *
      * The second argument to the xdrproct is a pointer to an opaque pointer.
      * The opaque pointer generally points to a structure of the data type
      * to be decoded.  If this pointer is 0, then the type routines should
      * allocate dynamic storage of the appropriate size and return it.
      * boolt (*xdrproct)(XDR *, caddrt *);
      */
     typedef   boolt (*xdrproct)();

     /*



                                                                5





rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



      * The XDR handle.
      * Contains operation which is being applied to the stream,
      * an operations vector for the paticular implementation (e.g. see xdrmem.c),
      * and two private fields for the use of the particular impelementation.
      */
     typedef struct {
         enum xdrop xop;            /* operation; fast additional param */
         struct xdrops {
             boolt  (*xgetlong)();  /* get a long from underlying stream */
             boolt  (*xputlong)();  /* put a long to " */
             boolt  (*xgetbytes)(); /* get some bytes from " */
             boolt  (*xputbytes)(); /* put some bytes to " */
             uint   (*xgetpostn)(); /* returns bytes off from beginning */
             boolt  (*xsetpostn)(); /* lets you reposition the stream */
             long *  (*xinline)();   /* buf quick ptr to buffered data */
             void    (*xdestroy)();  /* free privates of this xdrstream */
         } *xops;
         caddrt     xpublic;        /* users' data */
         caddrt     xprivate;       /* pointer to private data */
         caddrt     xbase;          /* private used for position info */
         int         xhandy;         /* extra private word */
     } XDR;

  Index to Routines
     The following table lists RPC routines and the manual refer-
     ence pages on which they are described:
          RPC Routine         Manual Reference Page
     ______________________________________________
     authdestroy             rpcclntauth(3N)
     authdesgetucred         securerpc(3N)
     authdesseccreate        securerpc(3N)
     authnonecreate          rpcclntauth(3N)
     authsyscreate           rpcclntauth(3N)
     authsyscreatedefault   rpcclntauth(3N)
     clntcall                rpcclntcalls(3N)
     clntcontrol             rpcclntcreate(3N)
     clntcreate              rpcclntcreate(3N)
     clntdestroy             rpcclntcreate(3N)
     clntdgcreate           rpcclntcreate(3N)
     clntfreeres             rpcclntcalls(3N)
     clntgeterr              rpcclntcalls(3N)
     clntpcreateerror        rpcclntcreate(3N)
     clntperrno              rpcclntcalls(3N)
     clntperror              rpcclntcalls(3N)
     clntrawcreate          rpcclntcreate(3N)
     clntspcreateerror       rpcclntcreate(3N)
     clntsperrno             rpcclntcalls(3N)
     clntsperror             rpcclntcalls(3N)
     clnttlicreate          rpcclntcreate(3N)
     clnttpcreate           rpcclntcreate(3N)
     clntvccreate           rpcclntcreate(3N)
     getnetname               securerpc(3N)



                                                                6





rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



     host2netname             securerpc(3N)
     keydecryptsession       securerpc(3N)
     keyencryptsession       securerpc(3N)
     keygendes               securerpc(3N)
     keysetsecret            securerpc(3N)
     netname2host             securerpc(3N)
     netname2user             securerpc(3N)
     rpcbroadcast            rpcclntcalls(3N)
     rpccall                 rpcclntcalls(3N)
     rpcreg                  rpcsvccalls(3N)
     svccreate               rpcsvccreate(3N)
     svcdestroy              rpcsvccreate(3N)
     svcdgcreate            rpcsvccreate(3N)
     svcfdcreate            rpcsvccreate(3N)
     svcfreeargs             rpcsvcreg(3N)
     svcgetargs              rpcsvcreg(3N)
     svcgetreqset            rpcsvcreg(3N)
     svcgetrpccaller         rpcsvcreg(3N)
     svcrawcreate           rpcsvccreate(3N)
     svcreg                  rpcsvccalls(3N)
     svcrun                  rpcsvcreg(3N)
     svcsendreply            rpcsvcreg(3N)
     svctlicreate           rpcsvccreate(3N)
     svctpcreate            rpcsvccreate(3N)
     svcunreg                rpcsvccalls(3N)
     svcvccreate            rpcsvccreate(3N)
     svcerrauth              rpcsvcerr(3N)
     svcerrdecode            rpcsvcerr(3N)
     svcerrnoproc            rpcsvcerr(3N)
     svcerrnoprog            rpcsvcerr(3N)
     svcerrprogvers          rpcsvcerr(3N)
     svcerrsystemerr         rpcsvcerr(3N)
     svcerrweakauth          rpcsvcerr(3N)
     user2netname             securerpc(3N)
     xdracceptedreply       rpcxdr(3N)
     xdrauthsysparms        rpcxdr(3N)
     xdrcallhdr              rpcxdr(3N)
     xdrcallmsg              rpcxdr(3N)
     xdropaqueauth          rpcxdr(3N)
     xdrrejectedreply       rpcxdr(3N)
     xdrreplymsg             rpcxdr(3N)
     xprtregister            rpcsvccalls(3N)
     xprtunregister          rpcsvccalls(3N)

FILES
     /etc/netconfig

SEE ALSO
     environ(5), getnetconfig(3N), getnetpath(3N),
     rpcclntauth(3N), rpcclntcalls(3N), rpcclntcreate(3N),
     rpcsvccalls(3N), rpcsvccreate(3N), rpcsvcerr(3N),
     rpcsvcreg(3N), rpcxdr(3N), rpcbind(3N), securerpc(3N),



                                                                7





rpc(3N)                 LIBRARY FUNCTIONS                 rpc(3N)



     xdr(3N), netconfig(4).






















































                                                                8



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