pub struct PortmapperClient<IO> { /* private fields */ }Expand description
Client for the portmapper service
Implementations§
Source§impl<IO> PortmapperClient<IO>
impl<IO> PortmapperClient<IO>
Sourcepub fn new(io: IO) -> Self
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.
Sourcepub async fn null(&mut self) -> Result<(), RpcError>
pub async fn null(&mut self) -> Result<(), RpcError>
PMAPPROC_NULL (proc 0, RFC 1057 appendix A): no-op connectivity check.
Sourcepub async fn set(
&mut self,
prog: u32,
vers: u32,
prot: u32,
port: u32,
) -> Result<bool, RpcError>
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.
Sourcepub async fn unset(
&mut self,
prog: u32,
vers: u32,
prot: u32,
port: u32,
) -> Result<bool, RpcError>
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.
Sourcepub async fn getport(
&mut self,
prog: u32,
vers: u32,
prot: u32,
) -> Result<u16, PortmapError>
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.
Sourcepub async fn dump(&mut self) -> Result<Vec<mapping>, RpcError>
pub async fn dump(&mut self) -> Result<Vec<mapping>, RpcError>
PMAPPROC_DUMP (proc 4, RFC 1057 appendix A): retrieve all registered mappings.
Sourcepub async fn callit(
&mut self,
prog: u32,
vers: u32,
proc: u32,
args: &[u8],
) -> Result<call_result<'static>, RpcError>
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.