.TH IPSEC_PORTOF 3 "8 Sept 2000" .\" RCSID $Id: portof.3,v 1.2 2000/09/08 18:09:09 henry Exp $ .SH NAME ipsec portof \- get port field of an ip_address .br ipsec setportof \- set port field of an ip_address .br ipsec sockaddrof \- get pointer to internal sockaddr of an ip_address .br ipsec sockaddrlenof \- get length of internal sockaddr of an ip_address .SH SYNOPSIS .B "#include " .sp .B "int portof(const ip_address *src);" .br .B "void setportof(int port, ip_address *dst);" .br .B "struct sockaddr *sockaddrof(ip_address *src);" .br .B "size_t sockaddrlenof(const ip_address *src);" .SH DESCRIPTION The .B internal type .I ip_address contains one of the .I sockaddr types internally. \fIReliance on this feature is discouraged\fR, but it may occasionally be necessary. These functions provide low-level tools for this purpose. .PP .I Portof and .I setportof respectively read and write the port-number field of the internal .IR sockaddr . The values are in network byte order. .PP .I Sockaddrof returns a pointer to the internal .IR sockaddr , for passing to other functions. .PP .I Sockaddrlenof reports the size of the internal .IR sockaddr , for use in storage allocation. .SH SEE ALSO inet(3), ipsec_initaddr(3) .SH DIAGNOSTICS .I Portof returns .BR \-1 , .I sockaddrof returns .BR NULL , and .I sockaddrlenof returns .B 0 if an unknown address family is found within the .IR ip_address . .SH HISTORY Written for the FreeS/WAN project by Henry Spencer. .SH BUGS These functions all depend on low-level details of the .I ip_address type, which are in principle subject to change. Avoid using them unless really necessary.