mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Modified set_direction to return a bool
This commit is contained in:
@@ -218,7 +218,7 @@ namespace Tins {
|
||||
* This calls pcap_setdirection using the provided parameter.
|
||||
* \param d The direction for the sniffer.
|
||||
*/
|
||||
int set_direction(pcap_direction_t d);
|
||||
bool set_direction(pcap_direction_t d);
|
||||
|
||||
/**
|
||||
* \brief Sets whether to extract RawPDUs or fully parsed packets.
|
||||
|
||||
@@ -224,8 +224,9 @@ void BaseSniffer::set_timeout(int ms) {
|
||||
pcap_set_timeout(handle, ms);
|
||||
}
|
||||
|
||||
int BaseSniffer::set_direction(pcap_direction_t d) {
|
||||
return pcap_setdirection(handle, d);
|
||||
bool BaseSniffer::set_direction(pcap_direction_t d) {
|
||||
bool result = pcap_setdirection(handle, d) != -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
// ****************************** Sniffer ******************************
|
||||
@@ -453,7 +454,7 @@ void SnifferConfiguration::configure_sniffer_post_activation(Sniffer& sniffer) c
|
||||
throw std::runtime_error("Could not set the filter! ");
|
||||
}
|
||||
}
|
||||
if (sniffer.set_direction(_direction) < 0) {
|
||||
if (!sniffer.set_direction(_direction)) {
|
||||
throw std::runtime_error("Could not set the direction! ");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user