File: Layers.html

package info (click to toggle)
python-libtrace 1.6%2Bgit20161027-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,124 kB
  • ctags: 1,357
  • sloc: ansic: 6,890; python: 3,228; makefile: 70; sh: 49
file content (235 lines) | stat: -rw-r--r-- 6,338 bytes parent folder | download | duplicates (5)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html><head>



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Layers</title><meta name="generator" content="KompoZer" /><link rel="stylesheet" type="text/css" href="plt-doc.css" /></head><body>
<h2 style="text-align: left;">Header Structure Decodes</h2>
<h3>Looking into each layer of a packet</h3>
<p><span style="font-style: italic;">libtrace's</span> structure decodes (IP, IP6, UDP, TCP, ICMP, ICMP6) are all
retrieved from a Packet by methods belonging to Packet, e.g. TCP =
packet.tcp. &nbsp;However, a <span style="font-family: Courier New,Courier,monospace;">libtrace_packet struct</span> doesn't
have
a way to tell you how many bytes of the structure were actually
captured. &nbsp;Because of that, <span style="font-style: italic;">python-libtrace</span> can't simply return
the data bytes that belong to a structure but are in a part of
it&nbsp;following the fixed-length part, e.g. IP and TCP options, and
IP6 header
extensions.</p>
<p>Instead, <span style="font-style: italic;">python-libtrace</span> uses <span style="font-style: italic;">libtrace's</span> 'get_layer' routines, so that it can
return objects that know how many header bytes were actually captured.
&nbsp;Note that objects may be truncated because on-the-wire they
extended past the SNAPLEN used when the trace was captured. </p>
<h3>Class Layer2</h3>
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="2">Instance
Variables</td>
</tr>
<tr>
<td class="name methodwidth"><strong>linktype</strong></td>
<td class="name descriptionwidth">Link Type for the
trace, see below for values</td>
</tr>

</tbody>
</table>
<br />
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="2">Class Method</td>
</tr>
<tr>
<td class="name methodwidth"><strong>layer2</strong></td>
<td class="name descriptionwidth"><em>Packet.layer2
-&gt;
aNewLayer2</em></td>
</tr>
<tr>
<td><br />
</td>
<td class="description">Returns a Layer2 object,
containing it's link type and header bytes for this packet. </td>
</tr>
</tbody>
</table>
<br />
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="3">Global
Constants</td>
</tr>
<tr>
<td class="name methodwidth"><em>trace types</em></td>
<td class="name" colspan="2">See the libtrace
documentation for more details</td>
</tr>
<tr>
<td><br />
</td>
<td class="c2width"><font size="-1">TRACE_TYPE_ETH</font></td>
<td class="c3width"><font size="-1">802.3-style
Ethernet</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_ATM</font></td>
<td><font size="-1">ATM frames</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_80211</font></td>
<td><font size="-1">802.11 frames</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_NONE</font></td>
<td><font size="-1">Raw IP frames</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_LINUX_SLL</font></td>
<td><font size="-1">Linux "null" framing</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_PFLOG</font></td>
<td><font size="-1">FreeBSD's PFlog</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_DUCK</font></td>
<td><font size="-1">Pseudo link layer for DUCK
packets</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_80211_RADIO</font></td>
<td><font size="-1">Radiotap + 802.11</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_LLCSNAP</font></td>
<td><font size="-1">Raw LLC/SNAP</font></td>
</tr>
<tr>
<td><br />
</td>
<td><font size="-1">TRACE_TYPE_PPP</font></td>
<td><font size="-1">PPP frames</font></td>
</tr>
<tr>
<td><br />
</td>
<td class="description"><font size="-1">TRACE_TYPE_METADATA</font></td>
<td class="description"><font size="-1">WDCAP-style meta-data</font></td>
</tr>
</tbody>
</table>
<br />
<h3>Class Layer3</h3>
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="2">Instance
Variables</td>
</tr>
<tr>
<td class="name methodwidth"><strong>ethertype</strong></td>
<td class="name descriptionwidth">Ethernet Type for
the packet, e.g. 0x0800 = IPv4, 0x08dd = IPv6, 0x080b = ARP, etc.</td>
</tr>

</tbody>
</table>
<br />
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="2">Class Method</td>
</tr>
<tr>
<td class="name methodwidth"><strong>layer3</strong></td>
<td class="name descriptionwidth"><em>Packet.layer3
-&gt;
aNewLayer3</em></td>
</tr>
<tr>
<td><br />
</td>
<td class="description">Returns a Layer3 object,
containing it's link type and header bytes for this packet. </td>
</tr>
</tbody>
</table>
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="2">Class <span style="font-style: italic;">set</span> &nbsp;Method</td>
</tr>
<tr>
<td class="name methodwidth"><strong>set_checksums()</strong></td>
<td class="name descriptionwidth"><em>Layer3.set_checksums
-&gt; True or False</em></td>
</tr>
<tr>
<td><br />
</td>
<td class="description">Computes and sets&nbsp;TCP, UDP and ICMP
checksums for IPv4 and IPv6 packets, and IP checksum for IPv4 packets.
&nbsp;This can be useful when using a Layer3 object to anonymise a
packet.<br /><br />Returns <span style="font-style: italic;">true</span> if the checksums were set;&nbsp; they are set only&nbsp;if the Layer3 object came from a complete packet, i.e. one with <span style="font-style: italic;">capture_len == wire_len.</span></td>
</tr>
</tbody>
</table>
<br />
<h3>Class Transport</h3>
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="2">stringInstance
Variables</td>
</tr>
<tr>
<td class="name methodwidth"><strong>proto</strong></td>
<td class="name descriptionwidth">IP protocol
number, (provided this was an IP or IP6 packet), e.g. 6 = TCP, 17 =
UDP, 1 = ICMP, 58 = ICMP6<br />
</td>
</tr>

</tbody>
</table>
<br />
<table class="indent1">
<tbody>
<tr>
<td class="heading" colspan="2">Class Method</td>
</tr>
<tr>
<td class="name methodwidth"><strong>transport</strong></td>
<td class="name descriptionwidth"><em>Packet.transport-&gt;
aNewTransport</em></td>
</tr>
<tr>
<td><br />
</td>
<td class="description">Returns a Transport object,
containing the protocol number and header bytes for this packet. </td>
</tr>
</tbody>
</table>
<p>
</p><p>Nevil Brownlee<br />Mon, 13 Apr 15 (NZST)</p>
</body></html>