-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandle80211.h
59 lines (43 loc) · 1.25 KB
/
handle80211.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
#ifndef HANDLE80211_H
#define HANDLE80211_H
#include <stdint.h>
typedef struct {
int sockfd;
u_char *buffer;
} sk_handle;
/*
* From radiotap.org
* De facto (linux?) standard for 80211 rx/tx.
* Mostly just want the offset, don't care as much about fine details at the moment.
*/
struct radiotap_header {
uint8_t it_rev; //Radiotap version, set to 0?
uint8_t it_pad; //Alignment padding -- word boundaries
uint8_t it_len; //Get entire radiotap header
uint8_t it_present; //Fields present
};
/*
* Frame Control Field for figuring out what is happening.
*/
typedef struct {
unsigned char fc[2]; /* First two bytes of the MAC header */
} frame_ctrl;
/*
* Three _types_ of 802.11 frames to deal with.
*/
enum frame_type {
MGMT,
CTRL,
DATA
};
void get_frame_type(const u_char *byte, enum frame_type *type);
void handle_mgmt_frame(const u_char *pkt);
void handle_frame(const u_char *pkt, enum frame_type *type);
void create_pack_socket(sk_handle *skh);
void cleanup_mcpap(sk_handle *skh);
int bind_pack_socket(sk_handle *skh, int if_index);
int set_if_promisc(sk_handle *skh, int if_index);
// void allocate_packet_buffer(packet_buffer *pb);
void handle_buffer(sk_handle *skh);
int read_socket(sk_handle *skh);
#endif