Merge pull request #269 from AndreasGocht/add_udp

allow the library to enable UDP recording
This commit is contained in:
Arnout Engelen
2024-01-08 23:00:47 +01:00
committed by GitHub
3 changed files with 21 additions and 0 deletions

View File

@@ -84,6 +84,12 @@ std::vector<NethogsPackageStats> nethogs_packet_stats_py()
return stats_vector; return stats_vector;
} }
void nethogs_enable_udp_py(bool state)
{
nethogs_enable_udp(state);
}
//--- python module binding //--- python module binding
PYBIND11_MODULE(nethogs, m) { PYBIND11_MODULE(nethogs, m) {
py::class_<NethogsMonitorRecord>(m, "NethogsMonitorRecord") py::class_<NethogsMonitorRecord>(m, "NethogsMonitorRecord")
@@ -117,6 +123,9 @@ PYBIND11_MODULE(nethogs, m) {
m.def("nethogs_packet_stats", &nethogs_packet_stats_py, R"pbdoc( m.def("nethogs_packet_stats", &nethogs_packet_stats_py, R"pbdoc(
Nethogs pcap packet stats Nethogs pcap packet stats
)pbdoc"); )pbdoc");
m.def("nethogs_enable_udp", &nethogs_enable_udp_py, R"pbdoc(
Enables or disables the recording of UDP, default is False.
)pbdoc");
#ifdef VERSION #ifdef VERSION

View File

@@ -355,4 +355,9 @@ void nethogs_packet_stats(NethogsPackageStats **stats, int *stats_size)
i++; i++;
} }
*stats_size = handles.size(); *stats_size = handles.size();
}
void nethogs_enable_udp(bool state)
{
catchall = state;
} }

View File

@@ -112,6 +112,13 @@ NETHOGS_DSO_VISIBLE void nethogsmonitor_breakloop();
*/ */
NETHOGS_DSO_VISIBLE void nethogs_packet_stats(NethogsPackageStats **stats, int *stats_size); NETHOGS_DSO_VISIBLE void nethogs_packet_stats(NethogsPackageStats **stats, int *stats_size);
/**
* @brief Enables or disables the UDP recording. Default is False.
*
* @param state state to set
*/
NETHOGS_DSO_VISIBLE void nethogs_enable_udp(bool state);
#undef NETHOGS_DSO_VISIBLE #undef NETHOGS_DSO_VISIBLE
#undef NETHOGS_DSO_HIDDEN #undef NETHOGS_DSO_HIDDEN