37 #ifndef lib_pcap_pcap_h 38 #define lib_pcap_pcap_h 43 #include <sys/types.h> 44 #include <sys/socket.h> 46 #include <sys/types.h> 50 #ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H 62 #define SOCKET unsigned int 73 #define PCAP_VERSION_MAJOR 2 74 #define PCAP_VERSION_MINOR 4 76 #define PCAP_ERRBUF_SIZE 256 82 #if BPF_RELEASE - 0 < 199406 145 #define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000) 146 #define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28) 147 #define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000) 191 struct pcap_stat_ex {
204 u_long rx_length_errors;
205 u_long rx_over_errors;
206 u_long rx_crc_errors;
207 u_long rx_frame_errors;
208 u_long rx_fifo_errors;
209 u_long rx_missed_errors;
212 u_long tx_aborted_errors;
213 u_long tx_carrier_errors;
214 u_long tx_fifo_errors;
215 u_long tx_heartbeat_errors;
216 u_long tx_window_errors;
231 #define PCAP_IF_LOOPBACK 0x00000001 253 #define PCAP_ERROR -1 254 #define PCAP_ERROR_BREAK -2 255 #define PCAP_ERROR_NOT_ACTIVATED -3 256 #define PCAP_ERROR_ACTIVATED -4 257 #define PCAP_ERROR_NO_SUCH_DEVICE -5 258 #define PCAP_ERROR_RFMON_NOTSUP -6 259 #define PCAP_ERROR_NOT_RFMON -7 260 #define PCAP_ERROR_PERM_DENIED -8 261 #define PCAP_ERROR_IFACE_NOT_UP -9 268 #define PCAP_WARNING 1 269 #define PCAP_WARNING_PROMISC_NOTSUP 2 272 int pcap_lookupnet(
const char *, bpf_u_int32 *, bpf_u_int32 *,
char *);
288 #if !defined(LIBPCAP_EXPORTS) 289 #define pcap_fopen_offline(f,b) \ 290 pcap_hopen_offline(_get_osfhandle(_fileno(f)), b) 319 const char *,
int, bpf_u_int32);
365 int pcap_setbuff(
pcap_t *p,
int dim);
367 int pcap_setmintocopy(
pcap_t *p,
int size);
385 void pcap_set_wait (
pcap_t *p,
void (*yield)(
void),
int wait);
386 u_long pcap_mac_packets (
void);
int pcap_set_buffer_size(pcap_t *, int)
A single BPF pseudo-instruction.
int pcap_stats(pcap_t *, struct pcap_stat *)
int pcap_findalldevs(pcap_if_t **, char *)
char * bpf_image(const struct bpf_insn *, int)
void pcap_free_datalinks(int *)
struct sockaddr * netmask
int pcap_can_set_rfmon(pcap_t *)
int pcap_set_promisc(pcap_t *, int)
void pcap_dump_close(pcap_dumper_t *)
int pcap_setfilter(pcap_t *, struct bpf_program *)
pcap_t * pcap_open_offline(const char *, char *)
struct pcap_dumper pcap_dumper_t
int pcap_set_timeout(pcap_t *, int)
int pcap_setdirection(pcap_t *, pcap_direction_t)
int pcap_datalink_ext(pcap_t *)
int pcap_setnonblock(pcap_t *, int, char *)
int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *)
int pcap_set_snaplen(pcap_t *, int)
int pcap_get_selectable_fd(pcap_t *)
int pcap_fileno(pcap_t *)
char * pcap_geterr(pcap_t *)
pcap_dumper_t * pcap_dump_fopen(pcap_t *, FILE *fp)
const char * pcap_datalink_val_to_name(int)
const u_char * pcap_next(pcap_t *, struct pcap_pkthdr *)
int pcap_datalink_name_to_val(const char *)
const char * pcap_statustostr(int)
int pcap_set_rfmon(pcap_t *, int)
int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **)
int pcap_major_version(pcap_t *)
FILE * pcap_dump_file(pcap_dumper_t *)
A BPF pseudo-assembly program.
pcap_dumper_t * pcap_dump_open(pcap_t *, const char *)
int pcap_getnonblock(pcap_t *, char *)
int pcap_activate(pcap_t *)
int pcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *, const u_char *)
pcap_t * pcap_open_live(const char *, int, int, int, char *)
int pcap_loop(pcap_t *, int, pcap_handler, u_char *)
const char * pcap_datalink_val_to_description(int)
void bpf_dump(const struct bpf_program *, int)
void pcap_breakloop(pcap_t *)
void pcap_close(pcap_t *)
int pcap_is_swapped(pcap_t *)
int pcap_sendpacket(pcap_t *, const u_char *, int)
int bpf_validate(const struct bpf_insn *f, int len)
int pcap_minor_version(pcap_t *)
int pcap_datalink(pcap_t *)
const char * pcap_lib_version(void)
pcap_t * pcap_fopen_offline(FILE *, char *)
long pcap_dump_ftell(pcap_dumper_t *)
void(* pcap_handler)(u_char *, const struct pcap_pkthdr *, const u_char *)
int pcap_list_datalinks(pcap_t *, int **)
FILE * pcap_file(pcap_t *)
int pcap_compile_nopcap(int, int, struct bpf_program *, const char *, int, bpf_u_int32)
char * pcap_lookupdev(char *)
struct pcap_stat * pcap_stats_ex(pcap_t *p, int *pcap_stat_size)
void pcap_perror(pcap_t *, char *)
struct sockaddr * broadaddr
u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int)
int pcap_inject(pcap_t *, const void *, size_t)
int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, bpf_u_int32)
pcap_t * pcap_create(const char *, char *)
void pcap_freecode(struct bpf_program *)
int pcap_set_datalink(pcap_t *, int)
struct sockaddr * dstaddr
int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *)
pcap_t * pcap_open_dead(int, int)
void pcap_freealldevs(pcap_if_t *)
struct pcap_addr * addresses
const char * pcap_strerror(int)
void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *)
int pcap_snapshot(pcap_t *)
int pcap_dump_flush(pcap_dumper_t *)