dissector_80211: start of 80211 collection
[netsniff-ng.git] / src / proto_ip_esp.h
blob9ee100cdda92f55cadd880774559d151db451a2d
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2012 Markus Amend <markus@netsniff-ng.org>
4 * Subject to the GPL, version 2.
6 * Encapsulating Security Payload described in RFC4303
7 */
9 #ifndef PROTO_ESP_H
10 #define PROTO_ESP_H
12 #include <stdio.h>
13 #include <stdint.h>
14 #include <netinet/in.h> /* for ntohs() */
16 #include "proto_struct.h"
17 #include "dissector_eth.h"
18 #include "built_in.h"
20 struct esp_hdr {
21 uint32_t h_spi;
22 uint32_t h_sn;
23 } __packed;
25 static inline void esp(struct pkt_buff *pkt)
27 struct esp_hdr *esp_ops;
29 esp_ops = (struct esp_hdr *) pkt_pull(pkt, sizeof(*esp_ops));
30 if (esp_ops == NULL)
31 return;
33 tprintf(" [ ESP ");
34 tprintf("SPI (0x%x), ", ntohl(esp_ops->h_spi));
35 tprintf("SN (0x%x)", ntohl(esp_ops->h_sn));
36 tprintf(" ]\n");
39 static inline void esp_less(struct pkt_buff *pkt)
41 struct esp_hdr *esp_ops;
43 esp_ops = (struct esp_hdr *) pkt_pull(pkt, sizeof(*esp_ops));
44 if (esp_ops == NULL)
45 return;
47 tprintf(" ESP");
50 struct protocol ip_esp_ops = {
51 .key = 0x32,
52 .print_full = esp,
53 .print_less = esp_less,
56 #endif /* PROTO_ESP_H */