1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-30 05:24:26 +01:00

Dot11 now uses option_not_found. Sniffer catches malformed_packet rather than std::runtime_error while sniffing.

This commit is contained in:
Matias Fontanini
2013-04-19 14:06:59 -03:00
parent 75bd445bd3
commit 91bdcca577
7 changed files with 617 additions and 391 deletions

View File

@@ -44,6 +44,7 @@
#include "dot11.h"
#include "sll.h"
#include "cxxstd.h"
#include "exceptions.h"
namespace Tins {
/**
@@ -268,10 +269,10 @@ namespace Tins {
template<class Functor>
void Tins::BaseSniffer::callback_handler(u_char *args, const struct pcap_pkthdr *header, const u_char *packet) {
bool ret_val(false);
LoopData<Functor> *data = reinterpret_cast<LoopData<Functor>*>(args);
try {
std::auto_ptr<PDU> pdu;
LoopData<Functor> *data = reinterpret_cast<LoopData<Functor>*>(args);
bool ret_val(false);
if(data->iface_type == DLT_EN10MB)
ret_val = call_functor<Tins::EthernetII>(data, packet, header);
else if(data->iface_type == DLT_IEEE802_11_RADIO)
@@ -287,13 +288,12 @@ namespace Tins {
ret_val = call_functor<Tins::Loopback>(data, packet, header);
else if(data->iface_type == DLT_LINUX_SLL)
ret_val = call_functor<Tins::SLL>(data, packet, header);
if(!ret_val)
pcap_breakloop(data->handle);
}
catch(std::runtime_error&) {
catch(malformed_packet&) {
}
if(!ret_val)
pcap_breakloop(data->handle);
}
template<class T>