2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2012 Markus Amend <markus@netsniff-ng.org>
4 * Subject to the GPL, version 2.
6 * IPv6 Fragmentation Header described in RFC2460
9 #ifndef PROTO_IPV6_FRAGM_H
10 #define PROTO_IPV6_FRAGM_H
14 #include <netinet/in.h> /* for ntohs() */
16 #include "proto_struct.h"
17 #include "dissector_eth.h"
21 uint8_t h_fragm_next_header
;
22 uint8_t h_fragm_reserved
;
23 uint16_t h_fragm_off_res_M
;
24 uint32_t h_fragm_identification
;
27 static inline void fragm(struct pkt_buff
*pkt
)
30 struct fragmhdr
*fragm_ops
;
32 fragm_ops
= (struct fragmhdr
*) pkt_pull(pkt
, sizeof(*fragm_ops
));
33 if (fragm_ops
== NULL
)
36 off_res_M
= ntohs(fragm_ops
->h_fragm_off_res_M
);
38 tprintf("\t [ Fragment ");
39 tprintf("NextHdr (%u), ", fragm_ops
->h_fragm_next_header
);
40 tprintf("Reserved (%u), ", fragm_ops
->h_fragm_reserved
);
41 tprintf("Offset (%u), ", off_res_M
>> 3);
42 tprintf("Res (%u), ", (off_res_M
>> 1) & 0x3);
43 tprintf("M flag (%u), ", off_res_M
& 0x1);
44 tprintf("Identification (%u)",
45 ntohl(fragm_ops
->h_fragm_identification
));
48 pkt_set_proto(pkt
, ð_lay3
, fragm_ops
->h_fragm_next_header
);
51 static inline void fragm_less(struct pkt_buff
*pkt
)
54 struct fragmhdr
*fragm_ops
;
56 fragm_ops
= (struct fragmhdr
*) pkt_pull(pkt
, sizeof(*fragm_ops
));
57 if (fragm_ops
== NULL
)
60 off_res_M
= ntohs(fragm_ops
->h_fragm_off_res_M
);
62 tprintf(" FragmOffs %u", off_res_M
>> 3);
64 pkt_set_proto(pkt
, ð_lay3
, fragm_ops
->h_fragm_next_header
);
67 struct protocol ipv6_fragm_ops
= {
70 .print_less
= fragm_less
,
73 #endif /* PROTO_IPV6_FRAGM_H */