/* darkstat 3
- * copyright (c) 2001-2009 Emil Mikulic.
+ * copyright (c) 2001-2011 Emil Mikulic.
*
* decode.h: packet decoding.
*
* You may use, modify and redistribute this file under the terms of the
* GNU General Public License version 2. (see COPYING.GPL)
*/
+#ifndef __DARKSTAT_DECODE_H
+#define __DARKSTAT_DECODE_H
#include <pcap.h>
#include <netinet/in_systm.h> /* n_time */
#include <netinet/in.h> /* for <netinet/ip.h> */
#include <netinet/ip.h> /* struct ip */
-#include "hosts_db.h" /* addr46 */
+#include "addr.h"
#define PPP_HDR_LEN 4
#define FDDI_HDR_LEN 21
#endif
#ifndef IPPROTO_OSPF
-# define IPPROTO_OSPF 89
+#define IPPROTO_OSPF 89
#endif
+#define IPPROTO_INVALID 254 /* don't do proto accounting */
+
struct linkhdr {
int linktype;
unsigned int hdrlen;
const struct linkhdr *getlinkhdr(const int linktype);
int getsnaplen(const struct linkhdr *lh);
-char *ip_to_str(const struct addr46 *const ip);
-char *ip_to_str_af(const void *const addr, sa_family_t af);
-typedef struct {
+struct pktsummary {
/* Fields are in host byte order (except IPs) */
- union {
- struct in_addr src_ip;
- struct in6_addr src_ip6;
- };
- union {
- struct in_addr dest_ip;
- struct in6_addr dest_ip6;
- };
+ struct addr src, dst;
time_t time;
uint16_t len;
- sa_family_t af; /* AF_{UNSPEC, INET, INET6} */
- uint8_t proto; /* IPPROTO_{TCP, UDP, ICMP} */
- uint8_t tcp_flags; /* only for TCP */
- uint16_t src_port, dest_port; /* only for TCP, UDP */
+ uint8_t proto; /* IPPROTO_{TCP, UDP, ICMP} */
+ uint8_t tcp_flags; /* only for TCP */
+ uint16_t src_port, dst_port; /* only for TCP, UDP */
uint8_t src_mac[ETHER_ADDR_LEN],
dst_mac[ETHER_ADDR_LEN]; /* only for Ethernet */
-} pktsummary;
+};
+#endif /* __DARKSTAT_DECODE_H */
/* vim:set ts=3 sw=3 tw=78 expandtab: */