interfaceiter.h File Reference

Iterates over the list of network interfaces. More...

#include <isc/lang.h>
#include <isc/netaddr.h>
#include <isc/types.h>

Go to the source code of this file.

Data Structures

struct  isc_interface
 Public structure describing a network interface. More...

Defines

#define ISC_INTERFACEITER_H   1
#define INTERFACE_F_UP   0x00000001U
#define INTERFACE_F_POINTTOPOINT   0x00000002U
#define INTERFACE_F_LOOPBACK   0x00000004U

Functions

ISC_LANG_BEGINDECLS 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.
isc_result_t isc_interfaceiter_first (isc_interfaceiter_t *iter)
 Position the iterator on the first interface.
isc_result_t isc_interfaceiter_current (isc_interfaceiter_t *iter, isc_interface_t *ifdata)
 Get information about the interface the iterator is currently positioned at and store it at *ifdata.
isc_result_t isc_interfaceiter_next (isc_interfaceiter_t *iter)
 Position the iterator on the next interface.
void isc_interfaceiter_destroy (isc_interfaceiter_t **iterp)
 Destroy the iterator.


Detailed Description

Iterates over the list of network interfaces.

Interfaces whose address family is not supported are ignored and never returned by the iterator. Interfaces whose netmask, interface flags, or similar cannot be obtained are also ignored, and the failure is logged.

Standards: The API for scanning varies greatly among operating systems. This module attempts to hide the differences.

Definition in file interfaceiter.h.


Define Documentation

#define ISC_INTERFACEITER_H   1

Definition at line 21 of file interfaceiter.h.

#define INTERFACE_F_UP   0x00000001U

Interface flags.

Definition at line 63 of file interfaceiter.h.

Referenced by internal_current(), and internal_current4().

#define INTERFACE_F_POINTTOPOINT   0x00000002U

Interface flags.

Definition at line 64 of file interfaceiter.h.

Referenced by internal_current(), and internal_current4().

#define INTERFACE_F_LOOPBACK   0x00000004U

Interface flags.

Definition at line 65 of file interfaceiter.h.

Referenced by internal_current(), and internal_current4().


Function Documentation

ISC_LANG_BEGINDECLS 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 54 of file ifiter_getifaddrs.c.

References AF_INET6, isc_interfaceiter::buf, isc_interfaceiter::bufsize, isc_interfaceiter::bufused, getbuf4(), isc_interfaceiter::ifaddrs, IFITER_MAGIC, INSIST, isc__strerror(), ISC_FALSE, isc_mem_get, isc_mem_put, ISC_MSG_GETIFADDRS, ISC_MSG_GETIFLIST, ISC_MSG_GETIFLISTSIZE, ISC_MSG_MAKESCANSOCKET, isc_msgcat_get(), ISC_MSGSET_IFITERGETIFADDRS, ISC_MSGSET_IFITERIOCTL, ISC_MSGSET_IFITERSYSCTL, 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, mib, isc_interfaceiter::mode, isc_interfaceiter::pos, REQUIRE, isc_interfaceiter::result, isc_interfaceiter::socket, and UNEXPECTED_ERROR.

Referenced by do_scan().

isc_result_t isc_interfaceiter_first ( isc_interfaceiter_t iter  ) 

Position the iterator on the first interface.

Returns:

Definition at line 260 of file interfaceiter.c.

References internal_current(), internal_first(), internal_next(), ISC_R_IGNORE, ISC_R_SUCCESS, REQUIRE, isc_interfaceiter::result, and VALID_IFITER.

Referenced by do_scan().

isc_result_t isc_interfaceiter_current ( isc_interfaceiter_t iter,
isc_interface_t ifdata 
)

Get information about the interface the iterator is currently positioned at and store it at *ifdata.

Requires:

Returns:

Definition at line 251 of file interfaceiter.c.

References isc_interfaceiter::current, ISC_R_SUCCESS, REQUIRE, and isc_interfaceiter::result.

Referenced by do_scan().

isc_result_t isc_interfaceiter_next ( isc_interfaceiter_t iter  ) 

Position the iterator on the next interface.

Requires:

Returns:

Definition at line 279 of file interfaceiter.c.

References internal_current(), internal_next(), ISC_R_IGNORE, ISC_R_SUCCESS, REQUIRE, isc_interfaceiter::result, and VALID_IFITER.

Referenced by do_scan().

void isc_interfaceiter_destroy ( isc_interfaceiter_t **  iterp  ) 

Destroy the iterator.

Definition at line 298 of file interfaceiter.c.

References isc_interfaceiter::buf, isc_interfaceiter::bufsize, internal_destroy(), isc_mem_put, isc_interfaceiter::magic, isc_interfaceiter::mctx, REQUIRE, and VALID_IFITER.

Referenced by do_scan().


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