pcap.h

Go to the documentation of this file.
00001 /* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
00002 /*
00003  * Copyright (c) 1993, 1994, 1995, 1996, 1997
00004  *  The Regents of the University of California.  All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  * 3. All advertising materials mentioning features or use of this software
00015  *    must display the following acknowledgement:
00016  *  This product includes software developed by the Computer Systems
00017  *  Engineering Group at Lawrence Berkeley Laboratory.
00018  * 4. Neither the name of the University nor of the Laboratory may be used
00019  *    to endorse or promote products derived from this software without
00020  *    specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00032  * SUCH DAMAGE.
00033  *
00034  * @(#) $Header: /usr/cvsroot_private/winpcap/dox/libpcap/incs/pcap.h,v 1.5 2005/11/30 21:48:23 gianlucav Exp $ (LBL)
00035  */
00036 
00037 
00044 #ifndef lib_pcap_h
00045 #define lib_pcap_h
00046 
00047 #include <pcap-stdinc.h>
00048 #include <net/bpf.h>
00049 
00050 #include <stdio.h>
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 #define PCAP_VERSION_MAJOR 2 
00057 #define PCAP_VERSION_MINOR 4 
00058 
00059 #define PCAP_ERRBUF_SIZE 256 
00060 
00061 
00065 #if BPF_RELEASE - 0 < 199406
00066 typedef int bpf_int32; 
00067 typedef u_int bpf_u_int32; 
00068 #endif
00069 
00070 typedef struct pcap pcap_t; 
00071 typedef struct pcap_dumper pcap_dumper_t; 
00072 typedef struct pcap_if pcap_if_t; 
00073 typedef struct pcap_addr pcap_addr_t; 
00074 
00110 struct pcap_file_header {
00111     bpf_u_int32 magic;
00112     u_short version_major; 
00113     u_short version_minor; 
00114     bpf_int32 thiszone; 
00115     bpf_u_int32 sigfigs;    
00116     bpf_u_int32 snaplen;    
00117     bpf_u_int32 linktype;   
00118 };
00119 
00126 struct pcap_pkthdr {
00127     struct timeval ts;  
00128     bpf_u_int32 caplen; 
00129     bpf_u_int32 len;    
00130 };
00131 
00136 struct pcap_stat {
00137     u_int ps_recv;      
00138     u_int ps_drop;      
00139     u_int ps_ifdrop;    
00140 #ifdef WIN32
00141     u_int bs_capt;      
00142 #endif /* WIN32 */
00143 };
00144 
00148 struct pcap_if {
00149     struct pcap_if *next; 
00150     char *name;     
00151     char *description;  
00152     struct pcap_addr *addresses; 
00153     u_int flags;        
00154 };
00155 
00156 #define PCAP_IF_LOOPBACK    0x00000001  
00157 
00158 
00161 struct pcap_addr {
00162     struct pcap_addr *next; 
00163     struct sockaddr *addr;      
00164     struct sockaddr *netmask;   
00165     struct sockaddr *broadaddr; 
00166     struct sockaddr *dstaddr;   
00167 };
00168 
00169 #if defined(WIN32)
00170 
00171 
00172 #define MODE_CAPT 0 
00173 #define MODE_STAT 1 
00174 
00175 #endif /* WIN32 */
00176 
00177 #ifdef __cplusplus
00178 }
00179 #endif
00180 
00181 #endif
00182 

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