ifpps: Rename cpu number parameter to stats_top()
[netsniff-ng.git] / proto_ip_esp.c
blobcc4e06ea720272debfccc611f6ab9168a1d0b31c
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 "protos.h"
15 #include "dissector_eth.h"
16 #include "built_in.h"
17 #include "pkt_buff.h"
19 struct esp_hdr {
20 uint32_t h_spi;
21 uint32_t h_sn;
22 } __packed;
24 static void esp(struct pkt_buff *pkt)
26 struct esp_hdr *esp_ops;
28 esp_ops = (struct esp_hdr *) pkt_pull(pkt, sizeof(*esp_ops));
29 if (esp_ops == NULL)
30 return;
32 tprintf(" [ ESP ");
33 tprintf("SPI (0x%x), ", ntohl(esp_ops->h_spi));
34 tprintf("SN (0x%x)", ntohl(esp_ops->h_sn));
35 tprintf(" ]\n");
38 static void esp_less(struct pkt_buff *pkt)
40 struct esp_hdr *esp_ops;
42 esp_ops = (struct esp_hdr *) pkt_pull(pkt, sizeof(*esp_ops));
43 if (esp_ops == NULL)
44 return;
46 tprintf(" ESP");
49 struct protocol ip_esp_ops = {
50 .key = 0x32,
51 .print_full = esp,
52 .print_less = esp_less,