1IPSEC_PORTOF(3) Library Functions Manual IPSEC_PORTOF(3)
2
3
4
6 ipsec portof - get port field of an ip_address
7 ipsec setportof - set port field of an ip_address
8 ipsec sockaddrof - get pointer to internal sockaddr of an ip_address
9 ipsec sockaddrlenof - get length of internal sockaddr of an ip_address
10
12 #include <freeswan.h>
13
14 int portof(const ip_address *src);
15 void setportof(int port, ip_address *dst);
16 struct sockaddr *sockaddrof(ip_address *src);
17 size_t sockaddrlenof(const ip_address *src);
18
20 The <freeswan.h> internal type ip_address contains one of the sockaddr
21 types internally. Reliance on this feature is discouraged, but it may
22 occasionally be necessary. These functions provide low-level tools for
23 this purpose.
24
25 Portof and setportof respectively read and write the port-number field
26 of the internal sockaddr. The values are in network byte order.
27
28 Sockaddrof returns a pointer to the internal sockaddr, for passing to
29 other functions.
30
31 Sockaddrlenof reports the size of the internal sockaddr, for use in
32 storage allocation.
33
35 inet(3), ipsec_initaddr(3)
36
38 Portof returns -1, sockaddrof returns NULL, and sockaddrlenof returns 0
39 if an unknown address family is found within the ip_address.
40
42 Written for the FreeS/WAN project by Henry Spencer.
43
45 These functions all depend on low-level details of the ip_address type,
46 which are in principle subject to change. Avoid using them unless
47 really necessary.
48
49
50
51 8 Sept 2000 IPSEC_PORTOF(3)