Exemple #1
0
void SnifferConfiguration::configure_sniffer_post_activation(Sniffer& sniffer) const
{
    if ((_flags & PACKET_FILTER) != 0) {
        if (!sniffer.set_filter(_filter)) {
            throw std::runtime_error("Could not set the filter! ");
        }
    }
    if (!sniffer.set_direction(_direction)) {
        throw std::runtime_error("Could not set the direction! ");
    }
}
Exemple #2
0
void SnifferConfiguration::configure_sniffer_post_activation(Sniffer& sniffer) const {
    if ((flags_ & PACKET_FILTER) != 0) {
        if (!sniffer.set_filter(filter_)) {
            throw invalid_pcap_filter(pcap_geterr(sniffer.get_pcap_handle()));
        }
    }
    // TODO: see how to actually do this on winpcap
    #ifndef _WIN32
    if ((flags_ & DIRECTION) != 0) {
        if (!sniffer.set_direction(direction_)) {
            throw pcap_error(pcap_geterr(sniffer.get_pcap_handle()));
        }
    }
    #endif // _WIN32
}