ipsec initaddr - initialize an ip_address
ipsec addrtypeof - get address type of an ip_address
ipsec addrlenof - get length of address within an ip_address
ipsec addrbytesof - get copy of address within an ip_address
ipsec addrbytesptr - get pointer to address within an ip_address
const char *initaddr(const char *src, size_t srclen,
int af, ip_address *dst);
int addrtypeof(const ip_address *src);
size_t addrlenof(const ip_address *src);
size_t addrbytesof(const ip_address *src,
unsigned char *dst, size_t dstlen);
size_t addrbytesptr(const ip_address *src,
const unsigned char **dst);
Initaddr initializes a variable *dst of type ip_address from an address (in network byte order, indicated by a pointer src and a length srclen) and an address family af (typically AF_INET or AF_INET6). The length must be consistent with the address family.
Addrtypeof returns the address type of an address, normally AF_INET or AF_INET6. (The <freeswan.h> header file arranges to include the necessary headers for these names to be known.)
Addrlenof returns the size (in bytes) of the address within an ip_address, to permit storage allocation etc.
Addrbytesof copies the address within the ip_address src to the buffer indicated by the pointer dst and the length dstlen, and returns the address length (in bytes). If the address will not fit, as many bytes as will fit are copied; the returned length is still the full length. It is the caller's responsibility to check the returned value to ensure that there was enough room.
Addrbytesptr sets *dst to a pointer to the internal address within the ip_address, and returns the address length (in bytes). If dst is NULL, it just returns the address length. The pointer points to const to discourage misuse.
Initaddr returns NULL for success and a pointer to a string-literal error message for failure; see DIAGNOSTICS.
The functions which return size_t return 0 for a failure.
Закладки на сайте
Проследить за страницей
Created 1996-2019 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру