Main Page   Modules   Data Structures   File List   Data Fields   Globals  

pcap.c File Reference

#include <pcap-stdinc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include "pcap-int.h"

Go to the source code of this file.

Data Structures

struct  singleton

Functions

int pcap_dispatch (pcap_t *p, int cnt, pcap_handler callback, u_char *user)
 Collects a group of packets. Returns when cnt packets have been received or when the timeout set with pcap_open_live() expires. More...

int pcap_loop (pcap_t *p, int cnt, pcap_handler callback, u_char *user)
 Collects a group of packets. Returns when cnt packets have been received, but doesn't respect the timeout set with pcap_open_live(), therefore it can block forever. More...

void pcap_oneshot (u_char *userData, const struct pcap_pkthdr *h, const u_char *pkt)
const u_char * pcap_next (pcap_t *p, struct pcap_pkthdr *h)
 Discouraged, use pcap_read_ex() instead.
Returns the next available packet.
More...


int pcap_datalink (pcap_t *p)
 Returns the link layer of an adapter. More...

int pcap_snapshot (pcap_t *p)
 Returns the dimension of the packet portion (in bytes) that is delivered to the application. More...

int pcap_is_swapped (pcap_t *p)
 returns true if the current savefile uses a different byte order than the current system. More...

int pcap_major_version (pcap_t *p)
 returns the major version number of the pcap library used to write the savefile. More...

int pcap_minor_version (pcap_t *p)
 returns the minor version number of the pcap library used to write the savefile. More...

FILE * pcap_file (pcap_t *p)
  Discouraged, use pcap_dump() instead.
Returns the stdio stream of an offile capture.
More...


int pcap_fileno (pcap_t *p)
  Deprecated, handling the device descriptor directly is useless under Win32.
Returns the file descriptor of a capture device.
More...


void pcap_perror (pcap_t *p, char *prefix)
 prints the text of the last pcap library error on stderr, prefixed by prefix. More...

char * pcap_geterr (pcap_t *p)
 returns the error text pertaining to the last pcap library error. More...

int pcap_getnonblock (pcap_t *p, char *errbuf)
 Gets the "non-blocking" state of an interface. More...

int pcap_setnonblock (pcap_t *p, int nonblock, char *errbuf)
 Switches between blocking and nonblocking mode. More...

char * pcap_win32strerror (void)
char * pcap_strerror (int errnum)
 pcap_strerror() is provided in case strerror() isn't available. More...

pcap_tpcap_open_dead (int linktype, int snaplen)
 Creates a pcap_t structure without starting a capture. More...

void pcap_close (pcap_t *p)
 closes the files associated with p and deallocates resources. More...


Variables

const char rcsid []


Function Documentation

void pcap_oneshot u_char *    userData,
const struct pcap_pkthdr   h,
const u_char *    pkt
[static]
 

Definition at line 107 of file pcap.c.

References singleton::hdr, and singleton::pkt.

Referenced by pcap_next.

char* pcap_win32strerror void   
 

Definition at line 284 of file pcap.c.

References errbuf, and PCAP_ERRBUF_SIZE.

Referenced by pcap_findalldevs, pcap_open_live, pcap_setfilter, pcap_setnonblock, and pcap_stats.


Variable Documentation

const char rcsid[] [static]
 

Initial value:

    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.41 2002/08/02 03:44:21 guy Exp $ (LBL)"

Definition at line 35 of file pcap.c.


documentation. Copyright (c) 2002 Politecnico di Torino. All rights reserved.