summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/winpcap/docs/html/incs_2pcap_8h_source.html
blob: e265868d60847e0dd456c052b4ca8d9936be1407 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>WinPcap: pcap.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>pcap.h</h1><a href="incs_2pcap_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/*</span>
<a name="l00003"></a>00003 <span class="comment"> * Copyright (c) 1993, 1994, 1995, 1996, 1997</span>
<a name="l00004"></a>00004 <span class="comment"> *  The Regents of the University of California.  All rights reserved.</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00007"></a>00007 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00008"></a>00008 <span class="comment"> * are met:</span>
<a name="l00009"></a>00009 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00010"></a>00010 <span class="comment"> *    notice, this list of conditions and the following disclaimer.</span>
<a name="l00011"></a>00011 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00012"></a>00012 <span class="comment"> *    notice, this list of conditions and the following disclaimer in the</span>
<a name="l00013"></a>00013 <span class="comment"> *    documentation and/or other materials provided with the distribution.</span>
<a name="l00014"></a>00014 <span class="comment"> * 3. All advertising materials mentioning features or use of this software</span>
<a name="l00015"></a>00015 <span class="comment"> *    must display the following acknowledgement:</span>
<a name="l00016"></a>00016 <span class="comment"> *  This product includes software developed by the Computer Systems</span>
<a name="l00017"></a>00017 <span class="comment"> *  Engineering Group at Lawrence Berkeley Laboratory.</span>
<a name="l00018"></a>00018 <span class="comment"> * 4. Neither the name of the University nor of the Laboratory may be used</span>
<a name="l00019"></a>00019 <span class="comment"> *    to endorse or promote products derived from this software without</span>
<a name="l00020"></a>00020 <span class="comment"> *    specific prior written permission.</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS&apos;&apos; AND</span>
<a name="l00023"></a>00023 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="l00024"></a>00024 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
<a name="l00025"></a>00025 <span class="comment"> * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE</span>
<a name="l00026"></a>00026 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span>
<a name="l00027"></a>00027 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span>
<a name="l00028"></a>00028 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
<a name="l00029"></a>00029 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
<a name="l00030"></a>00030 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
<a name="l00031"></a>00031 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
<a name="l00032"></a>00032 <span class="comment"> * SUCH DAMAGE.</span>
<a name="l00033"></a>00033 <span class="comment"> *</span>
<a name="l00034"></a>00034 <span class="comment"> * @(#) $Header: /usr/cvsroot_private/winpcap/dox/libpcap/incs/pcap.h,v 1.5 2005-11-30 21:48:23 gianlucav Exp $ (LBL)</span>
<a name="l00035"></a>00035 <span class="comment"> */</span>
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 
<a name="l00044"></a>00044 <span class="preprocessor">#ifndef lib_pcap_h</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define lib_pcap_h</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;pcap-stdinc.h&gt;</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include &lt;net/bpf.h&gt;</span>
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00054"></a>00054 <span class="preprocessor">#endif</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span>
<a name="l00056"></a><a class="code" href="group__wpcap__def.html#gaac031371d41e21ff96e80409e05a7ddb">00056</a> <span class="preprocessor">#define PCAP_VERSION_MAJOR 2 </span>
<a name="l00057"></a><a class="code" href="group__wpcap__def.html#ga9c200b070c9f626d38184588b16849c2">00057</a> <span class="preprocessor">#define PCAP_VERSION_MINOR 4 </span>
<a name="l00058"></a>00058 <span class="preprocessor"></span>
<a name="l00059"></a><a class="code" href="group__wpcap__def.html#gacd448353957d92c98fccc29e1fc8d927">00059</a> <span class="preprocessor"></span><span class="preprocessor">#define PCAP_ERRBUF_SIZE 256 </span>
<a name="l00060"></a>00060 <span class="preprocessor"></span>
<a name="l00061"></a>00061 <span class="preprocessor"></span>
<a name="l00065"></a>00065 <span class="preprocessor">#if BPF_RELEASE - 0 &lt; 199406</span>
<a name="l00066"></a><a class="code" href="group__wpcap__def.html#ga759c6336c1d9abb462d9248c5ca5c437">00066</a> <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">int</span> <a class="code" href="group__wpcap__def.html#ga759c6336c1d9abb462d9248c5ca5c437" title="32-bit integer">bpf_int32</a>; 
<a name="l00067"></a><a class="code" href="group__wpcap__def.html#ga37fdbc8313e90fb2041203a2e40cd482">00067</a> <span class="keyword">typedef</span> u_int <a class="code" href="group__wpcap__def.html#ga37fdbc8313e90fb2041203a2e40cd482" title="32-bit unsigned integer">bpf_u_int32</a>; 
<a name="l00068"></a>00068 <span class="preprocessor">#endif</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span>
<a name="l00070"></a><a class="code" href="group__wpcap__def.html#ga4711d025f83503ce692efa5e45ec60a7">00070</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>pcap <a class="code" href="group__wpcap__def.html#ga4711d025f83503ce692efa5e45ec60a7" title="Descriptor of an open capture instance. This structure is opaque to the user, that...">pcap_t</a>; 
<a name="l00071"></a><a class="code" href="group__wpcap__def.html#gab8c7858aa3a7e3158d9d58cb113a2ae8">00071</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>pcap_dumper <a class="code" href="group__wpcap__def.html#gab8c7858aa3a7e3158d9d58cb113a2ae8" title="libpcap savefile descriptor.">pcap_dumper_t</a>; 
<a name="l00072"></a><a class="code" href="group__wpcap__def.html#ga3a6e7cbf8d9752da3add4676c7cd4c58">00072</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structpcap__if.html" title="Item in a list of interfaces, used by pcap_findalldevs().">pcap_if</a> <a class="code" href="structpcap__if.html" title="Item in a list of interfaces, used by pcap_findalldevs().">pcap_if_t</a>; 
<a name="l00073"></a><a class="code" href="group__wpcap__def.html#gad5c2e491e2ca9d8eefe4217021c99bdc">00073</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structpcap__addr.html" title="Representation of an interface address, used by pcap_findalldevs().">pcap_addr</a> <a class="code" href="structpcap__addr.html" title="Representation of an interface address, used by pcap_findalldevs().">pcap_addr_t</a>; 
<a name="l00074"></a>00074 
<a name="l00110"></a><a class="code" href="structpcap__file__header.html">00110</a> <span class="keyword">struct </span><a class="code" href="structpcap__file__header.html" title="Header of a libpcap dump file.">pcap_file_header</a> {
<a name="l00111"></a><a class="code" href="structpcap__file__header.html#a18b75bcc7dcee1412b74b57bb238cf3d">00111</a>     bpf_u_int32 <a class="code" href="structpcap__file__header.html#a18b75bcc7dcee1412b74b57bb238cf3d">magic</a>;
<a name="l00112"></a><a class="code" href="structpcap__file__header.html#a571fada6e8ffbb02ad47e64f0f721d4a">00112</a>     u_short <a class="code" href="structpcap__file__header.html#a571fada6e8ffbb02ad47e64f0f721d4a" title="Libpcap major version.">version_major</a>; 
<a name="l00113"></a><a class="code" href="structpcap__file__header.html#a82971bc0da75fef683f826bd48050307">00113</a>     u_short <a class="code" href="structpcap__file__header.html#a82971bc0da75fef683f826bd48050307" title="Libpcap minor version.">version_minor</a>; 
<a name="l00114"></a><a class="code" href="structpcap__file__header.html#ae729a1ba12145c96acbe2bb6310bc7e1">00114</a>     bpf_int32 <a class="code" href="structpcap__file__header.html#ae729a1ba12145c96acbe2bb6310bc7e1" title="gmt to local correction">thiszone</a>; 
<a name="l00115"></a><a class="code" href="structpcap__file__header.html#a209ec264363632ccd21b412c93d2881a">00115</a>     bpf_u_int32 <a class="code" href="structpcap__file__header.html#a209ec264363632ccd21b412c93d2881a" title="accuracy of timestamps">sigfigs</a>;    
<a name="l00116"></a><a class="code" href="structpcap__file__header.html#aa73496b51e5edb630420e4044792c897">00116</a>     bpf_u_int32 <a class="code" href="structpcap__file__header.html#aa73496b51e5edb630420e4044792c897" title="max length saved portion of each pkt">snaplen</a>;    
<a name="l00117"></a><a class="code" href="structpcap__file__header.html#a1c54dd90a08b2c232f2f204bfaa54496">00117</a>     bpf_u_int32 <a class="code" href="structpcap__file__header.html#a1c54dd90a08b2c232f2f204bfaa54496" title="data link type (LINKTYPE_*)">linktype</a>;   
<a name="l00118"></a>00118 };
<a name="l00119"></a>00119 
<a name="l00126"></a><a class="code" href="structpcap__pkthdr.html">00126</a> <span class="keyword">struct </span><a class="code" href="structpcap__pkthdr.html" title="Header of a packet in the dump file.">pcap_pkthdr</a> {
<a name="l00127"></a><a class="code" href="structpcap__pkthdr.html#a21be78b2818c91cb205885b8a6f5aed8">00127</a>     <span class="keyword">struct </span>timeval <a class="code" href="structpcap__pkthdr.html#a21be78b2818c91cb205885b8a6f5aed8" title="time stamp">ts</a>;  
<a name="l00128"></a><a class="code" href="structpcap__pkthdr.html#aac5771ed2efd92508bb4fe650f2ce7d7">00128</a>     bpf_u_int32 <a class="code" href="structpcap__pkthdr.html#aac5771ed2efd92508bb4fe650f2ce7d7" title="length of portion present">caplen</a>; 
<a name="l00129"></a><a class="code" href="structpcap__pkthdr.html#a728f264db4f5cc304742565a2bcdbeea">00129</a>     bpf_u_int32 <a class="code" href="structpcap__pkthdr.html#a728f264db4f5cc304742565a2bcdbeea" title="length this packet (off wire)">len</a>;    
<a name="l00130"></a>00130 };
<a name="l00131"></a>00131 
<a name="l00136"></a><a class="code" href="structpcap__stat.html">00136</a> <span class="keyword">struct </span><a class="code" href="structpcap__stat.html" title="Structure that keeps statistical values on an interface.">pcap_stat</a> {
<a name="l00137"></a><a class="code" href="structpcap__stat.html#a825c8bdb589e7de8e597f6d6f7af8125">00137</a>     u_int <a class="code" href="structpcap__stat.html#a825c8bdb589e7de8e597f6d6f7af8125" title="number of packets transited on the network">ps_recv</a>;      
<a name="l00138"></a><a class="code" href="structpcap__stat.html#a2cfc89d84a0ba404cacfa59f6b112bc1">00138</a>     u_int <a class="code" href="structpcap__stat.html#a2cfc89d84a0ba404cacfa59f6b112bc1" title="number of packets dropped by the driver">ps_drop</a>;      
<a name="l00139"></a><a class="code" href="structpcap__stat.html#abc51be1ec5423e462bde5eac5a9b7c56">00139</a>     u_int <a class="code" href="structpcap__stat.html#abc51be1ec5423e462bde5eac5a9b7c56" title="drops by interface, not yet supported">ps_ifdrop</a>;    
<a name="l00140"></a>00140 <span class="preprocessor">#ifdef WIN32</span>
<a name="l00141"></a><a class="code" href="structpcap__stat.html#a579778ac11d2b5c142ce8bc7ed37bb08">00141</a> <span class="preprocessor"></span>    u_int <a class="code" href="structpcap__stat.html#a579778ac11d2b5c142ce8bc7ed37bb08" title="Win32 specific. number of packets captured, i.e number of packets that are accepted...">bs_capt</a>;      
<a name="l00142"></a>00142 <span class="preprocessor">#endif </span><span class="comment">/* WIN32 */</span>
<a name="l00143"></a>00143 };
<a name="l00144"></a>00144 
<a name="l00148"></a><a class="code" href="structpcap__if.html">00148</a> <span class="keyword">struct </span><a class="code" href="structpcap__if.html" title="Item in a list of interfaces, used by pcap_findalldevs().">pcap_if</a> {
<a name="l00149"></a><a class="code" href="structpcap__if.html#a81508e6e4e41ca4235c8d6b51913c536">00149</a>     <span class="keyword">struct </span><a class="code" href="structpcap__if.html" title="Item in a list of interfaces, used by pcap_findalldevs().">pcap_if</a> *<a class="code" href="structpcap__if.html#a81508e6e4e41ca4235c8d6b51913c536" title="if not NULL, a pointer to the next element in the list; NULL for the last element...">next</a>; 
<a name="l00150"></a><a class="code" href="structpcap__if.html#a5ac083a645d964373f022d03df4849c8">00150</a>     <span class="keywordtype">char</span> *<a class="code" href="structpcap__if.html#a5ac083a645d964373f022d03df4849c8" title="a pointer to a string giving a name for the device to pass to pcap_open_live()">name</a>;     
<a name="l00151"></a><a class="code" href="structpcap__if.html#a8444d6e0dfe2bbab0b5e7b24308f1559">00151</a>     <span class="keywordtype">char</span> *<a class="code" href="structpcap__if.html#a8444d6e0dfe2bbab0b5e7b24308f1559" title="if not NULL, a pointer to a string giving a human-readable description of the device...">description</a>;  
<a name="l00152"></a><a class="code" href="structpcap__if.html#a3910004677550db6d9b09792ba3e2cca">00152</a>     <span class="keyword">struct </span><a class="code" href="structpcap__addr.html" title="Representation of an interface address, used by pcap_findalldevs().">pcap_addr</a> *<a class="code" href="structpcap__if.html#a3910004677550db6d9b09792ba3e2cca" title="a pointer to the first element of a list of addresses for the interface">addresses</a>; 
<a name="l00153"></a><a class="code" href="structpcap__if.html#a304e038dd1326c14b31a206cbad18756">00153</a>     u_int <a class="code" href="structpcap__if.html#a304e038dd1326c14b31a206cbad18756" title="PCAP_IF_ interface flags. Currently the only possible flag is PCAP_IF_LOOPBACK, that...">flags</a>;        
<a name="l00154"></a>00154 };
<a name="l00155"></a>00155 
<a name="l00156"></a><a class="code" href="group__wpcap__def.html#ga43a6601bfd438efc02b0ba71c5439647">00156</a> <span class="preprocessor">#define PCAP_IF_LOOPBACK    0x00000001  </span>
<a name="l00157"></a>00157 <span class="preprocessor"></span>
<a name="l00158"></a>00158 <span class="preprocessor"></span>
<a name="l00161"></a><a class="code" href="structpcap__addr.html">00161</a> <span class="keyword">struct </span><a class="code" href="structpcap__addr.html" title="Representation of an interface address, used by pcap_findalldevs().">pcap_addr</a> {
<a name="l00162"></a><a class="code" href="structpcap__addr.html#ab151e8e96bdb23ae8dd8d644de561999">00162</a>     <span class="keyword">struct </span><a class="code" href="structpcap__addr.html" title="Representation of an interface address, used by pcap_findalldevs().">pcap_addr</a> *<a class="code" href="structpcap__addr.html#ab151e8e96bdb23ae8dd8d644de561999" title="if not NULL, a pointer to the next element in the list; NULL for the last element...">next</a>; 
<a name="l00163"></a><a class="code" href="structpcap__addr.html#a4863f5b8767cd19fe6ea4db75456e5df">00163</a>     <span class="keyword">struct </span>sockaddr *<a class="code" href="structpcap__addr.html#a4863f5b8767cd19fe6ea4db75456e5df" title="a pointer to a struct sockaddr containing an address">addr</a>;      
<a name="l00164"></a><a class="code" href="structpcap__addr.html#ac43963e42e4d901e55e433ab9c3ea686">00164</a>     <span class="keyword">struct </span>sockaddr *<a class="code" href="structpcap__addr.html#ac43963e42e4d901e55e433ab9c3ea686" title="if not NULL, a pointer to a struct sockaddr that contains the netmask corresponding...">netmask</a>;   
<a name="l00165"></a><a class="code" href="structpcap__addr.html#a0077647e1560caa72d457120b36c248c">00165</a>     <span class="keyword">struct </span>sockaddr *<a class="code" href="structpcap__addr.html#a0077647e1560caa72d457120b36c248c" title="if not NULL, a pointer to a struct sockaddr that contains the broadcast address corre�...">broadaddr</a>; 
<a name="l00166"></a><a class="code" href="structpcap__addr.html#a4a32e00e83d4b1b582ba9cef24a5d62a">00166</a>     <span class="keyword">struct </span>sockaddr *<a class="code" href="structpcap__addr.html#a4a32e00e83d4b1b582ba9cef24a5d62a" title="if not NULL, a pointer to a struct sockaddr that contains the destination address...">dstaddr</a>;   
<a name="l00167"></a>00167 };
<a name="l00168"></a>00168 
<a name="l00169"></a>00169 <span class="preprocessor">#if defined(WIN32)</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span>
<a name="l00171"></a>00171 
<a name="l00172"></a><a class="code" href="group__wpcap__def.html#gac93c0a6ad1d2a3143b1115bdab3ac04d">00172</a> <span class="preprocessor">#define MODE_CAPT 0 </span>
<a name="l00173"></a><a class="code" href="group__wpcap__def.html#ga503326906a62e96c147ae6af31fb5659">00173</a> <span class="preprocessor">#define MODE_STAT 1 </span>
<a name="l00174"></a>00174 <span class="preprocessor"></span>
<a name="l00175"></a>00175 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* WIN32 */</span>
<a name="l00176"></a>00176 
<a name="l00177"></a>00177 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span>}
<a name="l00179"></a>00179 <span class="preprocessor">#endif</span>
<a name="l00180"></a>00180 <span class="preprocessor"></span>
<a name="l00181"></a>00181 <span class="preprocessor">#endif</span>
<a name="l00182"></a>00182 <span class="preprocessor"></span>
</pre></div></div>

<hr>
<p align="right"><img border="0" src="winpcap_small.gif" align="absbottom" width="91" height="27">
documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2009
CACE Technologies. All rights reserved.</p>