OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / lib / portof.3
1 .TH IPSEC_PORTOF 3 "8 Sept 2000"
2 .\" RCSID $Id: portof.3,v 1.2 2000/09/08 18:09:09 henry Exp $
3 .SH NAME
4 ipsec portof \- get port field of an ip_address
5 .br
6 ipsec setportof \- set port field of an ip_address
7 .br
8 ipsec sockaddrof \- get pointer to internal sockaddr of an ip_address
9 .br
10 ipsec sockaddrlenof \- get length of internal sockaddr of an ip_address
11 .SH SYNOPSIS
12 .B "#include <freeswan.h>"
13 .sp
14 .B "int portof(const ip_address *src);"
15 .br
16 .B "void setportof(int port, ip_address *dst);"
17 .br
18 .B "struct sockaddr *sockaddrof(ip_address *src);"
19 .br
20 .B "size_t sockaddrlenof(const ip_address *src);"
21 .SH DESCRIPTION
22 The
23 .B <freeswan.h>
24 internal type
25 .I ip_address
26 contains one of the
27 .I sockaddr
28 types internally.
29 \fIReliance on this feature is discouraged\fR,
30 but it may occasionally be necessary.
31 These functions provide low-level tools for this purpose.
32 .PP
33 .I Portof
34 and
35 .I setportof
36 respectively read and write the port-number field of the internal
37 .IR sockaddr .
38 The values are in network byte order.
39 .PP
40 .I Sockaddrof
41 returns a pointer to the internal
42 .IR sockaddr ,
43 for passing to other functions.
44 .PP
45 .I Sockaddrlenof
46 reports the size of the internal
47 .IR sockaddr ,
48 for use in storage allocation.
49 .SH SEE ALSO
50 inet(3), ipsec_initaddr(3)
51 .SH DIAGNOSTICS
52 .I Portof
53 returns
54 .BR \-1 ,
55 .I sockaddrof
56 returns
57 .BR NULL ,
58 and
59 .I sockaddrlenof
60 returns
61 .B 0
62 if an unknown address family is found within the
63 .IR ip_address .
64 .SH HISTORY
65 Written for the FreeS/WAN project by Henry Spencer.
66 .SH BUGS
67 These functions all depend on low-level details of the
68 .I ip_address
69 type, which are in principle subject to change.
70 Avoid using them unless really necessary.