ifiter_ioctl.c File Reference

Obtain the list of network interfaces using the SIOCGLIFCONF ioctl. See netintro(4). More...

Go to the source code of this file.

Data Structures

struct  isc_interfaceiter
 Iterator structure. More...

Defines

#define IFITER_MAGIC   ISC_MAGIC('I', 'F', 'I', 'T')
#define VALID_IFITER(t)   ISC_MAGIC_VALID(t, IFITER_MAGIC)
#define IFCONF_BUFSIZE_INITIAL   4096
 Size of buffer for SIOCGLIFCONF, in bytes. We assume no sane system will have more than a megabyte of interface configuration data.
#define IFCONF_BUFSIZE_MAX   1048576

Functions

static isc_result_t getbuf4 (isc_interfaceiter_t *iter)
isc_result_t isc_interfaceiter_create (isc_mem_t *mctx, isc_interfaceiter_t **iterp)
 Create an iterator for traversing the operating system's list of network interfaces.
static isc_result_t internal_current4 (isc_interfaceiter_t *iter)
static isc_result_t internal_current (isc_interfaceiter_t *iter)
static isc_result_t internal_next4 (isc_interfaceiter_t *iter)
static isc_result_t internal_next (isc_interfaceiter_t *iter)
static void internal_destroy (isc_interfaceiter_t *iter)
static void internal_first (isc_interfaceiter_t *iter)


Detailed Description

Obtain the list of network interfaces using the SIOCGLIFCONF ioctl. See netintro(4).

Definition in file ifiter_ioctl.c.


Define Documentation

#define IFITER_MAGIC   ISC_MAGIC('I', 'F', 'I', 'T')

Definition at line 50 of file ifiter_ioctl.c.

#define VALID_IFITER (  )     ISC_MAGIC_VALID(t, IFITER_MAGIC)

Definition at line 51 of file ifiter_ioctl.c.

#define IFCONF_BUFSIZE_INITIAL   4096

Size of buffer for SIOCGLIFCONF, in bytes. We assume no sane system will have more than a megabyte of interface configuration data.

Definition at line 97 of file ifiter_ioctl.c.

Referenced by getbuf4().

#define IFCONF_BUFSIZE_MAX   1048576

Definition at line 98 of file ifiter_ioctl.c.

Referenced by getbuf4().


Function Documentation

static isc_result_t getbuf4 ( isc_interfaceiter_t iter  )  [static]

Definition at line 111 of file ifiter_ioctl.c.

References isc_interfaceiter::buf, isc_interfaceiter::bufsize, isc_interfaceiter::ifc, IFCONF_BUFSIZE_INITIAL, IFCONF_BUFSIZE_MAX, isc__strerror(), isc_mem_get, isc_mem_put, ISC_MSG_BUFFERMAX, ISC_MSG_GETIFCONFIG, isc_msgcat_get(), ISC_MSGSET_IFITERIOCTL, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_R_UNEXPECTED, ISC_STRERRORSIZE, isc_interfaceiter::mctx, isc_interfaceiter::socket, and UNEXPECTED_ERROR.

Referenced by isc_interfaceiter_create().

isc_result_t isc_interfaceiter_create ( isc_mem_t mctx,
isc_interfaceiter_t **  iterp 
)

Create an iterator for traversing the operating system's list of network interfaces.

Returns:

Definition at line 289 of file ifiter_ioctl.c.

References AF_INET6, isc_interfaceiter::buf, isc_interfaceiter::bufsize, getbuf4(), IFITER_MAGIC, isc__strerror(), ISC_FALSE, isc_mem_get, isc_mem_put, ISC_MSG_MAKESCANSOCKET, isc_msgcat_get(), ISC_MSGSET_IFITERIOCTL, isc_net_probeipv6(), ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_NOMORE, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, ISC_R_UNEXPECTED, ISC_STRERRORSIZE, ISC_TRUE, isc_interfaceiter::magic, isc_interfaceiter::mctx, isc_interfaceiter::mode, isc_interfaceiter::pos, REQUIRE, isc_interfaceiter::result, isc_interfaceiter::socket, and UNEXPECTED_ERROR.

static isc_result_t internal_current4 ( isc_interfaceiter_t iter  )  [static]

Definition at line 429 of file ifiter_ioctl.c.

References isc_interface::address, isc_interface::af, AF_INET6, isc_interfaceiter::current, isc_interface::dstaddress, isc_netaddr::family, isc_interface::flags, get_addr(), isc_interfaceiter::ifc, isc_netaddr::in, isc_netaddr::in6, in6addr_any, INSIST, INTERFACE_F_LOOPBACK, INTERFACE_F_POINTTOPOINT, INTERFACE_F_UP, isc__strerror(), isc_lctx, ISC_LOG_INFO, isc_log_write(), ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_INTERFACE, ISC_MSG_GETDESTADDR, ISC_MSG_GETIFCONFIG, ISC_MSG_GETNETMASK, isc_msgcat_get(), ISC_MSGSET_IFITERIOCTL, isc_netaddr_format(), ISC_R_IGNORE, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_STRERRORSIZE, isc_interface::name, isc_interface::netmask, isc_interfaceiter::pos, REQUIRE, isc_interfaceiter::socket, isc_netaddr::type, UNEXPECTED_ERROR, and VALID_IFITER.

Referenced by internal_current().

static isc_result_t internal_current ( isc_interfaceiter_t iter  )  [static]

Definition at line 788 of file ifiter_ioctl.c.

References internal_current4(), ISC_R_NOMORE, and isc_interfaceiter::mode.

static isc_result_t internal_next4 ( isc_interfaceiter_t iter  )  [static]

Definition at line 811 of file ifiter_ioctl.c.

References isc_interfaceiter::ifc, INSIST, ISC_R_NOMORE, ISC_R_SUCCESS, and isc_interfaceiter::pos.

Referenced by internal_next().

static isc_result_t internal_next ( isc_interfaceiter_t iter  )  [static]

Definition at line 867 of file ifiter_ioctl.c.

References internal_next4(), ISC_FALSE, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_TRUE, and isc_interfaceiter::mode.

static void internal_destroy ( isc_interfaceiter_t iter  )  [static]

Definition at line 895 of file ifiter_ioctl.c.

References isc_mem_put, isc_interfaceiter::mctx, and isc_interfaceiter::socket.

static void internal_first ( isc_interfaceiter_t iter  )  [static]

Definition at line 911 of file ifiter_ioctl.c.

References ISC_R_NOMORE, ISC_R_SUCCESS, ISC_TF, ISC_TRUE, and isc_interfaceiter::pos.


Generated on Tue Apr 28 17:41:19 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha