source: libpacketdump/link_4.c @ ace188a

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since ace188a was ace188a, checked in by Perry Lorier <perry@…>, 15 years ago

MacOS X is more picky about it's order of header files

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#include <sys/types.h>
2#include <netinet/in.h>
3#include <stdio.h>
4#include "libpacketdump.h"
5#include "libtrace.h"
6
7struct ieee_802_11_header {
8        uint8_t      protocol:2;
9        uint8_t      type:2;
10        uint8_t      subtype:4;
11        uint8_t      to_ds:1;
12        uint8_t      from_ds:1;
13        uint8_t      more_frag:1;
14        uint8_t      retry:1;
15        uint8_t      power:1;
16        uint8_t      more_data:1;
17        uint8_t      wep:1;
18        uint8_t      order:1;
19        uint16_t     duration;
20        uint8_t      mac1[6];
21        uint8_t      mac2[6];
22        uint8_t      mac3[6];
23        uint16_t     SeqCtl;
24        uint8_t      mac4[6];
25        uint8_t      data[1];
26};
27
28struct ieee_802_11_payload {
29        uint16_t     type;
30        uint8_t      data[1];
31};
32
33void decode(int link_type,char *packet,int len)
34{
35        char ether_buf[18] = {0, };
36        printf(" 802.11:");
37        struct ieee_802_11_header *hdr = (struct ieee_802_11_header *)packet;
38
39        printf(" %s",trace_ether_ntoa((uint8_t*)(hdr->mac1), ether_buf));
40        printf(" %s",trace_ether_ntoa((uint8_t*)(hdr->mac2), ether_buf));
41        printf(" %s",trace_ether_ntoa((uint8_t*)(hdr->mac3), ether_buf));
42
43        struct ieee_802_11_payload *pld = (struct ieee_802_11_payload *) ((char*)packet + sizeof(struct ieee_802_11_header) - 2);
44        uint16_t type = htons(pld->type);
45        printf(" %04x\n",type);
46        decode_next((char *)pld->data,len-(sizeof(struct ieee_802_11_header)),"eth",type);
47        return;
48}
Note: See TracBrowser for help on using the repository browser.