@@ -78,21 +78,21 @@ void HttpSniffer::start()
78
78
void HttpSniffer::got_packet (const struct pcap_pkthdr *header, const u_char *packet)
79
79
{
80
80
/* 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 */
89
89
90
90
/* 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 */
96
96
97
97
/* Layer 3 header offset */
98
98
int l3hdr_off = SIZE_ETHERNET;
@@ -105,10 +105,12 @@ void HttpSniffer::got_packet(const struct pcap_pkthdr *header, const u_char *pac
105
105
string from;
106
106
string to;
107
107
108
+ WifiInfo wifi_info;
109
+
108
110
/* 802.11 monitor support... */
109
111
if (m_wifimon) {
110
112
/* Get Radiotap header length (variable) */
111
- radiotap = (struct radiotap_header *)(packet);
113
+ radiotap = (struct radiotap_header *)(packet);
112
114
size_radiotap = radiotap->it_len ;
113
115
114
116
/* Calculate 802.11 header length (variable) */
@@ -146,6 +148,8 @@ void HttpSniffer::got_packet(const struct pcap_pkthdr *header, const u_char *pac
146
148
return ;
147
149
}
148
150
ip_len = ntohs (ip->ip_len );
151
+
152
+ wifi_info = WifiInfo (hdr80211, radiotap);
149
153
} else {
150
154
/* Define ethernet header */
151
155
ethernet = (struct sniff_ethernet *)(packet);
@@ -222,9 +226,9 @@ void HttpSniffer::got_packet(const struct pcap_pkthdr *header, const u_char *pac
222
226
PacketCacheMap::iterator iter;
223
227
iter = m_pending_packets.find (key);
224
228
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 {
228
232
http_packet = iter->second ;
229
233
m_pending_packets.erase (iter);
230
234
}
0 commit comments