35cb42a21b3fb3d68a774ade7cc94e7c5cda6e40
2 * copyright (c) 2001-2011 Emil Mikulic.
4 * decode.h: packet decoding.
6 * You may use, modify and redistribute this file under the terms of the
7 * GNU General Public License version 2. (see COPYING.GPL)
9 #ifndef __DARKSTAT_DECODE_H
10 #define __DARKSTAT_DECODE_H
13 #include <netinet/in_systm.h> /* n_time */
15 #include <netinet/in.h> /* for <netinet/ip.h> */
16 #include <netinet/ip.h> /* struct ip */
21 #define FDDI_HDR_LEN 21
22 #define IP_HDR_LEN sizeof(struct ip)
23 #define IPV6_HDR_LEN sizeof(struct ip6_hdr)
24 #define TCP_HDR_LEN sizeof(struct tcphdr)
25 #define UDP_HDR_LEN sizeof(struct udphdr)
26 #define NULL_HDR_LEN 4
27 #define PPPOE_HDR_LEN 8
28 #define SLL_HDR_LEN 16
31 #ifndef ETHER_ADDR_LEN
32 #define ETHER_ADDR_LEN 6
36 #define IPPROTO_OSPF 89
39 #define IPPROTO_INVALID 254 /* don't do proto accounting */
47 const struct linkhdr
*getlinkhdr(const int linktype
);
48 int getsnaplen(const struct linkhdr
*lh
);
51 /* Fields are in host byte order (except IPs) */
55 uint8_t proto
; /* IPPROTO_{TCP, UDP, ICMP} */
56 uint8_t tcp_flags
; /* only for TCP */
57 uint16_t src_port
, dst_port
; /* only for TCP, UDP */
58 uint8_t src_mac
[ETHER_ADDR_LEN
],
59 dst_mac
[ETHER_ADDR_LEN
]; /* only for Ethernet */
62 #endif /* __DARKSTAT_DECODE_H */
63 /* vim:set ts=3 sw=3 tw=78 expandtab: */