Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

# 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
    00486 int pcap_datalink(pcap_t *p);
    00487
    00497 int pcap_list_datalinks(pcap_t *p, int **dlt_buf);
    00498
    00501 int pcap_set_datalink(pcap_t *p, int dlt);
    00502
    00507 int pcap_datalink_name_to_val(const char *name);
    00508
    00512 const char *pcap_datalink_val_to_name(int dlt);
    00513
    00517 const char *pcap_datalink_val_to_description(int dlt);
    00518
    00519
    00527 int pcap_snapshot(pcap_t *p);
    00528
    00529
    00533 int pcap_is_swapped(pcap_t *p);
    00534
    00535
    00540 int pcap_major_version(pcap_t *p);
    00541
    00542
    00547 int pcap_minor_version(pcap_t *p);
    00548
    00563 FILE *pcap_file(pcap_t *p);
    00564
    00579 int pcap_stats(pcap_t *p, struct pcap_stat *ps);
    00580
    00585 void pcap_perror(pcap_t *p, char *prefix);
    00586
    00587
    00597 char *pcap_geterr(pcap_t *p);
    00598
    00599
    00605 char *pcap_strerror(int error);
    00606
    00611 const char *pcap_lib_version(void);
    00612
    00618 void pcap_close(pcap_t *p);
    00619
    00621 FILE *pcap_dump_file(pcap_dumper_t *p);
    00622
    00627 int pcap_dump_flush(pcap_dumper_t *p);
    00628
    00633 void pcap_dump_close(pcap_dumper_t *p);
    00634
    00635 //\}
    00636 // End of Unix-compatible functions
    00637
    00638
    00639
    00640
    00641
    00642
    00643
    00650 //\{
    00651
    00669 bool pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data);
    00670
    00693 int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
    00694
    00695
    00710 int pcap_live_dump_ended(pcap_t *p, int sync);
    00711
    00712
    00736 struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
    00737
    00747 int pcap_setbuff(pcap_t *p, int dim);
    00748
    00749
    00756 int pcap_setmode(pcap_t *p, int mode);
    00757
    00758
    00771 int pcap_setmintocopy(pcap_t *p, int size);
    00772
    00773
    00774
    00784 HANDLE pcap_getevent(pcap_t *p);
    00785
    00798 pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
    00799
    00806 void pcap_sendqueue_destroy(pcap_send_queue* queue);
    00807
    00822 int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
    00823
    00824
    00848 u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
    00849
    00850
    00913 int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
    00914
    00915
    00959 int pcap_createsrcstr(char *source, int type, const char *host, const char *port, const char *name, char *errbuf);
    00960
    00961
    01017 int pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf);
    01018
    01084 pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf);
    01085
    01101 struct pcap_samp *pcap_setsampling(pcap_t *p);
    01102
    01162 SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf);
    01163
    01180 int pcap_remoteact_close(const char *host, char *errbuf);
    01181
    01200 void pcap_remoteact_cleanup();
    01201
    01222 int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf);
    01223
    01224 //\}
    01225 // End of Windows-specific extensions
    01226
    01227
    01228

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