ratojakuf
ratojakuf

Reputation: 738

What structure pcap_t have?

Where the definition of pcap_t? I just found typedef struct pcap pcap_t; in pcap.h but pcap havn't definition there and wincap manual have same problem without description of this or may be i didn't find right. If this on library then may be someone can tell possible structure?

Upvotes: 1

Views: 9445

Answers (1)

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181350

This is one possible answer (here's the source):

struct pcap {
    int fd;
    int snapshot;
    int linktype;
    int tzoff;      /* timezone offset */
    int offset;     /* offset for proper alignment */

    struct pcap_sf sf;
    struct pcap_md md;

    /*
     * Read buffer.
     */
    int bufsize;
    u_char *buffer;
    u_char *bp;
    int cc;

    /*
     * Place holder for pcap_next().
     */
    u_char *pkt;


    /*
     * Placeholder for filter code if bpf not in kernel.
     */
    struct bpf_program fcode;

    char errbuf[PCAP_ERRBUF_SIZE];
};

Upvotes: 3

Related Questions