00001 #ifndef _NET_ETHERNET_H_
00002 #define _NET_ETHERNET_H_
00003
00004 #ifndef ETHER_ADDR_LEN
00005 #define ETHER_ADDR_LEN 6
00006 #endif
00007
00008 #ifndef ETHER_TYPE_LEN
00009 #define ETHER_TYPE_LEN 2
00010 #endif
00011
00012 #define ETHER_CRC_LEN 4
00013
00014 #ifndef ETHER_HDR_LEN
00015 #define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
00016 #endif
00017
00018 #ifndef ETHER_MIN_LEN
00019 #define ETHER_MIN_LEN 64
00020 #endif
00021
00022 #ifndef ETHER_MAX_LEN
00023 #define ETHER_MAX_LEN 1518
00024 #endif
00025
00026 #define ETHER_IS_VALID_LEN(foo) \
00027 ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
00028
00029
00030
00031
00032 #ifndef HAVE_ETHER_HEADER_STRUCT
00033 struct ether_header {
00034 u_char ether_dhost[ETHER_ADDR_LEN];
00035 u_char ether_shost[ETHER_ADDR_LEN];
00036 u_short ether_type;
00037 };
00038
00039 #endif
00040
00041
00042
00043 #ifndef HAVE_ETHER_ADDRESS_STRUCT
00044 struct ether_addr {
00045 u_char octet[ETHER_ADDR_LEN];
00046 };
00047 #endif
00048
00049 #endif
00050
00051 #ifndef _NS_ETHERNET_H_
00052 #define _NS_ETHERNET_H_
00053
00054
00055 class Ethernet {
00056 public:
00057 static void ether_print(const u_char *);
00058 static char* etheraddr_string(const u_char*);
00059 static u_char* nametoaddr(const char *devname);
00060
00061 private:
00062 static char hex[];
00063 };
00064
00065 #endif