4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 37dc1fb was
950d54a,
checked in by Perry Lorier <perry@…>, 17 years ago
|
Add libpacketdump to cvs
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | #include <netinet/ether.h> |
---|
2 | #include <netinet/in.h> |
---|
3 | #include <stdio.h> |
---|
4 | #include <inttypes.h> |
---|
5 | #include <dlfcn.h> |
---|
6 | #include <map> |
---|
7 | #include "libpacketdump.h" |
---|
8 | |
---|
9 | struct ieee_802_11_header { |
---|
10 | uint8_t protocol:2; |
---|
11 | uint8_t type:2; |
---|
12 | uint8_t subtype:4; |
---|
13 | uint8_t to_ds:1; |
---|
14 | uint8_t from_ds:1; |
---|
15 | uint8_t more_frag:1; |
---|
16 | uint8_t retry:1; |
---|
17 | uint8_t power:1; |
---|
18 | uint8_t more_data:1; |
---|
19 | uint8_t wep:1; |
---|
20 | uint8_t order:1; |
---|
21 | uint16_t duration; |
---|
22 | uint8_t mac1[6]; |
---|
23 | uint8_t mac2[6]; |
---|
24 | uint8_t mac3[6]; |
---|
25 | uint16_t SeqCtl; |
---|
26 | uint8_t mac4[6]; |
---|
27 | uint8_t data[1]; |
---|
28 | }; |
---|
29 | |
---|
30 | struct ieee_802_11_payload { |
---|
31 | uint16_t type; |
---|
32 | uint8_t data[1]; |
---|
33 | }; |
---|
34 | |
---|
35 | extern "C" |
---|
36 | void decode(int link_type,char *packet,int len) |
---|
37 | { |
---|
38 | printf(" 802.11:"); |
---|
39 | struct ieee_802_11_header *hdr = (struct ieee_802_11_header *)packet; |
---|
40 | |
---|
41 | printf(" %s",ether_ntoa((struct ether_addr*)(hdr->mac1))); |
---|
42 | printf(" %s",ether_ntoa((struct ether_addr*)(hdr->mac2))); |
---|
43 | printf(" %s",ether_ntoa((struct ether_addr*)(hdr->mac3))); |
---|
44 | |
---|
45 | struct ieee_802_11_payload *pld = (struct ieee_802_11_payload *) ((int)packet + sizeof(struct ieee_802_11_header) - 2); |
---|
46 | uint16_t type = htons(pld->type); |
---|
47 | printf(" %04x\n",type); |
---|
48 | decode_next((char *)pld->data,len-(sizeof(struct ieee_802_11_header)),"eth",type); |
---|
49 | return; |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.