This file is indexed.

/usr/share/doc/python-pcapy/pcapy.html is in python-pcapy 0.10.8-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Part I. Pcapy Reference</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><meta name="keywords" content="pcap, packet, capture, python"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="part" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2478659"></a>Part I. Pcapy Reference</h1></div><div><h3 class="corpauthor">CORE SECURITY TECHNOLOGIES</h3></div><div><p class="copyright">Copyright © 2003 CORE SECURITY TECHNOLOGIES</p></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr><tr><td align="left">Revision $Revision: 15 $</td><td align="left">$Date: 2003-10-23 14:24:27 -0300 (Jue, 23 Oct 2003) $</td><td align="left">$Author: jkohen $</td></tr><tr><td align="left" colspan="3">Initial revision</td></tr></table></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="reference"><a href="#id2516741">I. Pcapy Module Reference</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="#id2516746">open_live</a></span><span class="refpurpose"> &#8212; Obtain a packet capture descriptor to look at packets on the network</span></dt><dt><span class="refentrytitle"><a href="#id2478772">open_offline</a></span><span class="refpurpose"> &#8212; Obtain a packet capture descriptor to look at packets on a <em class="glossterm">savefile</em></span></dt><dt><span class="refentrytitle"><a href="#id2478050">lookupdev</a></span><span class="refpurpose"> &#8212; Return a network device suitable for use with
	  <code class="function">open_live</code></span></dt><dt><span class="refentrytitle"><a href="#id2478114">findalldevs</a></span><span class="refpurpose"> &#8212; Obtain the list of available network devices</span></dt><dt><span class="refentrytitle"><a href="#id2483035">compile</a></span><span class="refpurpose"> &#8212; Compile a BPF filter</span></dt></dl></dd><dt><span class="reference"><a href="#id2478329">II. Reader Object Reference</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="#id2478333">dispatch</a></span><span class="refpurpose"> &#8212; Collect and process packets</span></dt><dt><span class="refentrytitle"><a href="#id2482554">next</a></span><span class="refpurpose"> &#8212; Collect the next packet</span></dt><dt><span class="refentrytitle"><a href="#id2482666">setfilter</a></span><span class="refpurpose"> &#8212; Specify a filter</span></dt><dt><span class="refentrytitle"><a href="#id2482722">getnet</a></span><span class="refpurpose"> &#8212; Get the associated network number and mask</span></dt><dt><span class="refentrytitle"><a href="#id2525980">datalink</a></span><span class="refpurpose"> &#8212; Obtain the link layer type</span></dt><dt><span class="refentrytitle"><a href="#id2526809">getnonblock</a></span><span class="refpurpose"> &#8212; Manipulate the
	  <em class="firstterm">non&#8211;blocking</em> flag</span></dt><dt><span class="refentrytitle"><a href="#id2526958">dump_open</a></span><span class="refpurpose"> &#8212; Create a Dumper object</span></dt></dl></dd><dt><span class="reference"><a href="#id2527039">III. Dumper Object Reference</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="#id2527043">dump</a></span><span class="refpurpose"> &#8212; Dump a packet to a <em class="glossterm">savefile</em></span></dt></dl></dd><dt><span class="reference"><a href="#id2527116">IV. Pkthdr Object Reference</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="#id2527121">getts</a></span><span class="refpurpose"> &#8212; Obtain packet header information</span></dt></dl></dd><dt><span class="reference"><a href="#id2527233">V. Bpf Object Reference</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="#id2527238">filter</a></span><span class="refpurpose"> &#8212; Test a packet against a compiled filter</span></dt></dl></dd><dt><span class="bibliography"><a href="#id2527316">Bibliography</a></span></dt></dl></div><div class="reference" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2516741"></a>Pcapy Module Reference</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="refentrytitle"><a href="#id2516746">open_live</a></span><span class="refpurpose"> &#8212; Obtain a packet capture descriptor to look at packets on the network</span></dt><dt><span class="refentrytitle"><a href="#id2478772">open_offline</a></span><span class="refpurpose"> &#8212; Obtain a packet capture descriptor to look at packets on a <em class="glossterm">savefile</em></span></dt><dt><span class="refentrytitle"><a href="#id2478050">lookupdev</a></span><span class="refpurpose"> &#8212; Return a network device suitable for use with
	  <code class="function">open_live</code></span></dt><dt><span class="refentrytitle"><a href="#id2478114">findalldevs</a></span><span class="refpurpose"> &#8212; Obtain the list of available network devices</span></dt><dt><span class="refentrytitle"><a href="#id2483035">compile</a></span><span class="refpurpose"> &#8212; Compile a BPF filter</span></dt></dl></div><div class="refentry" lang="en"><a name="id2516746"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>open_live &#8212; Obtain a packet capture descriptor to look at packets on the network</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">Reader <b class="fsfunc">open_live</b>(</code></td><td><var class="pdparam">device</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">snaplen</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">promisc</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">to_ms</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">device</var>;</code></td></tr><tr><td><code>int </code> </td><td><code><var class="pdparam">snaplen</var>;</code></td></tr><tr><td><code>int </code> </td><td><code><var class="pdparam">promisc</var>;</code></td></tr><tr><td><code>int </code> </td><td><code><var class="pdparam">to_ms</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2478673"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">open_live</code> is used to obtain a packet
	  capture descriptor to look at packets on the network.
	  <em class="parameter"><code>device</code></em> is a string that specifies the
	  network device to open; on Linux systems with 2.2 or later
	  kernels, a device argument of <code class="literal">any</code> or
	  <code class="constant">NULL</code> can be used to capture packets
	  from all interfaces. <em class="parameter"><code>snaplen</code></em>
	  specifies the maximum number of bytes to capture.
	  <em class="parameter"><code>promisc</code></em> specifies if the interface is
	  to be put into promiscuous mode. (Note that even if this
	  parameter is false, the interface could well be in
	  promiscuous mode for some other reason.) For now, this
	  doesn't work on the <code class="literal">any</code> device; if an
	  argument of <code class="literal">any</code> or
	  <code class="constant">NULL</code> is supplied, the
	  <em class="parameter"><code>promisc</code></em> flag is ignored.
	  <em class="parameter"><code>to_ms</code></em> specifies the read timeout in
	  milliseconds. The read timeout is used to arrange that the
	  read not necessarily return immediately when a packet is
	  seen, but that it wait for some amount of time to allow more
	  packets to arrive and to read multiple packets from the OS
	  kernel in one operation. Not all platforms support a read
	  timeout; on platforms that don't, the read timeout is
	  ignored.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2478772"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>open_offline &#8212; Obtain a packet capture descriptor to look at packets on a <em class="glossterm">savefile</em></p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">Reader <b class="fsfunc">open_offline</b>(</code></td><td><var class="pdparam">filename</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">filename</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2477988"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">open_offline</code> is called to open a
	  <em class="glossterm">savefile</em> for reading. <em class="parameter"><code>filename</code></em>
	  specifies the name of the file to open. The file has the
	  same format as those used by
	  <span class="citerefentry"><span class="refentrytitle">tcpdump</span>(8)</span> and
	  <span class="citerefentry"><span class="refentrytitle">tcpslice</span>(8)</span>. The name
	  <code class="filename">-</code> is a synonym for
	  <code class="filename">stdin</code>.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2478050"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>lookupdev &#8212; Return a network device suitable for use with
	  <code class="function">open_live</code></p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">string <b class="fsfunc">lookupdev</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2478089"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">lookupdev</code> returns the name of a network
	  device suitable for use with <code class="function">open_live</code>.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2478114"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>findalldevs &#8212; Obtain the list of available network devices</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">string[] <b class="fsfunc">findalldevs</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2482999"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">findalldevs</code> constructs a list of
	  network devices that can be opened with
	  <code class="function">open_live</code>. (Note that there may be
	  network devices that cannot be opened with
	  <code class="function">open_live</code>, because, for example, that
	  process might not have sufficient privileges to open them
	  for capturing; if so, those devices will not appear on the
	  list.)
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2483035"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>compile &#8212; Compile a BPF filter</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">Bpf <b class="fsfunc">compile</b>(</code></td><td><var class="pdparam">linktype</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">snaplen</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">filter</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">optimize</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">netmask</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>int </code> </td><td><code><var class="pdparam">linktype</var>;</code></td></tr><tr><td><code>int </code> </td><td><code><var class="pdparam">snaplen</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">filter</var>;</code></td></tr><tr><td><code>int </code> </td><td><code><var class="pdparam">optimize</var>;</code></td></tr><tr><td><code>int32 </code> </td><td><code><var class="pdparam">netmask</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2483106"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">compile</code> is used to compile the
	  <em class="parameter"><code>filter</code></em> into a filter program.
	  <code class="function">snaplen</code> specifies the maximum number of
	  bytes to capture. <em class="parameter"><code>optimize</code></em> controls
	  whether optimization on the resulting code is performed.
	  <em class="parameter"><code>netmask</code></em> specifies the netmask of the
	  local network.
	</p></div></div></div><div class="reference" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2478329"></a>Reader Object Reference</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="refentrytitle"><a href="#id2478333">dispatch</a></span><span class="refpurpose"> &#8212; Collect and process packets</span></dt><dt><span class="refentrytitle"><a href="#id2482554">next</a></span><span class="refpurpose"> &#8212; Collect the next packet</span></dt><dt><span class="refentrytitle"><a href="#id2482666">setfilter</a></span><span class="refpurpose"> &#8212; Specify a filter</span></dt><dt><span class="refentrytitle"><a href="#id2482722">getnet</a></span><span class="refpurpose"> &#8212; Get the associated network number and mask</span></dt><dt><span class="refentrytitle"><a href="#id2525980">datalink</a></span><span class="refpurpose"> &#8212; Obtain the link layer type</span></dt><dt><span class="refentrytitle"><a href="#id2526809">getnonblock</a></span><span class="refpurpose"> &#8212; Manipulate the
	  <em class="firstterm">non&#8211;blocking</em> flag</span></dt><dt><span class="refentrytitle"><a href="#id2526958">dump_open</a></span><span class="refpurpose"> &#8212; Create a Dumper object</span></dt></dl></div><div class="refentry" lang="en"><a name="id2478333"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>dispatch, loop &#8212; Collect and process packets</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">int <b class="fsfunc">dispatch</b>(</code></td><td><var class="pdparam">maxcant</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">(* callback)</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code>int </code> </td><td><code><var class="pdparam">maxcant</var>;</code></td></tr><tr><td><code>void </code> </td><td><code><var class="pdparam">(* callback)</var><code>(</code>Pkthdr, string<code>)</code>;</code></td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">int <b class="fsfunc">loop</b>(</code></td><td><var class="pdparam">maxcant</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">(* callback)</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>int </code> </td><td><code><var class="pdparam">maxcant</var>;</code></td></tr><tr><td><code>void </code> </td><td><code><var class="pdparam">(* callback)</var><code>(</code>Pkthdr, string<code>)</code>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2478419"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">dispatch</code> is used to collect and process
	  packets. <em class="parameter"><code>maxcant</code></em> specifies the
	  maximum number of packets to process before returning. This
	  is not a minimum number; when reading a live capture, only
	  one bufferful of packets is read at a time, so fewer than
	  <em class="parameter"><code>maxcant</code></em> packets may be processed. A
	  <em class="parameter"><code>cnt</code></em> of <code class="literal">-1</code>
	  processes all the packets received in one buffer when
	  reading a live capture, or all the packets in the file when
	  reading a <em class="glossterm">savefile</em>. <em class="parameter"><code>callback</code></em>
	  specifies a routine to be called with two arguments: a
	  <code class="classname">Pkthdr</code> instance describing the data
	  passed and the data itself.
	</p><p>
	  The number of packets read is returned.
	  <span class="returnvalue">0</span> is returned if no packets were
	  read from a live capture (if, for example, they were
	  discarded because they didn't pass the packet filter, or if,
	  on platforms that support a read timeout that starts before
	  any packets arrive, the timeout expires before any  packets
	  arrive, or if the file descriptor for the capture device is
	  in non&#8211;blocking mode and no packets were available to be
	  read) or if no more packets are available in a <em class="glossterm">savefile</em>.
	</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
	    When reading a live capture, <code class="function">dispatch</code>
	    will not necessarily return when the read times out; on
	    some platforms, the read timeout isn't supported, and, on
	    other platforms, the timer doesn't start until at least
	    one packet arrives. This means that the read timeout
	    should <span class="emphasis"><em>not</em></span> be used in, for example,
	    an interactive application, to allow the packet capture
	    loop to poll for user input periodically, as there's no
	    guarantee that <code class="function">dispatch</code> will return
	    after the timeout expires.
	  </p></div><p>
	  <code class="function">loop</code> is similar to
	  <code class="function">dispatch</code> except it keeps reading
	  packets until <em class="parameter"><code>maxcant</code></em> packets are
	  processed or an error occurs. It does
	  <span class="emphasis"><em>not</em></span> return when live read timeouts
	  occur. Rather, specifying a non&#8211;zero read timeout to
	  <code class="function">open_live</code> and then calling
	  <code class="function">dispatch</code> allows the reception and
	  processing of any packets that arrive when the timeout
	  occurs. A negative <em class="parameter"><code>maxcant</code></em> causes
	  <code class="function">loop</code> to loop forever (or at least until
	  an error occurs). <span class="returnvalue">0</span> is returned
	  if <em class="parameter"><code>maxcant</code></em> is exhausted.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2482554"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>next &#8212; Collect the next packet</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">(Pkthdr, string) <b class="fsfunc">next</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2482586"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">next</code> reads the next packet (by calling
	  <code class="function">dispatch</code> with a
	  <em class="parameter"><code>maxcant</code></em> of <code class="constant">1</code>)
	  and returns a tuple (header, data) where
	  <em class="parameter"><code>header</code></em> is a
	  <code class="classname">Pkthdr</code> instance describing the data
	  passed and <em class="parameter"><code>data</code></em> is the data itself.
	</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
	    If the packet could not be read, a tuple is returned
	    anyway but with <em class="parameter"><code>header</code></em>
	    and <em class="parameter"><code>data</code></em> equal respectively
	    to <code class="constant">None</code> and an empty string.
	  </p></div></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2482666"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>setfilter &#8212; Specify a filter</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"><b class="fsfunc">setfilter</b>(</code></td><td><var class="pdparam">filter</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">filter</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2482703"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">setfilter</code> is used to specify a filter
	  for this object.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2482722"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>getnet, getmask &#8212; Get the associated network number and mask</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">int32 <b class="fsfunc">getnet</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">int32 <b class="fsfunc">getmask</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2482775"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">getnet</code> and <code class="function">getmask</code>
	  are used to determine the network number and mask associated
	  with the network device attached to this
	  <code class="classname">Reader</code>.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2525980"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>datalink &#8212; Obtain the link layer type</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">int <b class="fsfunc">datalink</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2526011"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">datalink</code> returns the link layer type; link layer types it can return include:
	  </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">DLT_NULL</code></span></dt><dd><p>
		  <acronym class="acronym">BSD</acronym> loopback encapsulation; the
		  link layer header is a 4&#8211;byte field, in host
		  byte order, containing a <code class="constant">PF_</code>
		  value from <code class="filename">socket.h</code> for the
		  network&#8211;layer protocol of the packet.
		</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
		    &#8220;<span class="quote">host byte order</span>&#8221; is the byte order
		    of the machine on which the packets are captured,
		    and the <code class="constant">PF_</code> values are for
		    the <acronym class="acronym">OS</acronym> of the machine on which
		    the packets are captured; if a live capture is
		    being done, &#8220;<span class="quote">host byte order</span>&#8221; is the
		    byte order of the machine capturing the packets,
		    and the <code class="constant">PF_</code> values are those
		    of the <acronym class="acronym">OS</acronym> of the machine
		    capturing the packets, but if a <em class="glossterm">savefile</em> is being
		    read, the byte order and <code class="constant">PF_</code>
		    values are <span class="emphasis"><em>not</em></span> necessarily
		    those of the machine reading the capture file.
		  </p></div></dd><dt><span class="term"><code class="constant">DLT_EN10MB</code></span></dt><dd>Ethernet (10Mb, 100Mb, 1000Mb, and up)</dd><dt><span class="term"><code class="constant">DLT_IEEE802</code></span></dt><dd><acronym class="acronym">IEEE</acronym> 802.5 Token Ring</dd><dt><span class="term"><code class="constant">DLT_ARCNET</code></span></dt><dd><acronym class="acronym">ARCNET</acronym></dd><dt><span class="term"><code class="constant">DLT_SLIP</code></span></dt><dd><p>
		  <acronym class="acronym">SLIP</acronym>; the link layer header contains, in order:
		  </p><div class="itemizedlist"><ul type="disc"><li>
			a 1&#8211;byte flag, which is
			<code class="literal">0</code> for packets received by
			the machine and <code class="literal">1</code> for
			packets sent by the machine.
		      </li><li><p>
			a 1&#8211;byte field, the upper 4 bits of which indicate the type of packet, as per <acronym class="acronym">RFC</acronym> 1144:

			</p><div class="itemizedlist"><ul type="circle"><li>
			      <code class="literal">0x40</code>; an unmodified
			      <acronym class="acronym">IP</acronym> datagram
			      (<code class="constant">TYPE_IP</code>)
			    </li><li>
			      <code class="literal">0x70</code>; an
			      uncompressed&#8211;<acronym class="acronym">TCP/IP</acronym>
			      datagram
			      (<code class="constant">UNCOMPRESSED_TCP</code>),
			      with that byte being the first byte of
			      the raw <acronym class="acronym">IP</acronym> header on
			      the wire, containing the connection
			      number in the protocol field
			    </li><li>
			      <code class="literal">0x80</code>; a
			      compressed&#8211;<acronym class="acronym">TCP/IP</acronym>
			      datagram
			      (<code class="constant">COMPRESSED_TCP</code>),
			      with that byte being the first byte of
			      the compressed <acronym class="acronym">TCP/IP</acronym>
			      datagram header
			    </li></ul></div><p>
		      </p></li><li>
			for <code class="constant">UNCOMPRESSED_TCP</code>, the
			rest of the modified <acronym class="acronym">IP</acronym>
			header, and for
			<code class="constant">COMPRESSED_TCP</code>, the
			compressed <acronym class="acronym">TCP/IP</acronym> datagram
			header
		      </li></ul></div><p>
		  for a total of 16 bytes; the uncompressed <acronym class="acronym">IP</acronym> datagram follows the header.
		</p></dd><dt><span class="term"><code class="constant">DLT_PPP</code></span></dt><dd>
		  <acronym class="acronym">PPP</acronym>; if the first 2 bytes are
		  <code class="literal">0xff</code> and <code class="literal">0x03</code>,
		  it's <acronym class="acronym">PPP</acronym> in
		  <acronym class="acronym">HDLC</acronym>&#8211;like framing, with the
		  <acronym class="acronym">PPP</acronym> header following those two
		  bytes, otherwise it's <acronym class="acronym">PPP</acronym> without
		  framing, and the packet begins with the
		  <acronym class="acronym">PPP</acronym> header.
		</dd><dt><span class="term"><code class="constant">DLT_FDDI</code></span></dt><dd><acronym class="acronym">FDDI</acronym></dd><dt><span class="term"><code class="constant">DLT_ATM_RFC1483</code></span></dt><dd>
		  <acronym class="acronym">RFC</acronym> 1483
		  <acronym class="acronym">LLC/SNAP</acronym>&#8211;encapsulated
		  <acronym class="acronym">ATM</acronym>; the packet begins with an
		  <acronym class="acronym">IEEE</acronym> 802.2 <acronym class="acronym">LLC</acronym>
		  header.
		</dd><dt><span class="term"><code class="constant">DLT_RAW</code></span></dt><dd>
		  Raw <acronym class="acronym">IP</acronym>; the packet begins with an
		  <acronym class="acronym">IP</acronym> header.
		</dd><dt><span class="term"><code class="constant">DLT_PPP_SERIAL</code></span></dt><dd>
		  <acronym class="acronym">PPP</acronym> in
		  <acronym class="acronym">HDLC</acronym>&#8211;like framing, as per
		  <acronym class="acronym">RFC</acronym> 1662, or Cisco
		  <acronym class="acronym">PPP</acronym> with <acronym class="acronym">HDLC</acronym>
		  framing, as per section §4.3.1 of
		  <acronym class="acronym">RFC</acronym> 1547; the first byte will be
		  <code class="literal">0xFF</code> for <acronym class="acronym">PPP</acronym>
		  in <acronym class="acronym">HDLC</acronym>&#8211;like framing, and
		  will be <code class="literal">0x0F</code> or
		  <code class="literal">0x8F</code> for Cisco
		  <acronym class="acronym">PPP</acronym> with <acronym class="acronym">HDLC</acronym>
		  framing.
		</dd><dt><span class="term"><code class="constant">DLT_PPP_ETHER</code></span></dt><dd>
		  <acronym class="acronym">PPPoE</acronym>; the packet begins with a
		  <acronym class="acronym">PPPoE</acronym> header, as per
		  <acronym class="acronym">RFC</acronym> 2516.
		</dd><dt><span class="term"><code class="constant">DLT_C_HDLC</code></span></dt><dd>
		  Cisco <acronym class="acronym">PPP</acronym> with
		  <acronym class="acronym">HDLC</acronym> framing, as per section
		  § 4.3.1 of <acronym class="acronym">RFC</acronym> 1547.
		</dd><dt><span class="term"><code class="constant">DLT_IEEE802_11</code></span></dt><dd>
		  <acronym class="acronym">IEEE</acronym> 802.11 wireless
		  <acronym class="acronym">LAN</acronym>.
		</dd><dt><span class="term"><code class="constant">DLT_LOOP</code></span></dt><dd><p>
		  OpenBSD loopback encapsulation; the link layer
		  header is a 4&#8211;byte field, in network byte
		  order, containing a <code class="constant">PF_</code> value
		  from OpenBSD's <code class="filename">socket.h</code> for the
		  network&#8211;layer protocol of the packet.
		</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
		    Note that, if a <em class="glossterm">savefile</em> is being read, those
		    <code class="constant">PF_</code> values are
		    <span class="emphasis"><em>not</em></span> necessarily those of the
		    machine reading the capture file.
		  </p></div></dd><dt><span class="term"><code class="constant">DLT_LINUX_SLL</code></span></dt><dd><p>
		  Linux cooked capture encapsulation; the link layer
		  header contains, in order:

		  </p><div class="itemizedlist"><ul type="disc"><li><p>
			a 2&#8211;byte "packet  type",  in  network
			byte order, which is one of:

			</p><div class="itemizedlist"><ul type="circle"><li>
			      <code class="literal">0</code>; packet was sent to
			      us by somebody else.
			    </li><li>
			      <code class="literal">1</code>; packet was
			      broadcast by somebody else.
			    </li><li>
			      <code class="literal">2</code>; packet was
			      multicast, but not broadcast, by
			      somebody else.
			    </li><li>
			      <code class="literal">3</code>; packet was sent by
			      somebody else to somebody else.
			    </li><li>
			      <code class="literal">4</code>; packet was sent by
			      us.
			    </li></ul></div><p>
		      </p></li><li>
			a 2&#8211;byte field, in network byte order,
			containing a Linux
			<code class="constant">ARPHRD_</code> value for the
			link layer device type.
		      </li><li>
			a 2&#8211;byte field, in network byte order,
			containing the length of the link layer
			address of the sender of the packet (which
			could be 0).
		      </li><li>
			an 8&#8211;byte field containing that number
			of bytes of the link layer header (if there
			are more than 8 bytes, only the first 8 are
			present).
		      </li><li>
			a 2&#8211;byte field containing an Ethernet
			protocol type, in network byte order, or
			containing <code class="literal">1</code> for Novell
			802.3 frames without an 802.2
			<acronym class="acronym">LLC</acronym> header or
			<code class="literal">4</code> for frames beginning with
			an 802.2 <acronym class="acronym">LLC</acronym> header.
		      </li></ul></div><p>
		</p></dd><dt><span class="term"><code class="constant">DLT_LTALK</code></span></dt><dd>
		  Apple LocalTalk; the packet begins with an AppleTalk
		  <acronym class="acronym">LLAP</acronym> header.
		</dd></dl></div><p>
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2526809"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>getnonblock, setnonblock &#8212; Manipulate the
	  <em class="firstterm">non&#8211;blocking</em> flag</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">int <b class="fsfunc">getnonblock</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"><b class="fsfunc">setnonblock</b>(</code></td><td><var class="pdparam">state</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>int </code> </td><td><code><var class="pdparam">state</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2526867"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">getnonblock</code> returns the current
	  non&#8211;blocking state of the capture descriptor; it
	  always returns <span class="returnvalue">0</span> on <em class="glossterm">savefile</em>s.
	</p></div><div class="refsect1" lang="en"><a name="id2526892"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">setnonblock</code> puts a capture descriptor,
	  opened with <code class="function">open_live</code>, into
	  non&#8211;blocking mode, or takes it out of
	  non&#8211;blocking mode, depending on whether the
	  <em class="parameter"><code>state</code></em> argument is non&#8211;zero or
	  zero. It has no effect on <em class="glossterm">savefile</em>s. In non&#8211;blocking
	  mode, an attempt to read from the capture descriptor with
	  <code class="function">dispatch</code> will, if no packets are
	  currently available to be read, return
	  <span class="returnvalue">0</span> immediately rather than
	  blocking waiting for packets to arrive.
	  <code class="function">loop</code> and <code class="function">next</code> will
	  not work in non&#8211;blocking mode.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id2526958"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>dump_open &#8212; Create a Dumper object</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">Dumper <b class="fsfunc">dump_open</b>(</code></td><td><var class="pdparam">filename</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">filename</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2526994"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">dump_open</code> is called to open a <em class="glossterm">savefile</em>
	  for writing and associate it to a newly created
	  <code class="classname">Dumper</code> instance. The name
	  <code class="filename">-</code> is a synonym for <code class="filename">stdout</code>.
	  <em class="parameter"><code>filename</code></em> specifies the name of the
	  file to open.
	</p></div></div></div><div class="reference" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2527039"></a>Dumper Object Reference</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="refentrytitle"><a href="#id2527043">dump</a></span><span class="refpurpose"> &#8212; Dump a packet to a <em class="glossterm">savefile</em></span></dt></dl></div><div class="refentry" lang="en"><a name="id2527043"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>dump &#8212; Dump a packet to a <em class="glossterm">savefile</em></p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"><b class="fsfunc">dump</b>(</code></td><td><var class="pdparam">header</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">data</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>Pkthdr </code> </td><td><code><var class="pdparam">header</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">data</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2527088"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">dump</code> outputs a packet to the <em class="glossterm">savefile</em>
	  opened with <code class="function">dump_open</code> from type
	  <code class="classname">Reader</code>.
	</p></div></div></div><div class="reference" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2527116"></a>Pkthdr Object Reference</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="refentrytitle"><a href="#id2527121">getts</a></span><span class="refpurpose"> &#8212; Obtain packet header information</span></dt></dl></div><div class="refentry" lang="en"><a name="id2527121"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>getts, getcaplen, getlen &#8212; Obtain packet header information</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">(long, long) <b class="fsfunc">getts</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">long <b class="fsfunc">getcaplen</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">long <b class="fsfunc">getlen</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2527190"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">getts</code>, <code class="function">getcaplen</code>
	  and <code class="function">getlen</code> return the timestamp,
	  capture length and total length fields of the packet header,
	  respectively.
	</p><p>
	  Timestamp is a tuple with two elements: the number of
	  seconds since the Epoch, and the amount of microseconds past
	  the current second. The capture length is the number of
	  bytes of the packet that are available from the capture.
	  Finally, total length gives the length of the packet, in
	  bytes (which might be more than the number of bytes
	  available from the capture, if the length of the packet is
	  larger than the maximum number of bytes to capture).
	</p></div></div></div><div class="reference" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2527233"></a>Bpf Object Reference</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="refentrytitle"><a href="#id2527238">filter</a></span><span class="refpurpose"> &#8212; Test a packet against a compiled filter</span></dt></dl></div><div class="refentry" lang="en"><a name="id2527238"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>filter &#8212; Test a packet against a compiled filter</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">int <b class="fsfunc">filter</b>(</code></td><td><var class="pdparam">packet</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">packet</var>;</code></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id2527274"></a><h2>DESCRIPTION</h2><p>
	  <code class="function">filter</code> tests a packet against a
	  compiled filter as returned by
	  <code class="classname">pcapy</code>'s <code class="function">compile</code>.
	  If the packet is allowed to pass through
	  <span class="returnvalue">-1</span> is returned, otherwise
	  <code class="function">filter</code> returns
	  <span class="returnvalue">0</span>.
	</p></div></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a name="id2527316"></a>Bibliography</h2></div></div></div><div class="bibliodiv"><h3 class="title">Sources</h3><div class="biblioentry"><a name="id2527326"></a><p><span class="bibliomisc">
	  Portions of this work based on
	  <span class="citerefentry"><span class="refentrytitle">pcap</span>(3)</span> by the Lawrence
	  Berkeley National Laboratory, University of California,
	  Berkeley, CA.
	. </span></p></div></div></div></div></body></html>