-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWTPBcmFrameReceive.h
142 lines (121 loc) · 4.91 KB
/
WTPBcmFrameReceive.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*******************************************************************************************
* Copyright (c) 2006-7 Laboratorio di Sistemi di Elaborazione e Bioingegneria Informatica *
* Universita' Campus BioMedico - Italy *
* *
* This program is free software; you can redistribute it and/or modify it under the terms *
* of the GNU General Public License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with this *
* program; if not, write to the: *
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
* MA 02111-1307, USA. *
* *
* --------------------------------------------------------------------------------------- *
* Project: Capwap *
* *
* Author : Ludovico Rossi ([email protected]) *
* Del Moro Andrea ([email protected]) *
* Giovannini Federica ([email protected]) *
* Massimo Vellucci ([email protected]) *
* Mauro Bisson ([email protected]) *
*******************************************************************************************/
#ifndef __CAPWAP_WTPFrameReceive_HEADER__
#define __CAPWAP_WTPFrameReceive_HEADER__
#include <sys/socket.h>
#include <sys/types.h>
#include <linux/if_ether.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <pcap.h>
#include "CWWTP.h"
#define EXIT_THREAD CWLog("ERROR Handling Frames: application will be closed!"); \
exit(1);
#define WL_DEVICE "wl0"
#define MAC_ADDR_LEN 6
/* check this magic number */
#define WLC_IOCTL_MAGIC 0x14e46c77
#define WLC_GET_MAGIC 0
#define WLC_GET_BSSID 23
#define WLC_SET_BSSID 24
#define WLC_GET_SSID 25
#define WLC_SET_SSID 26
#define WLC_GET_CHANNEL 29
#define WLC_SET_CHANNEL 30
#define WLC_GET_MONITOR 107 /* discovered by nbd */
#define WLC_SET_MONITOR 108 /* discovered by nbd */
#define WLC_GET_AP 117
#define WLC_SET_AP 118
#define WLC_GET_RSSI 127
#define WLC_GET_ASSOCLIST 159
#ifdef DEFINE_TYPES
typedef unsigned short u_short;
typedef unsigned char u_char;
typedef unsigned int u_int;
#endif
typedef enum {
mgt_assocRequest = 0,
mgt_assocResponse = 1,
mgt_reassocRequest = 2,
mgt_reassocResponse = 3,
mgt_probeRequest = 4,
mgt_probeResponse = 5,
mgt_beacon = 8,
mgt_disassoc = 10,
mgt_auth = 11,
mgt_deauth = 12
} wifi_frametype;
typedef struct ieee802_11_hdr {
u_char frame_control;
u_char flags;
#define IEEE80211_TO_DS 0x01
#define IEEE80211_FROM_DS 0x02
#define IEEE80211_MORE_FRAG 0x04
#define IEEE80211_RETRY 0x08
#define IEEE80211_PWR_MGT 0x10
#define IEEE80211_MORE_DATA 0x20
#define IEEE80211_WEP_FLAG 0x40
#define IEEE80211_ORDER_FLAG 0x80
u_short duration;
u_char addr1[6];
u_char addr2[6];
u_char addr3[6];
u_short frag_and_seq;
} ieee802_11_hdr;
typedef struct {
u_char timestamp[8];
u_short bcn_interval;
u_short caps;
#define MGT_CAPS_AP 0x1
#define MGT_CAPS_IBSS 0x2
#define MGT_CAPS_WEP 0x10
} ieee_802_11_mgt_frame;
typedef struct prism_hdr {
u_int msg_code;
u_int msg_length;
char cap_device[16];
} prism_hdr;
typedef struct prism_did {
u_short did;
u_short status1;
u_short status2;
u_short length;
} prism_did;
typedef enum prism_did_num {
pdn_host_time = 0x1041,
pdn_mac_time = 0x2041,
pdn_rssi = 0x4041,
pdn_sq = 0x5041,
pdn_datarate = 0x8041,
pdn_framelen = 0xa041
} prism_did_num;
void print_mac(u_char * mac, char * extra);
void fprint_mac(FILE * outf, u_char * mac, char * extra);
int macAddrCmp (unsigned char* addr1, unsigned char* addr2);
int get_mac(u_char *buf);
void dealWithPacket(struct pcap_pkthdr * header, const u_char * packet, u_char * wl0_mac_address);
#endif