Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

addr.h File Reference

Go to the source code of this file.

Defines

#define ADDR_TYPE_NONE   0
#define ADDR_TYPE_ETH   1
#define ADDR_TYPE_IP   2
#define ADDR_TYPE_IP6   3
#define addr_eth   __addr_u.__eth
#define addr_ip   __addr_u.__ip
#define addr_ip6   __addr_u.__ip6
#define addr_data8   __addr_u.__data8
#define addr_data16   __addr_u.__data16
#define addr_data32   __addr_u.__data32
#define addr_pack(addr, type, bits, data, len)
#define addr_aton   addr_pton

Functions

__BEGIN_DECLS int addr_cmp (const struct addr *a, const struct addr *b)
int addr_bcast (const struct addr *a, struct addr *b)
int addr_net (const struct addr *a, struct addr *b)
char * addr_ntop (const struct addr *src, char *dst, size_t size)
int addr_pton (const char *src, struct addr *dst)
char * addr_ntoa (const struct addr *a)
int addr_ntos (const struct addr *a, struct sockaddr *sa)
int addr_ston (const struct sockaddr *sa, struct addr *a)
int addr_btos (uint16_t bits, struct sockaddr *sa)
int addr_stob (const struct sockaddr *sa, uint16_t *bits)
int addr_btom (uint16_t bits, void *mask, size_t size)
int addr_mtob (const void *mask, size_t size, uint16_t *bits)


Define Documentation

#define addr_aton   addr_pton
 

Definition at line 55 of file addr.h.

Referenced by __pyx_f_4dnet_4addr___init__(), _intf_get_aliases(), addr_main(), arg_to_fr(), arp_main(), eth_main(), intf_main(), ip_main(), parse_addr(), route_loop(), route_main(), and START_TEST().

#define addr_data16   __addr_u.__data16
 

Definition at line 36 of file addr.h.

#define addr_data32   __addr_u.__data32
 

Definition at line 37 of file addr.h.

#define addr_data8   __addr_u.__data8
 

Definition at line 35 of file addr.h.

#define addr_eth   __addr_u.__eth
 

Definition at line 32 of file addr.h.

#define addr_ip   __addr_u.__ip
 

Definition at line 33 of file addr.h.

#define addr_ip6   __addr_u.__ip6
 

Definition at line 34 of file addr.h.

#define addr_pack addr,
type,
bits,
data,
len   ) 
 

Value:

do {    \
        (addr)->addr_type = type;                       \
        (addr)->addr_bits = bits;                       \
        memmove((addr)->addr_data8, (char *)data, len); \
} while (0)

Definition at line 39 of file addr.h.

Referenced by _intf_get_noalias(), eth_ntoa(), ip6_ntoa(), ip_ntoa(), and START_TEST().

#define ADDR_TYPE_ETH   1
 

Definition at line 15 of file addr.h.

Referenced by _add_ip_intf(), _ifrow_to_entry(), _intf_get_aliases(), _intf_get_noalias(), addr_bcast(), addr_net(), addr_ntop(), addr_ntos(), addr_pton(), addr_ston(), arp_add(), arp_loop(), eth_get(), eth_ntoa(), eth_open(), eth_set(), intf_set(), print_intf(), and START_TEST().

#define ADDR_TYPE_IP   2
 

Definition at line 16 of file addr.h.

Referenced by _add_ip_intf(), _ifrow_to_entry(), _intf_add_aliases(), _intf_delete_addrs(), _intf_get_aliases(), _match_intf_src(), addr_bcast(), addr_net(), addr_ntop(), addr_ntos(), addr_pton(), addr_ston(), arp_add(), arp_delete(), arp_get(), arp_loop(), fwc_to_fr(), intf_get_dst(), intf_get_src(), intf_set(), ip_ntoa(), ip_send(), ipf_to_rule(), ipfw_to_fr(), pr_to_fr(), print_intf(), route_add(), route_delete(), route_get(), route_loop(), route_msg(), START_TEST(), and tun_open().

#define ADDR_TYPE_IP6   3
 

Definition at line 17 of file addr.h.

Referenced by _intf_get_aliases(), addr_net(), addr_ntop(), addr_ntos(), addr_pton(), addr_ston(), ip6_ntoa(), route_get(), and START_TEST().

#define ADDR_TYPE_NONE   0
 

Definition at line 14 of file addr.h.

Referenced by _ifrow_to_entry(), _intf_get_noalias(), and format_rule().


Function Documentation

int addr_bcast const struct addr a,
struct addr b
 

Definition at line 118 of file addr.c.

References addr::addr_bits, addr_btom(), addr::addr_type, ADDR_TYPE_ETH, ADDR_TYPE_IP, errno, ETH_ADDR_BITS, ETH_ADDR_BROADCAST, ETH_ADDR_LEN, IP_ADDR_BITS, IP_ADDR_LEN, and memcpy.

Referenced by __pyx_f_4dnet_4addr___contains__(), __pyx_f_4dnet_4addr___iter__(), __pyx_f_4dnet_4addr_bcast(), _intf_add_aliases(), intf_set(), and START_TEST().

int addr_btom uint16_t  bits,
void *  mask,
size_t  size
 

Definition at line 406 of file addr.c.

References errno, IP_ADDR_BITS, IP_ADDR_LEN, and memset.

Referenced by addr_bcast(), addr_btos(), addr_net(), fr_to_fwc(), fr_to_ipfw(), fr_to_pr(), intf_set(), route_add(), route_delete(), route_get(), rule_to_ipf(), and START_TEST().

int addr_btos uint16_t  bits,
struct sockaddr *  sa
 

Definition at line 343 of file addr.c.

References addr_btom(), errno, IP6_ADDR_BITS, IP6_ADDR_LEN, IP_ADDR_BITS, IP_ADDR_LEN, memset, and sockunion::sin.

Referenced by _intf_add_aliases(), intf_set(), route_add(), route_delete(), route_msg(), and START_TEST().

__BEGIN_DECLS int addr_cmp const struct addr a,
const struct addr b
 

Definition at line 52 of file addr.c.

References addr::addr_bits, and addr::addr_type.

Referenced by __pyx_f_4dnet_4addr___cmp__(), __pyx_f_4dnet_4addr___contains__(), _arp_get_entry(), fw_cmp(), intf_set(), and START_TEST().

int addr_mtob const void *  mask,
size_t  size,
uint16_t bits
 

Definition at line 438 of file addr.c.

Referenced by _ifrow_to_entry(), addr_pton(), fwc_to_fr(), ipf_to_rule(), ipfw_to_fr(), pr_to_fr(), route_loop(), and START_TEST().

int addr_net const struct addr a,
struct addr b
 

Definition at line 81 of file addr.c.

References addr::addr_bits, addr_btom(), addr::addr_type, ADDR_TYPE_ETH, ADDR_TYPE_IP, ADDR_TYPE_IP6, ETH_ADDR_BITS, IP6_ADDR_BITS, IP6_ADDR_LEN, IP_ADDR_BITS, IP_ADDR_LEN, memcpy, and memset.

Referenced by __pyx_f_4dnet_4addr___contains__(), __pyx_f_4dnet_4addr___iter__(), __pyx_f_4dnet_4addr_net(), route_add(), route_delete(), route_msg(), and START_TEST().

char* addr_ntoa const struct addr a  ) 
 

Definition at line 225 of file addr.c.

References addr_ntop(), and NULL.

Referenced by __pyx_f_4dnet_3arp_get(), __pyx_f_4dnet_4addr___repr__(), __pyx_f_4dnet_5route_get(), __pyx_f_4dnet_ifent_to_dict(), __pyx_f_4dnet_rule_to_dict(), arp_kern_main(), eth_ntoa(), format_rule(), ip6_ntoa(), ip_ntoa(), print_arp(), print_intf(), print_route(), print_rule(), route_main(), START_TEST(), and tun_open().

char* addr_ntop const struct addr src,
char *  dst,
size_t  size
 

Definition at line 141 of file addr.c.

References addr::addr_bits, addr::addr_type, ADDR_TYPE_ETH, ADDR_TYPE_IP, ADDR_TYPE_IP6, errno, ETH_ADDR_BITS, eth_ntop(), IP6_ADDR_BITS, ip6_ntop(), IP_ADDR_BITS, ip_ntop(), and NULL.

Referenced by addr_ntoa(), and START_TEST().

int addr_ntos const struct addr a,
struct sockaddr *  sa
 

Definition at line 241 of file addr.c.

References ADDR_TYPE_ETH, ADDR_TYPE_IP, ADDR_TYPE_IP6, errno, ETH_ADDR_LEN, IP6_ADDR_LEN, memcpy, memset, and sockunion::sin.

Referenced by _intf_add_aliases(), _intf_delete_addrs(), _intf_delete_aliases(), arp_add(), arp_delete(), arp_get(), eth_set(), intf_get_dst(), intf_set(), route_add(), route_delete(), route_msg(), and START_TEST().

int addr_pton const char *  src,
struct addr dst
 

Definition at line 166 of file addr.c.

References addr::addr_bits, addr_mtob(), addr::addr_type, ADDR_TYPE_ETH, ADDR_TYPE_IP, ADDR_TYPE_IP6, errno, ETH_ADDR_BITS, eth_pton(), IP6_ADDR_BITS, ip6_pton(), IP_ADDR_BITS, IP_ADDR_LEN, ip_pton(), memcpy, NULL, and strtol().

Referenced by arp_kern_main(), intf_main(), and START_TEST().

int addr_stob const struct sockaddr *  sa,
uint16_t bits
 

Definition at line 370 of file addr.c.

References IP6_ADDR_LEN, IP_ADDR_LEN, and sockunion::sin.

Referenced by _intf_get_aliases(), _intf_get_noalias(), and START_TEST().

int addr_ston const struct sockaddr *  sa,
struct addr a
 

Definition at line 291 of file addr.c.

References ADDR_TYPE_ETH, ADDR_TYPE_IP, ADDR_TYPE_IP6, ARP_HRD_ETH, errno, ETH_ADDR_BITS, ETH_ADDR_LEN, IP6_ADDR_BITS, IP6_ADDR_LEN, IP_ADDR_BITS, memcpy, memset, and sockunion::sin.

Referenced by _intf_get_aliases(), _intf_get_noalias(), arp_get(), eth_get(), intf_get_dst(), route_msg(), and START_TEST().


Generated on Sun May 14 14:51:20 2006 by  doxygen 1.4.2