"Fossies" - the Fresh Open Source Software Archive

Member "tcpflow-1.6.1/src/datalink_wifi.cpp" (19 Feb 2021, 1504 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.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.5.0_vs_1.6.1.

    1 /**
    2  * wifi datalink function and callbacks to handle 802.11
    3  * In addition to calling process_packet_info() for the packets,
    4  * it maintains some 802.11 specific databases.
    5  */
    6 
    7 #include "tcpflow.h"
    8 #include "datalink_wifi.h"
    9 
   10 /**
   11  * TFCB --- TCPFLOW callbacks for wifippcap
   12  */
   13 
   14 void TFCB::Handle80211(const WifiPacket &p, u_int16_t fc, const MAC& sa, const MAC& da, const MAC& ra, const MAC& ta, const u_char *ptr, size_t len)
   15 {
   16 }
   17 
   18 void TFCB::HandleLLC(const WifiPacket &p, const struct llc_hdr_t *hdr, const u_char *rest, size_t len) {
   19     sbuf_t sb(pos0_t(),rest,len,len,0,false,false,false);
   20     struct timeval tv;
   21     be13::packet_info pi(p.header_type,p.header,p.packet,tvshift(tv,p.header->ts),rest,len);
   22     be13::plugin::process_packet(pi);
   23 }
   24 
   25 void TFCB::Handle80211MgmtBeacon(const WifiPacket &p, const mgmt_header_t *hdr, const mgmt_body_t *body)
   26 {
   27 #ifdef DEBUG_WIFI
   28     std::cerr << "  " << "802.11 mgmt: " << hdr->sa << " beacon " << body->ssid.ssid << "\"";
   29 #endif
   30     mac_ssid bcn(hdr->sa,std::string(body->ssid.ssid));
   31     mac_to_ssid[bcn] += 1;
   32 }
   33 
   34 
   35 /* Entrance point */
   36 TFCB TFCB::theTFCB;                           // singleton
   37 static Wifipcap theWcap;
   38 void dl_ieee802_11_radio(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
   39 {
   40     theWcap.handle_packet(&TFCB::theTFCB,DLT_IEEE802_11_RADIO,h,p);
   41 }
   42 
   43 void dl_prism(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
   44 {
   45 #ifdef DLT_PRISM_HEADER
   46     theWcap.handle_packet(&TFCB::theTFCB,DLT_PRISM_HEADER,h,p);
   47 #endif
   48 }