ipsec_sockaddrof(3)

ipsec_sockaddrof3

Get port field of an ip_address, set port field of an ip_address, get pointer to internal sockaddr of an ip_address, get length of internal sockaddr of an ip_address

Part of ipsec_portof(3).

Usage

#include <freeswan.h>

int portof(const ip_address *src);
void setportof(int port, ip_address *dst);
struct sockaddr *sockaddrof(ip_address *src);
size_t sockaddrlenof(const ip_address *src);

Overview

The <freeswan.h> internal type ip_address contains one of the sockaddr types internally. Reliance on this feature is discouraged, but it may occasionally be necessary. These functions provide low-level tools for this purpose.

Portof and setportof respectively read and write the port-number field of the internal sockaddr. The values are in network byte order.

Sockaddrof returns a pointer to the internal sockaddr, for passing to other functions.

Sockaddrlenof reports the size of the internal sockaddr, for use in storage allocation.

Diagnostics

Portof returns -1, sockaddrof returns NULL, and sockaddrlenof returns 0 if an unknown address family is found within the ip_address.

Releases

4 releases since Debian 3.1 (Sarge); the text changed 3 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 7

History

Written for the FreeS/WAN project by Henry Spencer.

Bugs

These functions all depend on low-level details of the ip_address type, which are in principle subject to change. Avoid using them unless really necessary.

From openswan 1:2.6.37-3+deb7u1 in Debian 7 (Wheezy). Parsed by carta from the page's man source.