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

addr.c File Reference

#include "config.h"
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dnet.h"

Go to the source code of this file.

Defines

#define MAXHOSTNAMELEN   256

Functions

int addr_cmp (const struct addr *a, const struct addr *b)
int addr_net (const struct addr *a, struct addr *b)
int addr_bcast (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 MAXHOSTNAMELEN   256
 

Definition at line 34 of file addr.c.


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

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:21 2006 by  doxygen 1.4.2