rpc(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

rpc(3c)

Standard C Library Functions                                           rpc(3C)



NAME
       rpc - library routines for remote procedure calls

SYNOPSIS
       #include <rpc/rpc.h>
       #include <netconfig.h>

DESCRIPTION
       These  routines  allow  C  language programs to make procedure calls on
       other machines across a network. First, the client sends a  request  to
       the server. On receipt of the request, the server calls a dispatch rou‐
       tine to perform the requested service, and then sends back a reply.


       All RPC routines require the header <rpc/rpc.h>. Routines that  take  a
       netconfig structure also require that <netconfig.h> be included.

   Multithread Considerations
       When  used  in multithreaded applications, client-side routines are MT-
       Safe. CLIENT handles can be shared between threads;  however,  in  this
       implementation,  requests by different threads are serialized (that is,
       the first request will receive its results before the second request is
       sent). See rpc_clnt_create(3C).


       When  used in multithreaded applications, server-side routines are usu‐
       ally Unsafe. In this implementation the service transport handle, SVCX‐
       PRT  contains  a  single  data area for decoding arguments and encoding
       results. See rpc_svc_create(3C). Therefore, this  structure  cannot  be
       freely  shared  between  threads that call functions that do this. Rou‐
       tines that are affected by this restriction are marked as unsafe for MT
       applications. See rpc_svc_calls(3C).

   Nettyp
       Some  of the high-level RPC interface routines take a nettype string as
       one  of  the  parameters  (for  example,  clnt_create(),  svc_create(),
       rpc_reg(), rpc_call()). This string defines a class of transports which
       can be used for a particular application.


       nettype can be one of the following:

       netpath       Choose from the transports which have been  indicated  by
                     their token names in the NETPATH environment variable. 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.


       circuit_v     This is same as visible except that it chooses  only  the
                     connection  oriented  transports  (semantics  tpi_cots or
                     tpi_cots_ord) from  the  entries  in  the  /etc/netconfig
                     file.


       datagram_v    This  is  same as visible except that it chooses only the
                     connectionless datagram transports  (semantics  tpi_clts)
                     from the entries in the /etc/netconfig file.


       circuit_n     This  is  same as netpath except that it chooses only the
                     connection  oriented   datagram   transports   (semantics
                     tpi_cots or tpi_cots_ord).


       datagram_n    This  is  same as netpath except that it chooses only the
                     connectionless datagram transports (semantics tpi_clts).


       udp           This refers to Internet UDP.


       tcp           This refers to Internet TCP.



       If nettype is NULL, it defaults to netpath. The transports are tried in
       left  to right order in the NETPATH variable or in top to down order in
       the /etc/netconfig file.

   Derived Types
       In a 64-bit environment, the derived types are defined as follows:


       tab(); lw(1.83i) lw(1.83i) lw(1.83i) typedefuint32_trpcprog_t;  typede‐
       fuint32_trpcvers_t; typedefuint32_trpcproc_t; typedefuint32_trpcprot_t;
       typedefuint32_trpcport_t; typedefint32_trpc_inline_t;



       In a 32-bit environment, the derived types are defined as follows:


       tab(); lw(1.83i)  lw(1.83i)  lw(1.83i)  typedefunsigned  longrpcprog_t;
       typedefunsigned  longrpcvers_t;  typedefunsigned longrpcproc_t; typede‐
       funsigned  longrpcprot_t;  typedefunsigned  longrpcport_t;  typedeflon‐
       grpc_inline_t;


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

   The AUTH Structure
         union  des_block  {
                 struct  {
                 u_int32  high;
                 u_int32  low;
                 }  key;
         char  c[8];
         };
         typedef  union  des_block  des_block;
         extern  bool_t  xdr_des_block();

         /*
          * Authentication info.  Opaque to client.
          */
         struct  opaque_auth  {
                 enum_t oa_flavor;       /* flavor of auth */
                 caddr_t oa_base;        /* address of more auth stuff */
                 uint_t oa_length;       /* not to exceed MAX_AUTH_BYTES */
         };

         /*
          * Auth handle, interface to client-side authenticators.
          */
          typedef  struct  {
                 struct opaque_auth ah_cred;
                 struct opaque_auth ah_verf;
                 union  des_block ah_key;
                 struct  auth_ops  {
                         void(*ah_nextverf)();
                         int(*ah_marshal)();     /* nextverf & serialize */
                         int(*ah_validate)();    /* validate verifier */
                         int(*ah_refresh)();     /* refresh credentials */
                         void(*ah_destroy)();    /* destroy this structure */
                 }  *ah_ops;
                 caddr_t  ah_private;
         }  AUTH;


   The CLIENT Structure
         /*
          *  Client  rpc  handle.
          *  Created  by  individual  implementations.
          *  Client is responsible for initializing auth.
          */
                 typedef  struct  {
                 AUTH    *cl_auth;       /* authenticator */
                 struct clnt_ops {
                       enum clnt_stat (*cl_call)();   /* call remote procedure */
                       void (*cl_abort)();            /* abort a call */
                       void (*cl_geterr)();           /* get specific error code */
                       bool_t (*cl_freeres)();        /* frees results */
                       void (*cl_destroy)();          /* destroy this structure */
                       bool_t (*cl_control)();        /* the ioctl() of rpc */
                       int (*cl_settimers)();         /* set rpc level timers */
                      } *cl_ops;
                      caddr_t    cl_private;                  /* private stuff */
                      char       *cl_netid;                   /* network identifier */
                      char       *cl_tp;                      /* device name */
         }  CLIENT;


   The SVCXPRT Structure
         enum  xprt_stat  {
         XPRT_DIED,
         XPRT_MOREREQS,
         XPRT_IDLE
         };
         /*
          *  Server-side  transport  handle
          */
         typedef  struct  {
                 int     xp_fd;                  /* file descriptor for the
                 ushort_t xp_port;               /* obsolete */
                 struct xp_ops {
                    bool_t (*xp_recv)(); /* receive incoming requests */
                    enum xprt_stat (*xp_stat)(); /* get transport status */
                    bool_t (*xp_getargs)();      /* get arguments */
                    bool_t (*xp_reply)();        /* send reply */
                    bool_t (*xp_freeargs)();     /* free mem allocated
                                                            for args */
                    void (*xp_destroy)();        /* destroy this struct */
                 } *xp_ops;
                 int xp_addrlen;                 /* length of remote addr.
                                                    Obsolete */
                 char *xp_tp;                    /* transport provider device
                                                    name */
                 char *xp_netid;                 /* network identifier */
                 struct netbuf xp_ltaddr;        /* local transport address */
                 struct netbuf xp_rtaddr;        /* remote transport address */
                 char xp_raddr[16];              /* remote address. Obsolete */
                 struct opaque_auth xp_verf;     /* raw response verifier */
                 caddr_t xp_p1;                  /* private: for use
                                                    by svc ops */
                 caddr_t xp_p2;                  /* private: for use
                                                    by svc ops */
                 caddr_t xp_p3;                  /* private: for use
                                                    by svc lib */
                 int xp_type                     /* transport type */
         }  SVCXPRT;


   The svc_reg Structure
         struct  svc_req  {
            rpcprog_t rq_prog;          /* service program number */
            rpcvers_t rq_vers;          /* service protocol version */
            rpcproc_t rq_proc;          /* the desired procedure */
            struct opaque_auth rq_cred; /* raw creds from the wire */
            caddr_t rq_clntcred;        /* read only cooked cred */
            SVCXPRT *rq_xprt;           /* associated transport */

         };


   The XDR Structure
         /*
          * XDR operations.
          * XDR_ENCODE causes the type to be encoded into the stream.
          * XDR_DECODE causes the type to be extracted from the stream.
          * XDR_FREE can be used to release the space allocated by an XDR_DECODE
          * request.
          */
         enum xdr_op {
             XDR_ENCODE=0,
             XDR_DECODE=1,
             XDR_FREE=2
         };
         /*
          * This is the number of bytes per unit of external data.
          */
         #define BYTES_PER_XDR_UNIT    (4)
         #define RNDUP(x)  ((((x) + BYTES_PER_XDR_UNIT - 1) /
                            BYTES_PER_XDR_UNIT) \ * BYTES_PER_XDR_UNIT)
         /*
          * A xdrproc_t exists for each data type which is to be encoded or
          * decoded.  The second argument to the xdrproc_t is a pointer to
          * an opaque pointer.  The opaque pointer generally points to a
          * structure of the data type to be decoded.  If this points to 0,
          * then the type routines should allocate dynamic storage of the
          * appropriate size and return it.
          * bool_t  (*xdrproc_t)(XDR *, caddr_t *);
          */
         typedef  bool_t (*xdrproc_t)();
         /*
          * The XDR handle.
          * Contains operation which is being applied to the stream,
          * an operations vector for the particular implementation
          */
         typedef struct {

         enum xdr_op x_op;    /* operation; fast additional param */
         struct  xdr_ops  {

         bool_t       (*x_getlong)();      /* get long from underlying stream */
         bool_t       (*x_putlong)();      /* put long to underlying stream */
         bool_t       (*x_getbytes)();     /* get bytes from underlying stream */
         bool_t       (*x_putbytes)();     /* put bytes to underlying stream */
         uint_t       (*x_getpostn)();     /* returns bytes off from beginning */
         bool_t       (*x_setpostn)();     /* reposition the stream */
         rpc_inline_t *(*x_inline)();      /* buf quick ptr to buffered data */
         void         (*x_destroy)();      /* free privates of this xdr_stream */
         bool_t       (*x_control)();      /* changed/retrieve client object info*/
         bool_t       (*x_getint32)();     /* get int from underlying stream */
         bool_t       (*x_putint32)();     /* put int to underlying stream */

         } *x_ops;

         caddr_t      x_public;             /* users' data */
         caddr_t      x_priv                /* pointer to private data */
         caddr_t      x_base;               /* private used for position info */
         int          x_handy;              /* extra private word */
         XDR;


   Index to Routines
       The  following  table lists RPC routines and the manual reference pages
       on which they are described:

       RPC Routine                Manual Reference Page


       auth_destroy               rpc_clnt_auth(3C)


       authdes_create             rpc_soc(3C)


       authdes_getucred           secure_rpc(3C)


       authdes_seccreate          secure_rpc(3C)


       authnone_create            rpc_clnt_auth(3C)


       authsys_create             rpc_clnt_auth(3C)


       authsys_create_default     rpc_clnt_auth(3C)


       authunix_create            rpc_soc(3C)


       authunix_create_default    rpc_soc(3C)


       callrpc                    rpc_soc(3C)


       clnt_broadcast             rpc_soc(3C)


       clnt_call                  rpc_clnt_calls(3C)


       clnt_control               rpc_clnt_create(3C)


       clnt_create                rpc_clnt_create(3C)


       clnt_destroy               rpc_clnt_create(3C)


       clnt_dg_create             rpc_clnt_create(3C)


       clnt_freeres               rpc_clnt_calls(3C)


       clnt_geterr                rpc_clnt_calls(3C)


       clnt_pcreateerror          rpc_clnt_create(3C)


       clnt_perrno                rpc_clnt_calls(3C)


       clnt_perror                rpc_clnt_calls(3C)


       clnt_raw_create            rpc_clnt_create(3C)


       clnt_spcreateerror         rpc_clnt_create(3C)


       clnt_sperrno               rpc_clnt_calls(3C)


       clnt_sperror               rpc_clnt_calls(3C)


       clnt_tli_create            rpc_clnt_create(3C)


       clnt_tp_create             rpc_clnt_create(3C)


       clnt_vc_create             rpc_clnt_create(3C)


       clntraw_create             rpc_soc(3C)


       clnttcp_create             rpc_soc(3C)


       clntudp_bufcreate          rpc_soc(3C)


       clntudp_create             rpc_soc(3C)


       get_myaddress              rpc_soc(3C)


       getnetname                 secure_rpc(3C)


       host2netname               secure_rpc(3C)


       key_decryptsession         secure_rpc(3C)


       key_encryptsession         secure_rpc(3C)


       key_gendes                 secure_rpc(3C)


       key_setsecret              secure_rpc(3C)


       netname2host               secure_rpc(3C)


       netname2user               secure_rpc(3C)


       pmap_getmaps               rpc_soc(3C)


       pmap_getport               rpc_soc(3C)


       pmap_rmtcall               rpc_soc(3C)


       pmap_set                   rpc_soc(3C)


       pmap_unset                 rpc_soc(3C)


       registerrpc                rpc_soc(3C)


       rpc_broadcast              rpc_clnt_calls(3C)


       rpc_broadcast_exp          rpc_clnt_calls(3C)


       rpc_call                   rpc_clnt_calls(3C)


       rpc_reg                    rpc_svc_reg(3C)


       svc_create                 rpc_svc_create(3C)


       svc_destroy                rpc_svc_create(3C)


       svc_dg_create              rpc_svc_create(3C)


       svc_dg_enablecache         rpc_svc_calls(3C)


       svc_fd_create              rpc_svc_create(3C)


       svc_fds                    rpc_soc(3C)


       svc_freeargs               rpc_svc_calls(3C)


       svc_getargs                rpc_svc_calls(3C)


       svc_getcaller              rpc_soc(3C)


       svc_getreq                 rpc_soc(3C)


       svc_getreqset              rpc_svc_calls(3C)


       svc_getrpccaller           rpc_svc_calls(3C)


       svc_raw_create             rpc_svc_create(3C)


       svc_reg                    rpc_svc_reg(3C)


       svc_register               rpc_soc(3C)


       svc_run                    rpc_svc_calls(3C)


       svc_sendreply              rpc_svc_calls(3C)


       svc_tli_create             rpc_svc_create(3C)


       svc_tp_create              rpc_svc_create(3C)


       svc_unreg                  rpc_svc_reg(3C)


       svc_unregister             rpc_soc(3C)


       svc_vc_create              rpc_svc_create(3C)


       svcerr_auth                rpc_svc_err(3C)


       svcerr_decode              rpc_svc_err(3C)


       svcerr_noproc              rpc_svc_err(3C)


       svcerr_noprog              rpc_svc_err(3C)


       svcerr_progvers            rpc_svc_err(3C)


       svcerr_systemerr           rpc_svc_err(3C)


       svcerr_weakauth            rpc_svc_err(3C)


       svcfd_create               rpc_soc(3C)


       svcraw_create              rpc_soc(3C)


       svctcp_create              rpc_soc(3C)


       svcudp_bufcreate           rpc_soc(3C)


       svcudp_create              rpc_soc(3C)


       user2netname               secure_rpc(3C)


       xdr_accepted_reply         rpc_xdr(3C)


       xdr_authsys_parms          rpc_xdr(3C)


       xdr_authunix_parms         rpc_soc(3C)


       xdr_callhdr                rpc_xdr(3C)


       xdr_callmsg                rpc_xdr(3C)


       xdr_opaque_auth            rpc_xdr(3C)


       xdr_rejected_reply         rpc_xdr(3C)


       xdr_replymsg               rpc_xdr(3C)


       xprt_register              rpc_svc_reg(3C)


       xprt_unregister            rpc_svc_reg(3C)


FILES
       /etc/netconfig

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE VALUE _ MT-LevelMT-Safe with exceptions


SEE ALSO
       getnetconfig(3C),           getnetpath(3C),          rpc_clnt_auth(3C),
       rpc_clnt_calls(3C),       rpc_clnt_create(3C),       rpc_svc_calls(3C),
       rpc_svc_create(3C),   rpc_svc_err(3C),   rpc_svc_reg(3C),  rpc_xdr(3C),
       rpcbind(3C),    secure_rpc(3C),    xdr(3C),    netconfig(5),    rpc(5),
       attributes(7), environ(7), threads(7)



Oracle Solaris 11.4               11 May 2021                          rpc(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3