pcap.h

Go to the documentation of this file.
00001 
00017 //\{ 
00018 
00027 typedef void (*pcap_handler)(u_char *user, const struct pcap_pkthdr *pkt_header,
00028                  const u_char *pkt_data);
00029 
00063 pcap_t *pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char *ebuf);
00064 
00065 
00075 pcap_t *pcap_open_dead(int linktype, int snaplen);
00076 
00077 
00091 pcap_t *pcap_open_offline(const char *fname, char *errbuf);
00092 
00105 pcap_dumper_t *pcap_dump_open(pcap_t *p, const char *fname);
00106 
00124 int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf);
00125 
00126 
00136 int pcap_getnonblock(pcap_t *p, char *errbuf);
00137 
00153 int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf);
00154 
00161 void pcap_freealldevs(pcap_if_t *alldevsp);
00162 
00173 char *pcap_lookupdev(char *errbuf);
00174 
00175 
00187 int pcap_lookupnet(const char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp, char *errbuf);
00188 
00227 int pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user);
00228 
00229 
00244 int pcap_loop(pcap_t *p, int cnt, pcap_handler callback, u_char *user);
00245 
00246 
00261 u_char *pcap_next(pcap_t *p, struct pcap_pkthdr *h);
00262 
00279 int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, const u_char **pkt_data);
00280 
00302 void pcap_breakloop(pcap_t *);
00303 
00315 int pcap_sendpacket(pcap_t *p, u_char *buf, int size);  
00316 
00327 void pcap_dump(u_char *user, const struct pcap_pkthdr *h, const u_char *sp);
00328 
00337 long pcap_dump_ftell(pcap_dumper_t *);
00338 
00357 int pcap_compile(pcap_t *p, struct bpf_program *fp, char *str, int optimize, bpf_u_int32 netmask);
00358 
00378 int pcap_compile_nopcap(int snaplen_arg, int linktype_arg, struct bpf_program *program, char *buf, int optimize, bpf_u_int32 mask);
00379 
00380 
00391 int pcap_setfilter(pcap_t *p, struct bpf_program *fp);
00392 
00393 
00404 void pcap_freecode(struct bpf_program *fp);
00405 
00485 int pcap_datalink(pcap_t *p);
00486 
00496 int pcap_list_datalinks(pcap_t *p, int **dlt_buf);
00497 
00500 int pcap_set_datalink(pcap_t *p, int dlt);
00501 
00506 int pcap_datalink_name_to_val(const char *name);
00507 
00511 const char *pcap_datalink_val_to_name(int dlt);
00512 
00516 const char *pcap_datalink_val_to_description(int dlt);
00517 
00518 
00526 int pcap_snapshot(pcap_t *p);
00527 
00528 
00532 int pcap_is_swapped(pcap_t *p);
00533 
00534 
00539 int pcap_major_version(pcap_t *p);
00540 
00541 
00546 int pcap_minor_version(pcap_t *p);
00547 
00562 FILE *pcap_file(pcap_t *p);
00563 
00578 int pcap_stats(pcap_t *p, struct pcap_stat *ps);
00579 
00584 void pcap_perror(pcap_t *p, char *prefix);
00585 
00586 
00596 char *pcap_geterr(pcap_t *p);
00597 
00598 
00604 char *pcap_strerror(int error);
00605 
00610 const char *pcap_lib_version(void);
00611 
00617 void pcap_close(pcap_t *p);
00618 
00620 FILE *pcap_dump_file(pcap_dumper_t *p);
00621 
00626 int pcap_dump_flush(pcap_dumper_t *p);
00627 
00632 void pcap_dump_close(pcap_dumper_t *p);
00633 
00634 //\}
00635 // End of Unix-compatible functions
00636 
00637 
00638 
00639 
00640 
00641 
00642 
00649 //\{ 
00650 
00667 PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);
00668 
00686 bool pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data);
00687 
00712 int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
00713 
00714 
00731 int pcap_live_dump_ended(pcap_t *p, int sync);
00732 
00733 
00757 struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
00758 
00768 int pcap_setbuff(pcap_t *p, int dim);
00769 
00770 
00777 int pcap_setmode(pcap_t *p, int mode);
00778 
00779 
00792 int pcap_setmintocopy(pcap_t *p, int size);
00793 
00794 
00795 
00805 HANDLE pcap_getevent(pcap_t *p);
00806 
00819 pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
00820 
00827 void pcap_sendqueue_destroy(pcap_send_queue* queue);
00828 
00843 int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
00844 
00845 
00869 u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
00870 
00871 
00934 int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
00935 
00936 
00980 int pcap_createsrcstr(char *source, int type, const char *host, const char *port, const char *name, char *errbuf);
00981 
00982 
01038 int pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf);
01039 
01105 pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf);
01106 
01122 struct pcap_samp *pcap_setsampling(pcap_t *p);
01123 
01183 SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf);
01184 
01201 int pcap_remoteact_close(const char *host, char *errbuf);
01202 
01221 void pcap_remoteact_cleanup();
01222 
01243 int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf);
01244 
01245 //\}
01246 // End of Windows-specific extensions
01247 
01248 
01249 

documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2007 CACE Technologies. All rights reserved.