RPCBIND(3)
π RPCBIND(3) β the RPC bind service bestie handbook
okay so this whole page lives in the Library Functions Manual (that's the manual name, cute, we move), and it's all about the library routines for the RPC bind service. pull up a chair π
πΈ NAME πΈ
rpcb_getmaps, rpcb_getaddr, rpcb_gettime, rpcb_rmtcall, rpcb_set, rpcb_unset β library routines for RPC bind service, periodt.
β¨ LIBRARY β¨
Standard C Library (libc, -lc). yes bestie, just link the standard C library and you're so back.
π¦ SYNOPSIS π¦
like, here's the whole cast list, character for character:
#include <rpc/rpc.h>
rpcblist *
rpcb_getmaps(const struct netconfig *netconf, const char *host);
bool_t
rpcb_getaddr(const rpcprog_t prognum, const rpcvers_t versnum,
const struct netconfig *netconf, struct netbuf *svcaddr,
const char *host);
bool_t
rpcb_gettime(const char *host, time_t * timep);
enum clnt_stat
rpcb_rmtcall(const struct netconfig *netconf, const char *host,
const rpcprog_t prognum, const rpcvers_t versnum,
const rpcproc_t procnum, const xdrproc_t inproc, const caddr_t in,
const xdrproc_t outproc, const caddr_t out,
const struct timeval tout, const struct netbuf *svcaddr);
bool_t
rpcb_set(const rpcprog_t prognum, const rpcvers_t versnum,
const struct netconfig *netconf, const struct netbuf *svcaddr);
bool_t
rpcb_unset(const rpcprog_t prognum, const rpcvers_t versnum,
const struct netconfig *netconf);
π DESCRIPTION π
okay so picture this: these routines let client C programs make procedure calls to the RPC binder service. that service (see rpcbind(8)) maintains a list of mappings between programs and their universal addresses. it's giving matchmaker, honestly β programs on one side, universal addresses on the other, and rpcbind is the friend who knows everybody. π
π Routines π
π rpcb_getmaps()
an interface to the rpcbind service that returns a list of the current RPC program-to-address mappings on host. it uses the transport specified through netconf to contact the remote rpcbind service on host. and listen β this routine will return NULL if the remote rpcbind could not be contacted. not a vibe, but that's the deal. π
π§ rpcb_getaddr()
an interface to the rpcbind service that finds the address of the service on host that's registered with program number prognum, version versnum, and speaks the transport protocol associated with netconf. the address found gets returned in svcaddr. important: the svcaddr argument should be preallocated, bestie, don't come in empty-handed.
this routine returns TRUE if it succeeds. a return value of FALSE means the mapping does not exist, or that the RPC system failed to contact the remote rpcbind service. in that latter case, the global variable rpc_createerr (see rpc_clnt_create(3)) contains the RPC status β so like, go check it, the tea is in there. π₯
π rpcb_gettime()
this routine returns the time on host in timep. if host is NULL, rpcb_gettime() returns the time on its own machine β main character energy, self-sufficient. this routine returns TRUE if it succeeds, FALSE if it fails. also you can use rpcb_gettime() to synchronize the time between the client and the remote server. clock besties, fr fr. β
π rpcb_rmtcall()
an interface to the rpcbind service that instructs rpcbind on host to make an RPC call on your behalf to a procedure on that host. the netconfig() structure should correspond to a connectionless transport. the svcaddr argument will be modified to the server's address if the procedure succeeds (see rpc_call() and clnt_call() in rpc_clnt_calls(3) for the definitions of the other arguments).
this procedure should normally be used for a βpingβ and nothing else. it allows programs to do lookup and call, all in one step. efficiency slay.
Note: even if the server is not running, rpcb_rmtcall() does not return any error messages to the caller. in such a case, the caller times out. yeah. you just sit there. π
Note: rpcb_rmtcall() is only available for connectionless transports. no cap, that's the whole rule.
π rpcb_set()
an interface to the rpcbind service that establishes a mapping between the triple [prognum, versnum, netconf->nc_netid] and svcaddr on the machine's rpcbind service. the value of nc_netid must correspond to a network identifier that is defined by the netconfig database β like, it has to be a real one, don't make one up.
this routine returns TRUE if it succeeds, FALSE otherwise. (see also svc_reg() in rpc_svc_calls(3).) and heads up: if there already exists such an entry with rpcbind, rpcb_set() will fail. no duplicates, we don't do that here. π
πΈ rpcb_unset()
an interface to the rpcbind service that destroys the mapping between the triple [prognum, versnum, netconf->nc_netid] and the address on the machine's rpcbind service. if netconf is NULL, rpcb_unset() destroys all mapping between the triple [prognum, versnum, all-transports] and the addresses on the machine's rpcbind service. that's the nuclear option, ok? π
this routine returns TRUE if it succeeds, FALSE otherwise. only the owner of the service or the super-user can destroy the mapping β so like, permissions check, bestie. (see also svc_unreg() in rpc_svc_calls(3).)
π«Ά SEE ALSO π«Ά
rpc_clnt_calls(3), rpc_svc_calls(3), rpcbind(8), rpcinfo(8)
go read those too, iykyk π
okay that's the whole page, you ate that πβ¨ β this cutie was brought to you by Debian, dated May 7, 1993 (yes, she's vintage, she's iconic, she's older than all of us and still slaying). mwah π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright 1989 AT&T
- Copyright (c) 1988 Sun Microsystem's, Inc. - All Right's Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms