"Fossies" - the Fresh Open Source Software Archive 
Member "tcpflow-1.6.1/src/datalink_wifi.h" (19 Feb 2021, 1592 Bytes) of package /linux/misc/tcpflow-1.6.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "datalink_wifi.h" see the
Fossies "Dox" file reference documentation.
1 #ifndef DATALINK_WIFI_H
2 #define DATALINK_WIFI_H
3
4 #include <algorithm>
5 #include <map>
6 #include "wifipcap.h"
7
8 //#define DEBUG_WIFI
9
10 class TFCB : public WifipcapCallbacks {
11 private:
12
13 public:
14 bool opt_check_fcs;
15
16 typedef struct mac_ssid {
17 mac_ssid(const MAC &mac_,const std::string &ssid_):mac(mac_),ssid(ssid_){}
18 const MAC mac;
19 const std::string ssid;
20 bool operator<(const struct mac_ssid &b) const{
21 if (mac < b.mac) return true;
22 if (b.mac < mac) return false;
23 return ssid < b.ssid;
24 };
25 } mac_ssid_t;
26
27 typedef struct {
28 bool operator() (const struct mac_ssid &a, const struct mac_ssid &b) const {
29 if (a.mac < b.mac) return true;
30 if (b.mac < a.mac) return false;
31 return a.ssid < b.ssid;
32 }
33 } mac_ssid_lt;
34 typedef std::set<mac_ssid_t,mac_ssid_lt> mac_ssid_set_t;
35 typedef std::map<mac_ssid_t,uint64_t> mac_ssid_map_t;
36 mac_ssid_map_t mac_to_ssid; // mapping of macs to SSIDs
37
38 static TFCB theTFCB;
39 TFCB():opt_check_fcs(true),mac_to_ssid(){}
40
41 virtual bool Check80211FCS(const WifiPacket &p) { return opt_check_fcs; }
42 virtual void Handle80211(const WifiPacket &p,u_int16_t fc, const MAC& sa, const MAC& da,
43 const MAC& ra, const MAC& ta, const u_char *ptr, size_t len) ;
44
45 void HandleLLC(const WifiPacket &p,const struct llc_hdr_t *hdr, const u_char *rest, size_t len) ;
46 void Handle80211MgmtBeacon(const WifiPacket &p,const mgmt_header_t *hdr, const mgmt_body_t *body) ;
47 };
48
49 #endif