RPCBIND(3)
π RPCBIND(3) β bestie's guide to the RPC bind service π
Library Functions Manual Β· RPCBIND(3)
okay so. hi. you're here because you're writing C that needs to talk to the RPC binder, and honestly? iconic of you. this whole page lives in section 3 of the manual and it's all about the little squad of routines that let your client C program yell at rpcbind. buckle up bestie π
β¨ NAME β¨
rpcb_getmaps, rpcb_getaddr, rpcb_gettime, rpcb_rmtcall, rpcb_set, rpcb_unset β library routines for the RPC bind service, aka your new besties π«Ά
πΈ SYNOPSIS πΈ
like literally just include the header and you're in:
#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 π
these routines let client C programs make procedure calls to the RPC binder service. and like, rpcbind(8) (yes, go read it, i'll wait π) is out here maintaining a whole list of mappings between programs and their universal addresses. it's giving matchmaker. it's giving address book but for RPC. no cap.
π¦ 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 you specified through netconf to go contact the remote rpcbind service on host. and heads up: this one will return NULL if the remote rpcbind could not be contacted. like, ghosted. π
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 it finds gets returned in svcaddr. and btw the svcaddr argument should be preallocated β you gotta bring your own buffer, bestie, this routine is not doing it for you.
this routine returns TRUE if it succeeds. a return value of FALSE means either the mapping does not exist, or the RPC system failed to contact the remote rpcbind service. in that latter case, the global variable rpc_createerr (see rpc_clnt_create(3)) is holding the RPC status for you. so check it. π
rpcb_gettime()
this routine returns the time on host in timep. and if host is NULL? it just returns the time on its own machine. main character energy, honestly. returns TRUE if it succeeds, FALSE if it fails.
the rpcb_gettime() function can be used to synchronize the time between the client and the remote server. clock sync slay β°β¨
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 does let programs do lookup and call, all in one step, which is cute, but still β ping. that's the vibe.
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. π silence. just silence.
Note: rpcb_rmtcall() is only available for connectionless transports. periodt.
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. this routine returns TRUE if it succeeds, FALSE otherwise. (see also svc_reg() in rpc_svc_calls(3).)
and okay important: 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. yeah. all of them. wipeout.
this routine returns TRUE if it succeeds, FALSE otherwise. only the owner of the service or the super-user can destroy the mapping. (see also svc_unreg() in rpc_svc_calls(3).) so like, know your permissions before you start deleting things, bestie π
π AVAILABILITY π
these functions are part of libtirpc. π«Ά
β ENVIRONMENT β
if RPCB_V2FIRST is defined, the rpcbind protocol version tryout algorithm changes from v4,v2,v3 to v2,v4,v3.
that's it. that's the whole env var. tiny but mighty. β¨
π SEE ALSO π
Debian Β· May 7, 1993
and that's the whole page, bestie π written by the good people at Debian, dated May 7, 1993 (yes, a true vintage icon, older than most of us and still serving). go register something. go call something. go be the main character of your own RPC stack. mwah ππ¦β¨
π¦ 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 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
- Copyright 1989 AT&T
- Copyright (c) 1988 Sun Microsystem's, Inc. - All Right's Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms