interfaceiter.c File Reference

#include <config.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <isc/interfaceiter.h>
#include <isc/log.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/msgs.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/strerror.h>
#include <isc/string.h>
#include <isc/types.h>
#include <isc/util.h>
#include <net/if.h>
#include "ifiter_ioctl.c"

Go to the source code of this file.

Functions

static void get_addr (unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, char *ifname)
 Extract the network address part from a "struct sockaddr".
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_first (isc_interfaceiter_t *iter)
 Position the iterator on the first interface.
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

Definition in file interfaceiter.c.


Function Documentation

static void get_addr ( unsigned int  family,
isc_netaddr_t dst,
struct sockaddr *  src,
char *  ifname 
) [static]

Extract the network address part from a "struct sockaddr".

The address family is given explicitly instead of using src->sa_family, because the latter does not work for copying a network mask obtained by SIOCGIFNETMASK (it does not have a valid address family).

Definition at line 66 of file interfaceiter.c.

References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, IN6_IS_ADDR_LINKLOCAL, INSIST, isc_netaddr_setzone(), sockaddr_in6::sin6_addr, sockaddr_in6::sin6_scope_id, isc_netaddr::type, UNUSED, and zone.

Referenced by internal_current(), and internal_current4().

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_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_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:19 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha