libpcp — port-control-protocol client library
#include <pcp.h>
int pcp_init( |
struct sockaddr *server, |
struct sockaddr *source, | |
pcp_t *pcp) ; |
int pcp_close( |
pcp_t *pcp) ; |
int pcp_getsocket( |
pcp_t *pcp, |
int *sock) ; |
int pcp_gettries( |
pcp_t *pcp, |
int *tries) ; |
int pcp_gettimeout( |
pcp_t *pcp, |
struct timeval *timeout, | |
int relative) ; |
int pcp_setreset( |
pcp_t *pcp, |
int reset, | |
int *old) ; |
int pcp_third_party4( |
pcp_option_t ***options, |
uint32_t *addr) ; |
int pcp_third_party6( |
pcp_option_t ***options, |
uint8_t *addr) ; |
int pcp_prefer_failure( |
pcp_option_t ***options) ; |
int pcp_filter4( |
pcp_option_t ***options, |
uint32_taddr, | |
uint16_tport) ; |
int pcp_filter6( |
pcp_option_t ***options, |
uint8_t *addr, | |
uint16_tport) ; |
int pcp_makerequest( |
pcp_t *pcp, |
pcp_request_t *request, | |
pcp_option_t **options) ; |
int pcp_sendrequest( |
pcp_t *pcp) ; |
int pcp_recvresponse( |
pcp_t *pcp, |
pcp_response_t *response) ; |
const char *pcp_strerror( |
int error) ; |
int pcp_fillintaddr( |
pcp_t *pcp, |
pcp_request_t *request) ; |
int pcp_getmapping( |
pcp_t *pcp, |
pcp_request_t *request, | |
pcp_response_t *response, | |
pcp_option_t **options) ; |
int pcp_renewmapping( |
pcp_t *pcp, |
pcp_response_t *response) ; |
int pcp_delmapping( |
pcp_t *pcp, |
pcp_response_t *response) ; |
void pcp_freeoptions( |
pcp_options_t **options) ; |
pcp_init
initializes a PCP handler (source
may be NULL).
pcp_close
closes a PCP handler.
pcp_getsocket
gets the socket file descriptor.
pcp_gettries
gets the number of tries.
pcp_gettimeout
gets the relative or absolute
timeout for the next retry.
pcp_setreset
sets the reset flag: when set to
one, transient protocol errors are translated to restart of
the whole procedure after a timeout.
pcp_third_party4
stacks a
THIRD_PARTY IPv4 option.
pcp_third_party6
stacks a
THIRD_PARTY IPv6 option.
pcp_prefer_failure
stacks a
PREFER_FAILURE option.
pcp_filter4
stacks a FILTER IPv4 option.
pcp_filter6
stacks a FILTER IPv6 option.
pcp_makerequest
clears/creates a request.
The options
is the NULL pointer or a NULL
terminated table of pointers to options.
pcp_sendrequest
sends/resends the current request.
pcp_recvresponse
receives the response to
the current request.
pcp_strerror
translates an error to its
human friendly description.
pcp_fillintaddr
fills the intaddr field
in the given request from getsockname().
pcp_getmapping
gets a mapping.
pcp_renewmapping
renews a mapping.
pcp_delmapping
deletes a mapping.
pcp_freeoptions
free allocated options.
OK
try again
invalid arguments
malloc() failed
socket() syscall failed
bind() syscall failed
connect() syscall failed
send() syscall failed
recv() syscall failed
miscellaneous syscall failed
no current request
received a bad response
too many options
mapping() function internal failure
user application error 0
user application error 1
user application error 2
base for protocol errors
unsupported version
malformed request
unsupported opcode
unsupported option
malformed option
processing error
overloaded server
network failure
out of resources
unsupported protocol
not authorized
user exceeded quota
cannot provide external port
excessive number of remote peers
unauthorized third party
collides with implicit mapping