ifiter_sysctl.c File Reference

Obtain the list of network interfaces using sysctl. See TCP/IP Illustrated Volume 2, sections 19.8, 19.14, and 19.16. More...

#include <sys/param.h>
#include <sys/sysctl.h>
#include <net/route.h>
#include <net/if_dl.h>

Go to the source code of this file.

Data Structures

struct  isc_interfaceiter
 Iterator structure. More...

Defines

#define ROUNDUP(a)
#define IFITER_MAGIC   ISC_MAGIC('I', 'F', 'I', 'S')
#define VALID_IFITER(t)   ISC_MAGIC_VALID(t, IFITER_MAGIC)

Functions

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_current (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)

Variables

static int mib [6]


Detailed Description

Obtain the list of network interfaces using sysctl. See TCP/IP Illustrated Volume 2, sections 19.8, 19.14, and 19.16.

Definition in file ifiter_sysctl.c.


Define Documentation

#define ROUNDUP (  ) 

Value:

((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \
                    : sizeof(long))

Definition at line 39 of file ifiter_sysctl.c.

Referenced by internal_current().

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

Definition at line 43 of file ifiter_sysctl.c.

#define VALID_IFITER (  )     ISC_MAGIC_VALID(t, IFITER_MAGIC)

Definition at line 44 of file ifiter_sysctl.c.


Function Documentation

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 68 of file ifiter_sysctl.c.

References isc_interfaceiter::buf, isc_interfaceiter::bufsize, isc_interfaceiter::bufused, IFITER_MAGIC, INSIST, isc__strerror(), isc_mem_get, isc_mem_put, ISC_MSG_GETIFLIST, ISC_MSG_GETIFLISTSIZE, isc_msgcat_get(), ISC_MSGSET_IFITERSYSCTL, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_R_UNEXPECTED, ISC_STRERRORSIZE, isc_interfaceiter::magic, isc_interfaceiter::mctx, mib, isc_interfaceiter::pos, REQUIRE, isc_interfaceiter::result, and UNEXPECTED_ERROR.

Referenced by do_scan().

static isc_result_t internal_current ( isc_interfaceiter_t iter  )  [static]

Definition at line 153 of file ifiter_sysctl.c.

References isc_interface::address, isc_interface::af, AF_INET6, isc_interfaceiter::buf, isc_interfaceiter::bufused, isc_interfaceiter::current, isc_interface::dstaddress, isc_interface::flags, get_addr(), INSIST, INTERFACE_F_LOOPBACK, INTERFACE_F_POINTTOPOINT, INTERFACE_F_UP, ISC_MSG_UNEXPECTEDTYPE, isc_msgcat_get(), ISC_MSGSET_IFITERSYSCTL, ISC_R_IGNORE, ISC_R_SUCCESS, isc_interface::name, isc_interface::netmask, isc_interfaceiter::pos, REQUIRE, ROUNDUP, and VALID_IFITER.

static isc_result_t internal_next ( isc_interfaceiter_t iter  )  [static]

Definition at line 278 of file ifiter_sysctl.c.

References isc_interfaceiter::buf, isc_interfaceiter::bufused, ISC_R_NOMORE, ISC_R_SUCCESS, isc_interfaceiter::pos, and REQUIRE.

static void internal_destroy ( isc_interfaceiter_t iter  )  [static]

Definition at line 293 of file ifiter_sysctl.c.

References UNUSED.

static void internal_first ( isc_interfaceiter_t iter  )  [static]

Definition at line 301 of file ifiter_sysctl.c.

References isc_interfaceiter::pos.


Variable Documentation

int mib[6] [static]

Initial value:

 {
        CTL_NET,
        PF_ROUTE,
        0,
        0,                      
        NET_RT_IFLIST,
        0                       
}

Definition at line 58 of file ifiter_sysctl.c.

Referenced by isc_interfaceiter_create().


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