aboutsummaryrefslogtreecommitdiff
path: root/pcap-haiku.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-haiku.cpp')
-rw-r--r--pcap-haiku.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/pcap-haiku.cpp b/pcap-haiku.cpp
index 701cac38..8b0009c5 100644
--- a/pcap-haiku.cpp
+++ b/pcap-haiku.cpp
@@ -160,6 +160,17 @@ pcap_activate_haiku(pcap_t *handle)
handle->getnonblock_op = pcap_getnonblock_fd;
handle->setnonblock_op = pcap_setnonblock_fd;
+ /*
+ * Turn a negative snapshot value (invalid), a snapshot value of
+ * 0 (unspecified), or a value bigger than the normal maximum
+ * value, into the maximum allowed value.
+ *
+ * If some application really *needs* a bigger snapshot
+ * length, we should just increase MAXIMUM_SNAPLEN.
+ */
+ if (handle->snapshot <= 0 || handle->snapshot > MAXIMUM_SNAPLEN)
+ handle->snapshot = MAXIMUM_SNAPLEN;
+
handlep->device = strdup(device);
if (handlep->device == NULL) {
pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
@@ -280,3 +291,12 @@ pcap_platform_finddevs(pcap_if_list_t* _allDevices, char* errorBuffer)
return pcap_findalldevs_interfaces(_allDevices, errorBuffer, can_be_bound,
get_if_flags);
}
+
+/*
+ * Libpcap version string.
+ */
+extern "C" const char *
+pcap_lib_version(void)
+{
+ return (PCAP_VERSION_STRING);
+}