@@ -78,21 +78,21 @@ void HttpSniffer::start()
7878void HttpSniffer::got_packet (const struct pcap_pkthdr *header, const u_char *packet)
7979{
8080 /* Declare pointers to packet headers */
81- const struct radiotap_header *radiotap; /* The Radiotap header */
82- const struct wifi_header *hdr80211; /* The 802.11 header */
83- const struct snap_llc_header *snap_llc; /* The SNAP LLC header */
84- const struct sniff_ethernet *ethernet; /* The Ethernet header [1] */
85- const struct sniff_ip *ip = NULL ; /* The IP header */
86- const struct sniff_ip6 *ip6 = NULL ; /* The IPv6 header */
87- const struct sniff_tcp *tcp; /* The TCP header */
88- const char *payload; /* Packet payload */
81+ const struct radiotap_header *radiotap; /* The Radiotap header */
82+ const struct wifi_header *hdr80211; /* The 802.11 header */
83+ const struct snap_llc_header *snap_llc; /* The SNAP LLC header */
84+ const struct sniff_ethernet *ethernet; /* The Ethernet header [1] */
85+ const struct sniff_ip *ip = NULL ; /* The IP header */
86+ const struct sniff_ip6 *ip6 = NULL ; /* The IPv6 header */
87+ const struct sniff_tcp *tcp; /* The TCP header */
88+ const char *payload; /* Packet payload */
8989
9090 /* Declare header lengths */
91- int size_ip; /* Size of IP header in bytes */
92- int size_tcp; /* Size of TCP header << */
93- int size_payload; /* Size of data in bytes << */
94- int size_radiotap; /* Size of Radiotap header << */
95- int size_80211; /* Size of 802.11 header << */
91+ int size_ip; /* Size of IP header in bytes */
92+ int size_tcp; /* Size of TCP header */
93+ int size_payload; /* Size of data in bytes */
94+ int size_radiotap; /* Size of Radiotap header */
95+ int size_80211; /* Size of 802.11 header */
9696
9797 /* Layer 3 header offset */
9898 int l3hdr_off = SIZE_ETHERNET;
@@ -105,10 +105,12 @@ void HttpSniffer::got_packet(const struct pcap_pkthdr *header, const u_char *pac
105105 string from;
106106 string to;
107107
108+ WifiInfo wifi_info;
109+
108110 /* 802.11 monitor support... */
109111 if (m_wifimon) {
110112 /* Get Radiotap header length (variable) */
111- radiotap = (struct radiotap_header *)(packet);
113+ radiotap = (struct radiotap_header *)(packet);
112114 size_radiotap = radiotap->it_len ;
113115
114116 /* Calculate 802.11 header length (variable) */
@@ -146,6 +148,8 @@ void HttpSniffer::got_packet(const struct pcap_pkthdr *header, const u_char *pac
146148 return ;
147149 }
148150 ip_len = ntohs (ip->ip_len );
151+
152+ wifi_info = WifiInfo (hdr80211, radiotap);
149153 } else {
150154 /* Define ethernet header */
151155 ethernet = (struct sniff_ethernet *)(packet);
@@ -222,9 +226,9 @@ void HttpSniffer::got_packet(const struct pcap_pkthdr *header, const u_char *pac
222226 PacketCacheMap::iterator iter;
223227 iter = m_pending_packets.find (key);
224228
225- if (iter == m_pending_packets.end ())
226- http_packet = new HttpPacket (from, to);
227- else {
229+ if (iter == m_pending_packets.end ()) {
230+ http_packet = new HttpPacket (from, to, wifi_info );
231+ } else {
228232 http_packet = iter->second ;
229233 m_pending_packets.erase (iter);
230234 }
0 commit comments