1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #ifndef CLOSECHANNEL_SOURCE
- #define CLOSECHANNEL_SOURCE
- #include <unistd.h>
- #include <stdlib.h>
- #include "../ether/channel.h"
- signed closechannel (struct channel const * channel)
- {
- #if defined (__linux__)
- return (close (channel->fd));
- #elif defined (__APPLE__) || (__OpenBSD__) || defined (__NetBSD__) || defined (__FreeBSD__)
- free (channel->bpf->bpf_buffer);
- free (channel->bpf);
- return (close (channel->fd));
- #elif defined (WINPCAP) || defined (LIBPCAP)
- pcap_close (channel->socket);
- return (0);
- #else
- #error "Unknown Environment"
- #endif
- }
- #endif
|