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