#include "config.h"
#include "sofia-sip/su.h"
#include "sofia-sip/su_localinfo.h"
#include "su_module_debug.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stddef.h>
#include <sys/types.h>
Include dependency graph for su_localinfo.c:
Functions | |
int | su_getlocalinfo (su_localinfo_t const *hints, su_localinfo_t **return_localinfo) |
Request local address information. | |
void | su_freelocalinfo (su_localinfo_t *tbf) |
Free local address information. | |
char const * | su_gli_strerror (int error) |
Describe su_localinfo errors. | |
su_localinfo_t * | su_copylocalinfo (su_localinfo_t const *li0) |
Copy a localinfo structure. | |
int | su_sockaddr_scope (su_sockaddr_t const *su, socklen_t sulen) |
Return the scope of address in the sockaddr structure. | |
int | su_getlocalip (su_sockaddr_t *sa) |
Return local IP address. |
int su_getlocalinfo | ( | su_localinfo_t const * | hints, | |
su_localinfo_t ** | return_localinfo | |||
) |
Request local address information.
The function su_getlocalinfo() gathers the network interfaces and the addresses corresponding to them, checks if they match to the search criteria specifed by hints and returns a list of matching local address information in the res. The local address information may include IPv4/IPv6 addresses, interface name, interface index, address scope, and domain names corresponding to the local addresses.
hints | specifies selection criteria | |
return_localinfo | return list of local addresses |
LI_V4MAPPED:
when returning IPv4 addresses, map them as IPv6 addresses. If this flag is specified, IPv4 addresses are returned even if hints->li_family is set to AF_INET6
.LI_CANONNAME:
return the domain name (DNS PTR) corresponding to the local address in li_canonname.LI_NAMEREQD:
Do not return addresses not in DNS.LI_NUMERIC:
instead of domain name, return the text presentation of the addresss in li_canonname.LI_IFNAME:
return the interface name in li_ifname.
su_if_names()
.
su_if_names()
.
LI_SCOPE_GLOBAL
| LI_SCOPE_SITE
, both the global and site-local addresses are returned.
int su_getlocalip | ( | su_sockaddr_t * | sa | ) |
char const* su_gli_strerror | ( | int | error | ) |
Describe su_localinfo errors.
The function su_gli_strerror() returns a string describing the error condition indicated by the code that was returned by the function su_getlocalinfo().
error | error code returned by su_getlocalinfo() |