Skip to main content

RpcbindClient

Struct RpcbindClient 

Source
pub struct RpcbindClient<IO> { /* private fields */ }
Expand description

Client for rpcbind v3/v4 procedures (RFC 1833).

Provides gettime() (version 3) and getstat() (version 4) over a single TCP connection. Accepts AUTH_NONE, matching the portmapper convention.

Implementations§

Source§

impl<IO> RpcbindClient<IO>
where IO: AsyncRead + AsyncWrite + Send,

Source

pub fn new(io: IO) -> Self

Create a new rpcbind client.

The rpcbind service accepts AUTH_NONE for query procedures, so no credential is set up here.

Source

pub async fn set( &mut self, program: u32, version: u32, netid: &str, addr: &str, owner: &str, ) -> Result<bool, RpcError>

RPCBPROC_SET (proc 1, version 3): register a binding.

Source

pub async fn unset( &mut self, program: u32, version: u32, netid: &str, addr: &str, owner: &str, ) -> Result<bool, RpcError>

RPCBPROC_UNSET (proc 2, version 3): unregister a binding.

Source

pub async fn getaddr( &mut self, program: u32, version: u32, netid: &str, ) -> Result<String, RpcError>

RPCBPROC_GETADDR (proc 3, version 3): looks up the universal address for a given program, version, and network id.

Source

pub async fn dump(&mut self) -> Result<Vec<RpcbEntry>, RpcError>

RPCBPROC_DUMP (proc 4, version 3): list all registered bindings.

Source

pub async fn callit( &mut self, program: u32, version: u32, proc: u32, args: &[u8], ) -> Result<RpcbRmtCallRes, RpcError>

RPCBPROC_CALLIT (proc 5, version 3): indirect call through rpcbind.

Source

pub async fn gettime(&mut self) -> Result<u32, RpcError>

RPCBPROC_GETTIME (proc 6, version 3): returns the server’s local time as seconds since the Unix epoch.

Source

pub async fn uaddr2taddr(&mut self, uaddr: &str) -> Result<Netbuf, RpcError>

RPCBPROC_UADDR2TADDR (proc 7, version 3): convert a universal address to a transport-specific address.

Source

pub async fn taddr2uaddr(&mut self, taddr: &Netbuf) -> Result<String, RpcError>

RPCBPROC_TADDR2UADDR (proc 8, version 3): convert a transport-specific address to a universal address.

Source

pub async fn bcast( &mut self, program: u32, version: u32, proc: u32, args: &[u8], ) -> Result<RpcbRmtCallRes, RpcError>

RPCBPROC_BCAST (proc 5, version 4): broadcast call through rpcbind.

Same wire format as CALLIT but sent via v4; the server broadcasts the call and returns the first response.

Source

pub async fn getversaddr( &mut self, program: u32, version: u32, netid: &str, ) -> Result<String, RpcError>

RPCBPROC_GETVERSADDR (proc 9, version 4): like GETADDR but respects r_vers strictly (RFC 1833 sec. 2.2.2).

Source

pub async fn indirect( &mut self, program: u32, version: u32, proc: u32, args: &[u8], ) -> Result<RpcbRmtCallRes, RpcError>

RPCBPROC_INDIRECT (proc 10, version 4): indirect RPC call with error reporting (RFC 1833 sec. 2.2.2).

Source

pub async fn getaddrlist( &mut self, program: u32, version: u32, netid: &str, ) -> Result<Vec<RpcbAddrEntry>, RpcError>

RPCBPROC_GETADDRLIST (proc 11, version 4): list all addresses for a service across transports (RFC 1833 sec. 2.2.2).

Source

pub async fn getstat(&mut self) -> Result<RpcbStatByvers, RpcError>

RPCBPROC_GETSTAT (proc 12, version 4): returns operational statistics per rpcbind version.

Trait Implementations§

Source§

impl<IO: Debug> Debug for RpcbindClient<IO>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<IO> Forget for RpcbindClient<IO>

§

impl<IO> Freeze for RpcbindClient<IO>
where RpcClient<IO>: Freeze,

§

impl<IO> RefUnwindSafe for RpcbindClient<IO>

§

impl<IO> Send for RpcbindClient<IO>
where RpcClient<IO>: Send,

§

impl<IO> Sync for RpcbindClient<IO>
where RpcClient<IO>: Sync,

§

impl<IO> Unpin for RpcbindClient<IO>
where RpcClient<IO>: Unpin,

§

impl<IO> UnsafeUnpin for RpcbindClient<IO>

§

impl<IO> UnwindSafe for RpcbindClient<IO>
where RpcClient<IO>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.