1 #ifndef IPTRAF_NG_PACKET_H
2 #define IPTRAF_NG_PACKET_H
6 packet.h - external declarations for packet.c
10 #define INVALID_PACKET 0
12 #define CHECKSUM_ERROR 2
13 #define PACKET_FILTERED 3
14 #define MORE_FRAGMENTS 4
19 size_t pkt_caplen
; /* bytes captured */
20 size_t pkt_len
; /* bytes on-the-wire */
21 unsigned short pkt_protocol
; /* Physical layer protocol: ETH_P_* */
23 struct sockaddr_ll
*from
;
25 struct ethhdr
*ethhdr
;
26 struct fddihdr
*fddihdr
;
29 struct ip6_hdr
*ip6_hdr
;
32 static inline __u8
pkt_iph_len(const struct pkt_hdr
*pkt
)
34 switch (pkt
->pkt_protocol
) {
36 return pkt
->iphdr
->ihl
* 4;
44 static inline __u8
pkt_ip_protocol(const struct pkt_hdr
*p
)
46 switch (p
->pkt_protocol
) {
48 return p
->iphdr
->protocol
;
50 return p
->ip6_hdr
->ip6_nxt
; /* FIXME: extension headers ??? */
55 int packet_process(struct pkt_hdr
*pkt
, unsigned int *total_br
,
56 in_port_t
*sport
, in_port_t
*dport
,
57 int match_opposite
, int v6inv4asv6
);
58 int packet_init(struct pkt_hdr
*pkt
);
59 void packet_destroy(struct pkt_hdr
*pkt
);
60 int packet_is_first_fragment(struct pkt_hdr
*pkt
);
62 #endif /* IPTRAF_NG_PACKET_H */