-
Notifications
You must be signed in to change notification settings - Fork 7
/
parse_cap.h
60 lines (48 loc) · 1.77 KB
/
parse_cap.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
#ifndef PARSE_CAP_H
#define PARSE_CAP_H
#include <stdint.h>
#include "arguments.h"
/*
*Number of bytes is before field with Source Address
*Source Address is MAC of AP (BSSID)
*/
#define NUMBER_BYTE_BEFORE_SA 10
/*
* @bssid - MAC of AP (BSSID)
* @rssi - wifi signal strength value of the BSSID
* @timestamp - time of measure signal strength
*/
struct bssid_inf {
unsigned char bssid[6]; //?
signed char rssi;
double timestamp;
};
/*
*Finish statistic of sniff/parse frames
* @cnt_frames - number of all sniff/parse frames
* @cnt_bssid - number of BSSIDs; the program sniffs frames these BSSIDs
* @result - array (1 x cnt_bssid); each cell contain number frames certain BSSID
*/
struct sniff_stat {
unsigned int cnt_frames;
unsigned int cnt_bssid;
unsigned int *result;
};
void parse_cap(const struct arguments *config, struct sniff_stat *stat);
/*
*Extract wifi rssi value from radiotap-header of frames
*This func executes parse regardless of radiotap header length (length depend on driver / WNIC)
*/
signed char parse_radiotap(const unsigned char *pkt_data);
/*
*Extract source address (MAC of AP)
*This function skips radiotap header
*/
void parse_beacon(const unsigned char *pkt_data, unsigned char *bssid);
//Wtire to file @struct bssid_inf information
void fprintf_bssid_inf(FILE *fp, const struct bssid_inf *wifi_inf);
void sniff_stat_init(const struct arguments *config, struct sniff_stat *stat);
void cnt_frames(const unsigned char *frame_bssid_num, const char (*arg_bssid)[18], const int arg_bssid_cnt, unsigned int *result);
void bssid_num2str(const unsigned char *frame_bssid_num, char *frame_bssid_str);
void fprintf_sniff_stat(FILE *fp, const struct arguments *config, const struct sniff_stat *stat);
#endif