1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
.TH IPSEC_PORTOF 3 "8 Sept 2000"
.\" RCSID $Id: portof.3,v 1.4 2004/04/09 18:00:40 mcr 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 <freeswan.h>"
.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 <freeswan.h>
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.
|