Low-level bindings for the libntirpc library.
Some documentation for the libary can be found in the Linux man pages rpc(3) and xdr(3). However, the doc has some inconsistency with the library, so we should use the doc as a reference not as a definitive guide.
Its implementation is adapted from the libtirpc-sys library.
The build script clones and compiles libntirpc from source, which requires the following tools and libraries:
| Dependency | Package (Ubuntu) | Purpose |
|---|---|---|
| cmake | cmake |
configure and build libntirpc |
| make | make |
build libntirpc |
| git | git |
clone libntirpc (with submodules) |
| clang | clang |
provide the headers used by bindgen to generate bindings |
| liburcu | liburcu-dev |
userspace RCU library used by libntirpc |
| libkrb5 | libkrb5-dev |
RPCSEC_GSS support, required by libntirpc (GSS is on by default) |
Install them on Ubuntu with:
sudo apt install cmake make git clang liburcu-dev libkrb5-devThe examples directory contains a small "hello world" RPC
client-server pair built directly on the raw bindings. They need the
rpcbind daemon, which is used to register the server's program number and
for the client to look it up:
sudo apt install rpcbindMake sure it is running (restart it if the server fails to register):
sudo systemctl restart rpcbindRun the server in one terminal:
cargo run --example hello_serverIt should print hello server: prog=0x30000001 vers=1 on udp and register
with rpcbind (check with rpcinfo -p). Then, in another terminal, call it:
cargo run --example hello_client -- Alice 127.0.0.1which prints Hello, Alice!. Both arguments are optional (name defaults to
world, host to 127.0.0.1).