-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.h
109 lines (84 loc) · 2.22 KB
/
common.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
/* vim: expandtab:tw=68:ts=4:sw=4:
*
* common.h - Common header between ifscand and ifscanctl
*
* Copyright (c) 2016 Sudhi Herle <sw at herle.net>
*/
#ifndef ___COMMON_H_9509687_1482985191__
#define ___COMMON_H_9509687_1482985191__ 1
/* Provide C linkage for symbols declared here .. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <stdint.h>
#include <netinet/in.h>
#include <sys/param.h>
#include <sys/select.h>
#include <net80211/ieee80211.h>
#include <net/if.h>
#include <net80211/ieee80211_ioctl.h>
#include "vect.h"
#include "fastbuf.h"
/*
* Global vars
*/
#define IFSCAND_PREFS "/var/ifscand/prefs"
#define IFSCAND_SOCK "/var/run/ifscand"
#define AP_NAMELEN 128
#define AP_KEYLEN 128
/*
* BitFlags used in 'apdata' below.
*/
#define AP_BSSID (1 << 0)
#define AP_NWID (1 << 1)
/*
* MYMAC is set if the non-default MAC address is set for a given
* AP. The non-default can be a fixed value or a random value.
* RANDMAC signifies the latter.
*/
#define AP_MYMAC (1 << 2)
#define AP_RANDMAC (1 << 3)
#define AP_IN4 (1 << 4)
#define AP_GW4 (1 << 5)
#define AP_IN6 (1 << 6)
#define AP_GW6 (1 << 7)
#define AP_WPAKEY (1 << 8)
#define AP_WEPKEY (1 << 9)
#define AP_IN4DHCP (1 << 10)
/*
* information about a particular AP and the user's preference. This
* is persisted.
*/
struct apdata
{
// Flags determine validity of the rest of the contents below.
uint32_t flags; // AP_xxx flags above.
char apname[AP_NAMELEN];
char key[AP_KEYLEN];
uint8_t apmac[6]; // pinned MAC addr
uint8_t mymac[6]; // station MAC addr
struct in_addr in4;
struct in_addr mask4;
struct in_addr gw4;
struct in6_addr in6;
struct in6_addr mask6;
struct in6_addr gw6;
/*
* We need these two elements for measuring RSSI
*/
uint8_t nr_bssid[6];
int8_t nr_rssi;
int8_t nr_max_rssi;
};
typedef struct apdata apdata;
// Array of persisted AP's
VECT_TYPEDEF(apvect, apdata);
// List of All APs we have scanned
VECT_TYPEDEF(nodevect, struct ieee80211_nodereq);
// Vector of strings
VECT_TYPEDEF(strvect, char *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ! ___COMMON_H_9509687_1482985191__ */
/* EOF */