当前位置: 首页 > 文档资料 > WinPcap 中文手册 >

WinPcap: Win32-Extensions.h Source File

优质
小牛编辑
131浏览
2023-12-01

Go to the documentation of this file.

00001 /*
00002  * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
00003  * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
00004  * 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  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  * notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  * notice, this list of conditions and the following disclaimer in the
00014  * documentation and/or other materials provided with the distribution.
00015  * 3. Neither the name of the Politecnico di Torino, CACE Technologies 
00016  * nor the names of its contributors may be used to endorse or promote 
00017  * products derived from this software without specific prior written 
00018  * permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00023  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00024  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00025  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00026  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00027  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00028  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00030  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  *
00032  */
00033 
00034 #ifndef __WIN32_EXTENSIONS_H__
00035 #define __WIN32_EXTENSIONS_H__
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 /* Definitions */
00042 
00046 struct pcap_send_queue
00047 {
00048     u_int maxlen;       
00049     u_int len;          
00050     char *buffer;       
00051 };
00052 
00053 typedef struct pcap_send_queue pcap_send_queue;
00054 
00058 #if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
00059 #define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
00060 typedef struct _AirpcapHandle *PAirpcapHandle;
00061 #endif
00062 
00063 #define     BPF_MEM_EX_IMM  0xc0
00064 #define     BPF_MEM_EX_IND  0xe0
00065 
00066 /*used for ST*/
00067 #define     BPF_MEM_EX      0xc0
00068 #define     BPF_TME                 0x08
00069 
00070 #define     BPF_LOOKUP              0x90   
00071 #define     BPF_EXECUTE             0xa0
00072 #define     BPF_INIT                0xb0
00073 #define     BPF_VALIDATE            0xc0
00074 #define     BPF_SET_ACTIVE          0xd0
00075 #define     BPF_RESET               0xe0
00076 #define     BPF_SET_MEMORY          0x80
00077 #define     BPF_GET_REGISTER_VALUE  0x70
00078 #define     BPF_SET_REGISTER_VALUE  0x60
00079 #define     BPF_SET_WORKING         0x50
00080 #define     BPF_SET_ACTIVE_READ     0x40
00081 #define     BPF_SET_AUTODELETION    0x30
00082 #define     BPF_SEPARATION          0xff
00083 
00084 /* Prototypes */
00085 pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
00086 
00087 void pcap_sendqueue_destroy(pcap_send_queue* queue);
00088 
00089 int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
00090 
00091 u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
00092 
00093 HANDLE pcap_getevent(pcap_t *p);
00094 
00095 struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
00096 
00097 int pcap_setuserbuffer(pcap_t *p, int size);
00098 
00099 int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
00100 
00101 int pcap_live_dump_ended(pcap_t *p, int sync);
00102 
00103 int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data);
00104 
00105 int pcap_start_oem(char* err_str, int flags);
00106 
00107 PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);
00108 
00109 #ifdef __cplusplus
00110 }
00111 #endif
00112 
00113 #endif //__WIN32_EXTENSIONS_H__