dissectors: Remove unnecessary includes of dissector_eth.h
[netsniff-ng.git] / proto_ip_esp.c
blobc588141780a92b0061d27b2bc2c82a47c6f8df89
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2012 Markus Amend <markus@netsniff-ng.org>, Deutsche Flugsicherung GmbH
4 * Subject to the GPL, version 2.
6 * Encapsulating Security Payload described in RFC4303
7 */
9 #include <stdio.h>
10 #include <stdint.h>
11 #include <netinet/in.h> /* for ntohs() */
13 #include "proto.h"
14 #include "built_in.h"
15 #include "pkt_buff.h"
17 struct esp_hdr {
18 uint32_t h_spi;
19 uint32_t h_sn;
20 } __packed;
22 static void esp(struct pkt_buff *pkt)
24 struct esp_hdr *esp_ops;
26 esp_ops = (struct esp_hdr *) pkt_pull(pkt, sizeof(*esp_ops));
27 if (esp_ops == NULL)
28 return;
30 tprintf(" [ ESP ");
31 tprintf("SPI (0x%x), ", ntohl(esp_ops->h_spi));
32 tprintf("SN (0x%x)", ntohl(esp_ops->h_sn));
33 tprintf(" ]\n");
36 static void esp_less(struct pkt_buff *pkt)
38 struct esp_hdr *esp_ops;
40 esp_ops = (struct esp_hdr *) pkt_pull(pkt, sizeof(*esp_ops));
41 if (esp_ops == NULL)
42 return;
44 tprintf(" ESP");
47 struct protocol ip_esp_ops = {
48 .key = 0x32,
49 .print_full = esp,
50 .print_less = esp_less,