diff options
Diffstat (limited to 'pcap-haiku.cpp')
-rw-r--r-- | pcap-haiku.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pcap-haiku.cpp b/pcap-haiku.cpp index 8b0009c5..d9234f04 100644 --- a/pcap-haiku.cpp +++ b/pcap-haiku.cpp @@ -47,12 +47,11 @@ prepare_request(struct ifreq& request, const char* name) static int -pcap_read_haiku(pcap_t* handle, int maxPackets, pcap_handler callback, +pcap_read_haiku(pcap_t* handle, int maxPackets _U_, pcap_handler callback, u_char* userdata) { // Receive a single packet - struct pcap_haiku* handlep = (struct pcap_haiku*)handle->priv; u_char* buffer = (u_char*)handle->buffer + handle->offset; struct sockaddr_dl from; ssize_t bytesReceived; @@ -80,7 +79,7 @@ pcap_read_haiku(pcap_t* handle, int maxPackets, pcap_handler callback, return -1; } - int32 captureLength = bytesReceived; + int32_t captureLength = bytesReceived; if (captureLength > handle->snapshot) captureLength = handle->snapshot; @@ -249,7 +248,11 @@ pcap_create_interface(const char *device, char *errorBuffer) return NULL; } - pcap_t* handle = PCAP_CREATE_COMMON(errorBuffer, struct pcap_haiku); + struct wrapper_struct { pcap_t __common; struct pcap_haiku __private; }; + pcap_t* handle = pcap_create_common(errorBuffer, + sizeof (struct wrapper_struct), + offsetof (struct wrapper_struct, __private)); + if (handle == NULL) { snprintf(errorBuffer, PCAP_ERRBUF_SIZE, "malloc: %s", strerror(errno)); close(socket); @@ -265,7 +268,7 @@ pcap_create_interface(const char *device, char *errorBuffer) } static int -can_be_bound(const char *name) +can_be_bound(const char *name _U_) { return 1; } |