xdrpp
RFC4506 XDR compiler and message library
rpcbind.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 //! \file rpcbind.h Support for registering and (upon exit)
4 //! unregistering with rpcbind.
5 
6 #ifndef _XDRPP_RPCBIND_H_HEADER_INCLUDED_
7 #define _XDRPP_RPCBIND_H_HEADER_INCLUDED_ 1
8 
9 #include <xdrpp/socket.h>
10 
11 namespace xdr {
12 
13 //! Create a TCP connection to an RPC server on \c host, first
14 //! querying \c rpcbind on \c host to determine the port.
15 unique_sock tcp_connect_rpc(const char *host,
16  std::uint32_t prog, std::uint32_t vers,
17  int family = AF_UNSPEC);
18 
19 //! Register a service listening on \c sa with \c rpcbind.
20 void rpcbind_register(const sockaddr *sa, socklen_t salen,
21  std::uint32_t prog, std::uint32_t vers);
22 void rpcbind_register(sock_t s, std::uint32_t prog, std::uint32_t vers);
23 
24 //! Extract the port number from an RFC1833 / RFC5665 universal
25 //! network address (uaddr).
26 int parse_uaddr_port(const std::string &uaddr);
27 
28 //! Create a uaddr for a local address or file descriptor.
29 std::string make_uaddr(const sockaddr *sa, socklen_t salen);
30 std::string make_uaddr(sock_t s);
31 
32 }
33 
34 #endif // !_XDRPP_RPCBIND_H_HEADER_INCLUDED_
Most of the xdrpp library is encapsulated in the xdr namespace.
Definition: arpc.cc:4
int parse_uaddr_port(const string &uaddr)
Extract the port number from an RFC1833 / RFC5665 universal network address (uaddr).
Definition: rpcbind.cc:78
string make_uaddr(const sockaddr *sa, socklen_t salen)
Create a uaddr for a local address or file descriptor.
Definition: rpcbind.cc:103
void rpcbind_register(const sockaddr *sa, socklen_t salen, std::uint32_t prog, std::uint32_t vers)
Register a service listening on sa with rpcbind.
Definition: rpcbind.cc:130
Simplified support for creating sockets.
unique_sock tcp_connect_rpc(const char *host, std::uint32_t prog, std::uint32_t vers, int family)
Create a TCP connection to an RPC server on host, first querying rpcbind on host to determine the por...
Definition: rpcbind.cc:38