Skip to main content

PortmapperClient

Struct PortmapperClient 

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

Client for the portmapper service

Implementations§

Source§

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

Source

pub fn new(io: IO) -> Self

Create a new portmapper client.

The portmapper accepts AUTH_NONE for the query procedures, so no credential is set up here.

Source

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

PMAPPROC_NULL (proc 0, RFC 1057 appendix A): no-op connectivity check.

Source

pub async fn set( &mut self, prog: u32, vers: u32, prot: u32, port: u32, ) -> Result<bool, RpcError>

PMAPPROC_SET (proc 1, RFC 1057 appendix A): register a mapping.

Source

pub async fn unset( &mut self, prog: u32, vers: u32, prot: u32, port: u32, ) -> Result<bool, RpcError>

PMAPPROC_UNSET (proc 2, RFC 1057 appendix A): unregister a mapping.

Source

pub async fn getport( &mut self, prog: u32, vers: u32, prot: u32, ) -> Result<u16, PortmapError>

PMAPPROC_GETPORT (proc 3, RFC 1057 appendix A): look up the port registered for prog with vers over transport prot.

Source

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

PMAPPROC_DUMP (proc 4, RFC 1057 appendix A): retrieve all registered mappings.

Source

pub async fn callit( &mut self, prog: u32, vers: u32, proc: u32, args: &[u8], ) -> Result<call_result<'static>, RpcError>

PMAPPROC_CALLIT (proc 5, RFC 1057 appendix A): indirect call through the portmapper.

Forwards args to (prog, vers, proc) on the local host over UDP and returns the result plus the port the program is listening on. Attack surface: UDP amplification (small request, large response with spoofed source) and relay to non-standard ports.

Trait Implementations§

Source§

impl<IO: Debug> Debug for PortmapperClient<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 PortmapperClient<IO>

§

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

§

impl<IO> RefUnwindSafe for PortmapperClient<IO>

§

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

§

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

§

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

§

impl<IO> UnsafeUnpin for PortmapperClient<IO>

§

impl<IO> UnwindSafe for PortmapperClient<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.