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

eth.h File Reference

Go to the source code of this file.

Defines

#define ETH_ADDR_LEN   6
#define ETH_ADDR_BITS   48
#define ETH_TYPE_LEN   2
#define ETH_CRC_LEN   4
#define ETH_HDR_LEN   14
#define ETH_LEN_MIN   64
#define ETH_LEN_MAX   1518
#define ETH_MTU   (ETH_LEN_MAX - ETH_HDR_LEN - ETH_CRC_LEN)
#define ETH_MIN   (ETH_LEN_MIN - ETH_HDR_LEN - ETH_CRC_LEN)
#define ETH_TYPE_PUP   0x0200
#define ETH_TYPE_IP   0x0800
#define ETH_TYPE_ARP   0x0806
#define ETH_TYPE_REVARP   0x8035
#define ETH_TYPE_8021Q   0x8100
#define ETH_TYPE_IPV6   0x86DD
#define ETH_TYPE_MPLS   0x8847
#define ETH_TYPE_MPLS_MCAST   0x8848
#define ETH_TYPE_PPPOEDISC   0x8863
#define ETH_TYPE_PPPOE   0x8864
#define ETH_TYPE_LOOPBACK   0x9000
#define ETH_IS_MULTICAST(ea)   (*(ea) & 0x01)
#define ETH_ADDR_BROADCAST   "\xff\xff\xff\xff\xff\xff"
#define eth_pack_hdr(h, dst, src, type)
#define eth_aton   eth_pton

Typedefs

typedef eth_addr eth_addr_t
typedef eth_handle eth_t

Functions

__BEGIN_DECLS eth_teth_open (const char *device)
int eth_get (eth_t *e, eth_addr_t *ea)
int eth_set (eth_t *e, const eth_addr_t *ea)
ssize_t eth_send (eth_t *e, const void *buf, size_t len)
eth_teth_close (eth_t *e)
char * eth_ntop (const eth_addr_t *eth, char *dst, size_t len)
int eth_pton (const char *src, eth_addr_t *dst)
char * eth_ntoa (const eth_addr_t *eth)


Define Documentation

#define ETH_ADDR_BITS   48
 

Definition at line 15 of file eth.h.

Referenced by _ifrow_to_entry(), _intf_get_noalias(), addr_bcast(), addr_net(), addr_ntop(), addr_pton(), addr_ston(), arp_loop(), eth_ntoa(), eth_set(), and START_TEST().

#define ETH_ADDR_BROADCAST   "\xff\xff\xff\xff\xff\xff"
 

Definition at line 53 of file eth.h.

Referenced by _request_arp(), addr_bcast(), and START_TEST().

#define ETH_ADDR_LEN   6
 

Definition at line 14 of file eth.h.

Referenced by _ifrow_to_entry(), _intf_get_noalias(), addr_bcast(), addr_ntos(), addr_ston(), arp_add(), arp_loop(), arp_main(), eth_get(), eth_main(), eth_ntoa(), eth_ntop(), eth_open(), eth_pton(), eth_send(), eth_set(), intf_set(), ip_send(), and START_TEST().

#define eth_aton   eth_pton
 

Definition at line 74 of file eth.h.

Referenced by __pyx_f_4dnet_eth_aton().

#define ETH_CRC_LEN   4
 

Definition at line 17 of file eth.h.

#define ETH_HDR_LEN   14
 

Definition at line 18 of file eth.h.

Referenced by _request_arp(), eth_main(), and ip_send().

#define ETH_IS_MULTICAST ea   )     (*(ea) & 0x01)
 

Definition at line 51 of file eth.h.

#define ETH_LEN_MAX   1518
 

Definition at line 21 of file eth.h.

Referenced by eth_main(), and ip_send().

#define ETH_LEN_MIN   64
 

Definition at line 20 of file eth.h.

Referenced by _add_ip_intf().

#define ETH_MIN   (ETH_LEN_MIN - ETH_HDR_LEN - ETH_CRC_LEN)
 

Definition at line 24 of file eth.h.

#define ETH_MTU   (ETH_LEN_MAX - ETH_HDR_LEN - ETH_CRC_LEN)
 

Definition at line 23 of file eth.h.

Referenced by arp_main().

#define eth_pack_hdr h,
dst,
src,
type   ) 
 

Value:

do {                    \
        struct eth_hdr *eth_pack_p = (struct eth_hdr *)(h);     \
        memmove(&eth_pack_p->eth_dst, &(dst), ETH_ADDR_LEN);    \
        memmove(&eth_pack_p->eth_src, &(src), ETH_ADDR_LEN);    \
        eth_pack_p->eth_type = htons(type);                     \
} while (0)

Definition at line 55 of file eth.h.

Referenced by __pyx_f_4dnet_eth_pack_hdr(), _request_arp(), and ip_send().

#define ETH_TYPE_8021Q   0x8100
 

Definition at line 43 of file eth.h.

#define ETH_TYPE_ARP   0x0806
 

Definition at line 41 of file eth.h.

Referenced by _request_arp(), and type_aton().

#define ETH_TYPE_IP   0x0800
 

Definition at line 40 of file eth.h.

Referenced by eth_main(), eth_open(), ip_send(), tun_send(), and type_aton().

#define ETH_TYPE_IPV6   0x86DD
 

Definition at line 44 of file eth.h.

#define ETH_TYPE_LEN   2
 

Definition at line 16 of file eth.h.

#define ETH_TYPE_LOOPBACK   0x9000
 

Definition at line 49 of file eth.h.

#define ETH_TYPE_MPLS   0x8847
 

Definition at line 45 of file eth.h.

#define ETH_TYPE_MPLS_MCAST   0x8848
 

Definition at line 46 of file eth.h.

#define ETH_TYPE_PPPOE   0x8864
 

Definition at line 48 of file eth.h.

#define ETH_TYPE_PPPOEDISC   0x8863
 

Definition at line 47 of file eth.h.

#define ETH_TYPE_PUP   0x0200
 

Definition at line 39 of file eth.h.

#define ETH_TYPE_REVARP   0x8035
 

Definition at line 42 of file eth.h.


Typedef Documentation

typedef struct eth_addr eth_addr_t
 

typedef struct eth_handle eth_t
 

Definition at line 62 of file eth.h.


Function Documentation

eth_t* eth_close eth_t e  ) 
 

Definition at line 79 of file eth-bsd.c.

References NULL, PacketCloseAdapter(), and PacketFreePacket().

Referenced by __pyx_f_4dnet_3eth___dealloc__(), _intf_get_noalias(), eth_open(), intf_set(), ip_close(), and send_main().

int eth_get eth_t e,
eth_addr_t ea
 

Definition at line 137 of file eth-bsd.c.

References _PACKET_OID_DATA::Data, ETH_ADDR_LEN, FALSE, _PACKET_OID_DATA::Length, memcpy, _PACKET_OID_DATA::Oid, OID_802_3_CURRENT_ADDRESS, PacketRequest(), and TRUE.

Referenced by __pyx_f_4dnet_3eth_get(), _intf_get_noalias(), and eth_open().

char* eth_ntoa const eth_addr_t eth  ) 
 

Definition at line 95 of file addr-util.c.

References addr_ntoa(), addr_pack, ADDR_TYPE_ETH, ETH_ADDR_BITS, and ETH_ADDR_LEN.

Referenced by __pyx_f_4dnet_eth_ntoa().

char* eth_ntop const eth_addr_t eth,
char *  dst,
size_t  len
 

Definition at line 75 of file addr-util.c.

References eth_addr::data, ETH_ADDR_LEN, NULL, and octet2hex.

Referenced by addr_ntop().

__BEGIN_DECLS eth_t* eth_open const char *  device  ) 
 

Definition at line 40 of file eth-bsd.c.

References ADDR_TYPE_ETH, ETH_ADDR_LEN, eth_close(), eth_get(), intf, intf_close(), intf_get(), intf_open(), memcmp(), memset, NULL, PacketAllocatePacket(), PacketCloseAdapter(), PacketGetAdapterNames(), PacketOpenAdapter(), PacketSetBuff(), and strlcpy.

Referenced by __pyx_f_4dnet_3eth___init__(), _intf_get_noalias(), _lookup_ip_intf(), intf_set(), and send_main().

int eth_pton const char *  src,
eth_addr_t dst
 

Definition at line 104 of file addr-util.c.

References eth_addr::data, ETH_ADDR_LEN, and strtol().

Referenced by addr_pton().

ssize_t eth_send eth_t e,
const void *  buf,
size_t  len
 

Definition at line 73 of file eth-bsd.c.

References PacketInitPacket(), PacketSendPacket(), and TRUE.

Referenced by __pyx_f_4dnet_3eth_send(), _request_arp(), ip_send(), and send_main().

int eth_set eth_t e,
const eth_addr_t ea
 

Definition at line 163 of file eth-bsd.c.

References _PACKET_OID_DATA::Data, ETH_ADDR_LEN, _PACKET_OID_DATA::Length, eth_handle::lpa, memcpy, _PACKET_OID_DATA::Oid, OID_802_3_CURRENT_ADDRESS, PacketRequest(), and TRUE.

Referenced by __pyx_f_4dnet_3eth_set(), and intf_set().


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