RPC_SOC(3)
β¨ NAME β¨
okay so bestie, this is RPC_SOC(3) β the manual page for a whole squad of old-school RPC routines: rpc_soc, auth_destroy, authnone_create, authunix_create, authunix_create_default, callrpc, clnt_broadcast, clnt_call, clnt_control, clnt_create, clnt_destroy, clnt_freeres, clnt_geterr, clnt_pcreateerror, clnt_perrno, clnt_perror, clnt_spcreateerror, clnt_sperrno, clnt_sperror, clntraw_create, clnttcp_create, clntudp_bufcreate, clntudp_create, clntunix_create, get_myaddress, pmap_getmaps, pmap_getport, pmap_rmtcall, pmap_set, pmap_unset, registerrpc, rpc_createerr, svc_destroy, svc_fds, svc_fdset, svc_getargs, svc_getcaller, svc_getreq, svc_getreqset, svc_register, svc_run, svc_sendreply, svc_unregister, svcerr_auth, svcerr_decode, svcerr_noproc, svcerr_noprog, svcerr_progvers, svcerr_systemerr, svcerr_weakauth, svcfd_create, svcunixfd_create, svcraw_create, svcunix_create, xdr_accepted_reply, xdr_authunix_parms, xdr_callhdr, xdr_callmsg, xdr_opaque_auth, xdr_pmap, xdr_pmaplist, xdr_rejected_reply, xdr_replymsg, xprt_register, xprt_unregister β library routines for remote procedure calls. π
πΈ SYNOPSIS πΈ
#include <rpc/rpc.h>
See βDESCRIPTIONβ for function declarations.
π¦ DESCRIPTION π¦
The svc_*() and clnt_*() functions described in this page are the old, TS-RPC interface to the XDR and RPC library, and exist for backward compatibility. The new interface is described in the pages referenced from rpc(3).
These routines allow C programs to make procedure 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. Finally, the procedure call returns to the client.
Routines that are used for Secure RPC (DES authentication) are described in rpc_secure(3). Secure RPC can be used only if DES encryption is available.
auth_destroy
void
auth_destroy(AUTH *auth)
okay so this one is a macro, and it destroys the authentication info linked to auth. The destruction usually means it deallocates the private data structures. After you call auth_destroy(), using auth is undefined β so literally do not. π
authnone_create
AUTH *
authnone_create()
Creates and returns an RPC authentication handle that passes nonusable authentication information with every remote procedure call. This is the default authentication that RPC uses. it's giving βwe're not doing security todayβ π
authunix_create
AUTH *
authunix_create(char *host, int uid, int gid, int len, int *aup_gids)
Creates and returns an RPC authentication handle packed with Unix authentication information. The host argument is the name of the machine where the info was created; uid is the user's user ID; gid is the user's current group ID; len and aup_gids point to a counted array of groups the user belongs to. And yes bestie, it is easy to impersonate a user. no cap.
authunix_create_default
AUTH *
authunix_create_default()
Calls authunix_create() with the appropriate arguments. that's it, that's the whole thing. β¨
callrpc
int callrpc(char *host, u_long prognum, u_long versnum, u_long procnum,
xdrproc_t inproc, void *in, xdrproc_t outproc, void *out)
Calls the remote procedure tied to prognum, versnum, and procnum on the machine host. The in argument is the address of the procedure's argument(s), and out is where the result(s) go; inproc encodes the procedure's arguments, and outproc decodes the procedure's results. This routine returns zero if it succeeds, or the value of enum clnt_stat cast to an integer if it fails. The routine clnt_perrno() is handy for turning failure statuses into messages.
Warning: calling remote procedures with this routine uses UDP/IP as a transport; see clntudp_create() for restrictions. You do not have control of timeouts or authentication using this routine. π«
clnt_broadcast
enum clnt_stat
clnt_broadcast(u_long prognum, u_long versnum, u_long procnum,
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out,
bool_t (*eachresult)(caddr_t, struct sockaddr_in *))
Like callrpc(), except the call message is broadcast to all locally connected broadcast nets. Every time it gets a response, this routine calls eachresult(), whose form is:
bool_t eachresult(caddr_t out, struct sockaddr_in *addr)
where out is the same as the out passed to clnt_broadcast(), except the remote procedure's output is decoded there; addr points to the address of the machine that sent the results. If eachresult() returns zero, clnt_broadcast() waits for more replies; otherwise it returns with appropriate status. iconic behavior honestly.
Warning: broadcast sockets are limited in size to the maximum transfer unit of the data link. For ethernet, this value is 1500 bytes. so like, don't try to send your whole novel through it. π
clnt_call
enum clnt_stat
clnt_call(CLIENT *clnt, u_long procnum, xdrproc_t inproc, char *in,
xdrproc_t outproc, char *out, struct timeval tout)
A macro that calls the remote procedure procnum associated with the client handle, clnt, which you get from an RPC client creation routine such as clnt_create(). The in argument is the address of the procedure's argument(s), and out is where the result(s) go; inproc encodes the procedure's arguments, and outproc decodes the procedure's results; tout is the time allowed for results to come back. β³
clnt_destroy
void clnt_destroy(CLIENT *clnt)
A macro that destroys the client's RPC handle. Destruction usually involves deallocating private data structures, including clnt itself. Use of clnt is undefined after calling clnt_destroy(). If the RPC library opened the associated socket, it will close it too. Otherwise, the socket stays open. so cleanup era π
clnt_create
CLIENT *
clnt_create(char *host, u_long prog, u_long vers, char *proto)
Generic client creation routine. The host argument is the name of the remote host where the server lives. The proto argument says which kind of transport protocol to use. The currently supported values for this field are "udp" and "tcp". Default timeouts are set, but can be modified using clnt_control().
Warning: Using UDP has its shortcomings. Since UDP-based RPC messages can only hold up to 8 Kbytes of encoded data, this transport cannot be used for procedures that take large arguments or return huge results. highkey a vibe killer for big data. π«
clnt_control
bool_t
clnt_control(CLIENT *cl, u_int req, char *info)
A macro used to change or retrieve various information about a client object. The req argument says what type of operation you want, and info is a pointer to the information. For both UDP and TCP, the supported values of req and their argument types and what they do are:
CLSET_TIMEOUTβstruct timevalβ set total timeoutCLGET_TIMEOUTβstruct timevalβ get total timeout
Note: if you set the timeout usingclnt_control(), the timeout argument passed toclnt_call()will be ignored in all future calls. so choose wisely bestie.
CLGET_SERVER_ADDRβstruct sockaddr_inβ get server's address
The following operations are valid for UDP only:
CLSET_RETRY_TIMEOUTβstruct timevalβ set the retry timeoutCLGET_RETRY_TIMEOUTβstruct timevalβ get the retry timeout
The retry timeout is the time that UDP RPC waits for the server to reply before retransmitting the request. β±οΈ
clnt_freeres
bool_t clnt_freeres(CLIENT *clnt, xdrproc_t outproc, char *out)
A macro that frees any data allocated by the RPC/XDR system when it decoded the results of an RPC call. The out argument is the address of the results, and outproc is the XDR routine describing the results. This routine returns one if the results were successfully freed, and zero otherwise. free the girlies π
clnt_geterr
void
clnt_geterr(CLIENT *clnt, struct rpc_err *errp)
A macro that copies the error structure out of the client handle to the structure at address errp. error lore unlocked. π
clnt_pcreateerror
void
clnt_pcreateerror(char *s)
prints a message to standard error saying why a client RPC handle could not be created. The message is prepended with string s and a colon. A newline is appended at the end of the message. Used when a clnt_create(), clntraw_create(), clnttcp_create(), or clntudp_create() call fails. it's giving error translator. π
clnt_perrno
void
clnt_perrno(enum clnt_stat stat)
Prints a message to standard error that corresponds to the condition indicated by stat. A newline is appended at the end of the message. Used after callrpc(). π’
clnt_perror
void clnt_perror(CLIENT *clnt, char *s)
Prints a message to standard error saying 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. Used after clnt_call(). π«Ά
clnt_spcreateerror
char *
clnt_spcreateerror(char *s)
Like clnt_pcreateerror(), except that it returns a string instead of printing to the standard error.
Bugs: returns pointer to static data that is overwritten on each call. so don't hold onto it like it's your forever text. π
clnt_sperrno
char *
clnt_sperrno(enum clnt_stat stat)
Takes the same arguments as clnt_perrno(), but instead of sending a message to the standard error saying why an RPC call failed, it returns a pointer to a string that contains the message.
The clnt_sperrno() function is used instead of clnt_perrno() if 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 output with printf(), or if a message format different from that supported by clnt_perrno() is to be used.
Note: unlikeclnt_sperror()andclnt_spcreateerror(),clnt_sperrno()returns pointer to static data, but the result will not get overwritten on each call. so this one is lowkey stable, slay. β¨
clnt_sperror
char *
clnt_sperror(CLIENT *rpch, char *s)
Like clnt_perror(), except that (like clnt_sperrno()) it returns a string instead of printing to standard error.
Bugs: returns pointer to static data that is overwritten on each call. same static-data situation, bestie. π
CLIENT *
clntraw_create(u_long prognum, u_long versnum)
okay bestie this one is the toy of the family π
it builds you an RPC client for the remote program prognum, version versnum, except the "transport" is literally just a buffer inside your own process's address space π« which means the matching RPC server has to live in the same address space as you β go look at svcraw_create(). why would anyone do this? to simulate RPC and measure RPC overheads like round trip times without any kernel interference β¨ science slay. returns NULL if it fails, and it will fail, so check it, bestie π
CLIENT *
clnttcp_create(struct sockaddr_in *addr, u_long prognum, u_long versnum,
int *sockp, u_int sendsz, u_int recvsz)
real RPC hours π this creates an RPC client for remote program prognum, version versnum, riding on TCP/IP. the remote program lives at Internet address addr. if addr->sin_port is zero, it gets set to the actual port the remote program is listening on β and yes, the remote rpcbind(8) service is the one being consulted for that info π
sockp is a socket; if it's RPC_ANYSOCK, this routine opens a fresh one and sets sockp for you. since TCP-based RPC does buffered I/O, you get to pick your send and receive buffer sizes with sendsz and recvsz β values of zero mean choose suitable defaults π§
returns NULL if it fails. periodt.
CLIENT *
clntudp_create(struct sockaddr_in *addr, u_long prognum, u_long versnum,
struct timeval wait, int *sockp)
same deal, but UDP/IP bestie π¦ client for remote program prognum, version versnum, remote program at Internet address addr. if addr->sin_port is zero it gets set to the actual port the remote program is listening on (again, remote rpcbind(8) is consulted for this, iykyk). sockp is a socket; RPC_ANYSOCK makes it open a new one and set sockp.
now the spicy part: the UDP transport resends the call message in intervals of wait time until a response shows up or the call times out π and the total time for the call to time out is specified by clnt_call().
β οΈ warning, no cap: since UDP-based RPC messages can only hold up to 8 Kbytes of encoded data, this transport cannot be used for procedures that take large arguments or return huge results. keep it small or suffer π«Ά
CLIENT *
clntudp_bufcreate(struct sockaddr_in *addr, u_long prognum,
u_long versnum, struct timeval wait, int *sockp,
unsigned int sendsize, unsigned int recosize)
the upgrade version of the UDP vibe β¨ client for remote program prognum, on versnum, UDP/IP transport, remote program at Internet address addr. addr->sin_port zero β set to the actual port the remote program is listening on (say it with me: the remote rpcbind(8) service is consulted for this information π). sockp is a socket; RPC_ANYSOCK β opens a new one and sets sockp. the UDP transport resends the call message in intervals of wait time until a response is received or the call times out, and the total timeout is specified by clnt_call().
the whole point of this one? it lets you specify the maximum packet size for sending and receiving UDP-based RPC messages, via sendsize and recosize π so you're not stuck at that 8 Kbyte situation. iconic.
CLIENT *
clntunix_create(struct sockaddr_un *raddr, u_long prognum,
u_long versnum, int *sockp, u_int sendsz, u_int recvsz)
local girlies rise πΈ this creates an RPC client for the local program prognum, version versnum, using Unix-domain sockets as the transport. the local program is located at *raddr. sockp is a socket; if it's RPC_ANYSOCK, this routine opens a new one and sets sockp. since Unix-based RPC uses buffered I/O, you can specify the size of the send and receive buffers with sendsz and recvsz β zero means suitable defaults π§ returns NULL if it fails. no network, no drama, just vibes.
int
get_myaddress(struct sockaddr_in *addr)
bestie it just stuffs the machine's IP address into addr π and the way it does that is without consulting the library routines that deal with /etc/hosts β rude of it? maybe. efficient? yes. the port number is always set to htons(PMAPPORT) β returns zero on success, non-zero on failure. short and sweet.
struct pmaplist *
pmap_getmaps(struct sockaddr_in *addr)
a user interface to the rpcbind(8) service π which returns a list of the current RPC program-to-port mappings</lavel> on the host located at IP address addr. yes this routine can return NULL, so handle that π and fun fact: the command rpcinfo -p uses this routine. so when you run that, this is the function carrying the whole thing on its back π
u_short
pmap_getport(struct sockaddr_in *addr, u_long prognum, u_long versnum,
u_long protocol)
another user interface to the rpcbind(8) service β¨ it returns the port number on which waits</span> a service that supports program number prognum, version versnum, and speaks the transport protocol associated with protocol. that protocol value is most likely IPPROTO_UDP or IPPROTO_TCP π
a return value of zero means either that the mapping does not exist, or that the RPC system failed to contact the remote rpcbind(8) service. in that latter case, the global variable rpc_createerr contains the RPC status. so zero is giving "mystery" and you gotta dig π
enum clnt_stat
pmap_rmtcall(struct sockaddr_in *addr, u_long prognum, u_long versnum,
u_long procnum, xdrproc_t inproc, char *in, xdrproc_t outproc,
char *out, struct timeval tout, u_long *portp)
okay so this one is a user interface to the rpcbind(8) service that instructs rpcbind(8) on the host at IP address addr to make an RPC call on your behalf to a procedure on that host π«Ά the portp argument will be modified to the program's port number if the procedure succeeds β¨ the definitions of the other arguments are discussed in callrpc() and clnt_call() β go read those, bestie.
β οΈ this procedure should be used for a "ping" and nothing else. do not make it your main character. see also clnt_broadcast().
bool_t
pmap_set(u_long prognum, u_long versnum, u_long protocol, u_short port)
user interface to the rpcbind(8) service again π
it establishes a mapping between the triple (prognum, versnum, protocol) and port on the machine's rpcbind(8) service. protocol is most likely IPPROTO_UDP or IPPROTO_TCP. this routine returns one if it succeeds, zero otherwise. and plot twist: it's automatically done by svc_register() so half the time you're not even calling it yourself, it's just happening. iconic behaviour tbh.
bool_t
pmap_unset(u_long prognum, u_long versnum)
the eraser π§Ή a user interface to the rpcbind(8) service which destroys all mapping between the triple (prognum, versnum, *) and ports on the machine's rpcbind(8) service. note the * β that's a wildcard situation, it's taking out everything for that pair π returns one if it succeeds, zero otherwise.
bool_t
registerrpc(u_long prognum, u_long versnum, u_long procnum,
char *(*procname)(void), xdrproc_t inproc, xdrproc_t outproc)
this registers procedure procname with the RPC service package π so if a request arrives for program prognum, version versnum, and procedure procnum, then procname is called with a pointer to its argument(s). progname should return a pointer to its static result(s) β yes, static, don't come at it with your fancy heap, that's what the manpage says π inproc is used to decode the arguments while outproc is used to encode the results β¨
this routine returns zero if the registration succeeded, -1 otherwise. (yes, zero means success, it's giving chaos but that's the API π)
β οΈ warning: remote procedures registered in this form are accessed using the UDP/IP transport; see svcudp_create() for restrictions. so all that UDP smallness applies, bestie.
struct rpc_createerr rpc_createerr;
a global variable π
its value gets set by any RPC client creation routine that does not succeed π« so when something goes wrong, this is where the receipts are. use the routine clnt_pcreateerror() to print the reason why. your debugging bestie fr fr.
bool_t svc_destroy(SVCXPRT * xprt)
a macro that destroys the RPC service transport handle, xprt β¨ destruction usually involves deallocation of private data structures, including xprt itself β so yeah it takes the whole thing out.
β οΈ use of xprt is undefined after calling this routine. do not touch it. do not look at it. it's gone. π
fd_set svc_fdset;
a global variable reflecting the RPC service side's read file descriptor bit mask π it's suitable as a template argument to the select(2) system call. this is only of interest if a service implementor does not call svc_run(), but rather does his own asynchronous event processing (main character energy, we respect it π).
this variable is read-only β and I cannot stress this enough, do not pass its address to select(2)! β yet it may change after calls to svc_getreqset() or any creation routines π also, note that if the process has descriptor limits which are extended beyond FD_SETSIZE, this variable will only be usable for the first FD_SETSIZE descriptors. so, limited. keep that in mind.
int svc_fds;
similar to svc_fdset, but limited to 32 descriptors. this interface is obsoleted by svc_fdset. legacy behaviour, respect the elders but move on bestie π
bool_t svc_freeargs(SVCXPRT *xprt, xdrproc_t inproc, char *in)
a macro that frees any data allocated by the RPC/XDR system when it decoded the arguments to a service procedure using svc_getargs() π§Ή so it's the cleanup crew, the one that comes in after the party β¨ this routine returns 1 if the results were successfully freed, and zero otherwise.
bool_t svc_getargs(SVCXPRT *xprt, xdrproc_t inproc, char *in)
a macro that decodes the arguments of an RPC request associated with the RPC service transport handle, xprt π
the in argument is the address where the arguments will be placed; inproc is the XDR routine used to decode the arguments π this routine returns one if decoding succeeds, and zero otherwise. and remember to svc_freeargs() after, bestie, don't leak π«Ά
struct sockaddr_in *
svc_getcaller(SVCXPRT *xprt)
the approved way π of getting the network address of the caller of a procedure associated with the RPC service transport handle, xprt. that's it. that's the whole thing. the sanctioned method, no shortcuts allowed β¨
void svc_getreqset(fd_set *rdfds)
this routine is only of interest if a service implementor does not call svc_run(), but instead implements custom asynchronous event processing π¦ it is called when the select(2) system call has determined that an RPC request has arrived on some RPC socket(s); rdfds is the resultant read file descriptor bit mask π
the routine returns when all sockets associated with the value of rdfds have been serviced. so it's not leaving until the job's done. periodt.
void svc_getreq(int rdfds)
similar to svc_getreqset(), but limited to 32 descriptors. this interface is obsoleted by svc_getreqset(). again with the 32 limit π it's giving vintage.
π«Ά svc_register
bool_t svc_register(SVCXPRT *xprt, u_long prognum, u_long versnum,
void (*dispatch)(struct svc_req *, SVCXPRT *), int protocol)
Okay so this one is the matchmaker bestie β¨ β it hooks prognum and versnum up with the service dispatch procedure, aka dispatch().
Now here's the tea on protocol:
- if
protocolis zero β the service is not registered with therpcbind(8)service, periodt. - if
protocolis non-zero β a mapping of the triple(prognum, versnum, protocol)toxprt->xp_portgets established with the localrpcbind(8)service. And like, generallyprotocolis zero,IPPROTO_UDPorIPPROTO_TCP. iykyk π
And dispatch() has this exact shape, no notes:
bool_t dispatch(struct svc_req *request, SVCXPRT *xprt)
svc_register() returns one if it succeeds, and zero otherwise. Slay or flop, no in-between πΈ
π svc_run
svc_run()
This routine never returns. Not "usually doesn't", not "might not" β it literally never comes back, bestie, it's giving forever-girl π
It waits for RPC requests to arrive, and calls the appropriate service procedure using svc_getreq() when one arrives. This procedure is usually waiting for a select(2) system call to return. Iconic blocking behaviour, honestly.
π svc_sendreply
bool_t svc_sendreply(SVCXPRT *xprt, xdrproc_t outproc, char *out)
Called by an RPC service's dispatch routine to send the results of a remote procedure call. The deets:
xprtis the request's associated transport handleoutprocis the XDR routine which is used to encode the resultsoutis the address of the results
This routine returns one if it succeeds, zero otherwise. π«Ά
π svc_unregister
void
svc_unregister(u_long prognum, u_long versnum)
Remove all mapping of the double (prognum, versnum) to dispatch routines, and of the triple (prognum, versnum, *) to port number. Clean slate energy, we love a fresh start β¨
π§ svcerr_auth
void
svcerr_auth(SVCXPRT *xprt, enum auth_stat why)
Called by a service dispatch routine that refuses to perform a remote procedure call due to an authentication error. Not today, unauthorized stranger π«
π¦ svcerr_decode
void
svcerr_decode(SVCXPRT *xprt)
Called by a service dispatch routine that cannot successfully decode its arguments. Like when the vibes arrive but they're unreadable π See also svc_getargs().
π svcerr_noproc
void
svcerr_noproc(SVCXPRT *xprt)
Called by a service dispatch routine that does not implement the procedure number that the caller requests. Wrong number, wrong girl, no cap π
β svcerr_noprog
void
svcerr_noprog(SVCXPRT *xprt)
Called when the desired program is not registered with the RPC package. Service implementors usually do not need this routine β so like, if that's you, you can lowkey ignore it π
π svcerr_progvers
void
svcerr_progvers(SVCXPRT *xprt, u_long low_vers, u_long high_vers)
Called when the desired version of a program is not registered with the RPC package. Service implementors usually do not need this routine either. Same energy, different error πΈ
π₯ svcerr_systemerr
void
svcerr_systemerr(SVCXPRT *xprt)
Called by a service dispatch routine when it detects a system error not covered by any particular protocol. For example, if a service can no longer allocate storage, it may call this routine. Genuine "everything is on fire and there's no specific label for it" moment π
π svcerr_weakauth
void
svcerr_weakauth(SVCXPRT *xprt)
Called by a service dispatch routine that refuses to perform a remote procedure call due to insufficient authentication arguments. The routine calls svcerr_auth(xprt, AUTH_TOOWEAK). The name says it all bestie β the credentials simply did not eat π
β¨ svcraw_create
SVCXPRT *
svcraw_create(void)
This routine creates a toy RPC service transport, to which it returns a pointer. And it's a toy literally β the transport is really a buffer within the process's address space, so the corresponding RPC client should live in the same address space; see clntraw_create().
This routine allows simulation of RPC and acquisition of RPC overheads (such as round trip times), without any kernel interference. Perfect little sandbox, no kernel drama, obsessed π«Ά
This routine returns NULL if it fails.
πΈ svctcp_create
SVCXPRT *
svctcp_create(int sock, u_int send_buf_size, u_int recv_buf_size)
This routine creates a TCP/IP-based RPC service transport, to which it returns a pointer. The transport is associated with the socket sock, which may be RPC_ANYSOCK, in which case a new socket is created.
If the socket is not bound to a local TCP port, then this routine binds it to an arbitrary port. Upon completion:
xprt->xp_fdis the transport's socket descriptorxprt->xp_portis the transport's port number
This routine returns NULL if it fails.
Since TCP-based RPC uses buffered I/O, users may specify the size of buffers; values of zero choose suitable defaults. Let the defaults cook π³
π¦ svcunix_create
SVCXPRT *
svcunix_create(int sock, u_int send_buf_size, u_int recv_buf_size, char
*path)
This routine creates a Unix-based RPC service transport, to which it returns a pointer. The transport is associated with the socket sock, which may be RPC_ANYSOCK, in which case a new socket is created.
The *path argument is a variable-length file system pathname of at most 104 characters. That file is not removed when the socket is closed β so it just... stays there. The unlink(2) system call must be used to remove the file. Cleanup is your job, bestie, no one's coming to do it for you π§Ή
Upon completion, xprt->xp_fd is the transport's socket descriptor. This routine returns NULL if it fails.
Since Unix-based RPC uses buffered I/O, users may specify the size of buffers; values of zero choose suitable defaults.
π svcunixfd_create
SVCXPRT *
svcunixfd_create(int fd, u_int sendsize, u_int recvsize)
Create a service on top of any open descriptor. The sendsize and recvsize arguments indicate sizes for the send and receive buffers. If they are zero, a reasonable default is chosen. Simple, flexible, iconic β¨
π svcfd_create
SVCXPRT *
svcfd_create(int fd, u_int sendsize, u_int recvsize)
Create a service on top of any open descriptor. Typically, this descriptor is a connected socket for a stream protocol such as TCP.
The sendsize and recvsize arguments indicate sizes for the send and receive buffers. If they are zero, a reasonable default is chosen. Same deal as its sibling, slightly different main character energy π
π svcudp_bufcreate
SVCXPRT *
svcudp_bufcreate(int sock, u_int sendsize, u_int recvsize)
This routine creates a UDP/IP-based RPC service transport, to which it returns a pointer. The transport is associated with the socket sock, which may be RPC_ANYSOCK, in which case a new socket is created.
If the socket is not bound to a local UDP port, then this routine binds it to an arbitrary port. Upon completion:
xprt->xp_fdis the transport's socket descriptorxprt->xp_portis the transport's port number
This routine returns NULL if it fails.
This allows the user to specify the maximum packet size for sending and receiving UDP-based RPC messages. Custom packet sizes? We love a user who knows what they want π₯
β xdr_accepted_reply
bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar)
Used for encoding RPC reply messages. This routine is useful for users who wish to generate RPC-style messages without using the RPC package. DIY queen behaviour, respect π«Ά
π§ xdr_authunix_parms
bool_t xdr_authunix_parms(XDR *xdrs, struct authunix_parms *aupp)
Used for describing Unix credentials. This routine is useful for users who wish to generate these credentials without using the RPC authentication package. Hand-rolled credentials, no package needed π
π xdr_callhdr
void
bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *chdr)
Used for describing RPC call header messages. This routine is useful for users who wish to generate RPC-style messages without using the RPC package.
Yeah bestie, that signature above really does sayvoidandbool_tβ that's exactly how it's written, so I'm leaving it untouched. Not my typo, not my problem π
π xdr_callmsg
bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
Used for describing RPC call messages. This routine is useful for users who wish to generate RPC-style messages without using the RPC package. Same vibe as above, but for the whole call message πΈ
π₯ xdr_opaque_auth
bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap)
Used for describing RPC authentication information messages. This routine is useful for users who wish to generate RPC-style messages without using the RPC package. Opaque but make it auth β¨
π xdr_pmap
struct pmap;
bool_t xdr_pmap(XDR *xdrs, struct pmap *regs)
Used for describing arguments to various rpcbind(8) procedures, externally. This routine is useful for users who wish to generate these arguments without using the pmap_*() interface. Going around the usual interface, we see you π
π¦ xdr_pmaplist
bool_t xdr_pmaplist(XDR *xdrs, struct pmaplist **rp)
Used for describing a list of port mappings, externally. This routine is useful for users who wish to generate these arguments without using the pmap_*() interface. Whole list, all the mappings, no pmap_*() in sight π
π xdr_rejected_reply
bool_t xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr)
Used for describing RPC reply messages. This routine is useful for users who wish to generate RPC-style messages without using the RPC package. Rejection, but make it XDR π
π xdr_replymsg
bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
Used for describing RPC reply messages. This routine is useful for users who wish to generate RPC style messages without using the RPC package. (Note the lil missing hyphen in "RPC style" β keeping it exactly as written, character for character π«Ά)
β¨ xprt_register
void
xprt_register(SVCXPRT *xprt)
After RPC service transport handles are created, they should register themselves with the RPC service package. This routine modifies the global variable svc_fds. Service implementors usually do not need this routine. So like, if that's not you, carry on π
πΈ xprt_unregister
void
xprt_unregister(SVCXPRT *xprt)
Before an RPC service transport handle is destroyed, it should unregister itself with the RPC service package. This routine modifies the global variable svc_fds. Service implementors usually do not need this routine. The matching breakup arc to xprt_register() π
π AVAILABILITY
These functions are part of libtirpc.
π SEE ALSO
Also, the reading list, bestie β go get your education π:
- Remote Procedure Calls: Protocol Specification.
- Remote Procedure Call Programming Guide.
- rpcgen Programming Guide.
- RPC: Remote Procedure Call Protocol Specification, Sun Microsystems, Inc., USC-ISI, RFC1050.
That's the whole page, start to finish, no cap π This one came from Debian and it's dated February 16, 1988 β literally older than most of our parents and still out here explaining RPC to us, iconic behaviour honestly. Go forth and register your transports, bestie πβ¨
π¦ where this page comes from
- alpine 3.22: libtirpc-doc 1.3.5-r0 Β· BSD-3-Clause
- alpine 3.23: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- alpine 3.24: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- arch rolling: libtirpc 1.3.8-1 Β· SISSL AND BSD-3-Clause
- centos-stream 10: libtirpc-devel 1.3.5-1.el10 Β· SISSL AND BSD-3-Clause
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- debian bookworm: libtirpc-dev 1.3.3+ds-1 Β· BSD-3-Clause
- debian trixie: libtirpc-dev 1.3.6+ds-1 Β· BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- nixos 26.05: libtirpc 1.3.7
- nixpkgs unstable: libtirpc 1.3.7
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2build1 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2ubuntu0.1 Β· BSD-3-Clause
- ubuntu noble: libtirpc-dev 1.3.4+ds-1.1build1 Β· BSD-3-Clause
- ubuntu questing: libtirpc-dev 1.3.6+ds-1
- ubuntu resolute: libtirpc-dev 1.3.7-0.1 Β· BSD-3-Clause
- ubuntu stonking: libtirpc-dev 1.3.7+ds-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms