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