1335640Shselasky<HTML><HEAD>
2335640Shselasky<STYLE type="text/css">
3335640Shselasky<!--
4335640ShselaskyA { text-decoration:none }
5335640Shselasky-->
6335640Shselasky</STYLE>
7335640Shselasky</HEAD>
8335640Shselasky<BODY>
9335640Shselasky
10335640Shselasky<TABLE WIDTH=100%><TR>
11335640Shselasky	<TD ALIGN=LEFT VALIGN=TOP>
12335640Shselasky		<FONT SIZE=+0 FACE="COURIER"><B>A "Distributed Pcap" for<BR>Remote Monitoring LANs & WANs</B><BR>
13335640Shselasky										(Design Notes for the SITA ACN device)</FONT>
14335640Shselasky	</TD>
15335640Shselasky	<TD ALIGN=RIGHT VALIGN=TOP>
16335640Shselasky		Fulko Hew<BR>SITA INC Canada, Inc.<BR>Revised: October 2, 2007
17335640Shselasky	</TD>
18335640Shselasky</TR></TABLE>
19335640Shselasky
20335640Shselasky
21335640Shselasky<H3>SUMMARY</H3>
22335640Shselasky<UL>
23335640Shselasky	<STRONG>Note:</STRONG> This document is part of the libpcap Git and was derived from 'pcap.3' (circa Aug/07).
24335640Shselasky	<P>
25335640Shselasky	The ACN provides a customized/distributed version of this library that alows SMPs to
26335640Shselasky	interact with the various IOPs within the site providing a standard mechanism
27335640Shselasky	to capture LAN and WAN message traffic.
28335640Shselasky	<P>
29335640Shselasky	<CENTER>
30335640Shselasky		<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3 WIDTH=75%>
31335640Shselasky			<TR>
32335640Shselasky				<TH VALIGN=TOP>SMP</TH>
33335640Shselasky				<TD VALIGN=TOP>The Supervisory Management Processor where Wireshark (or equivalent)
34335640Shselasky								runs in conjuction with a libpcap front-end.</TD>
35335640Shselasky			</TR>
36335640Shselasky			<TR>
37335640Shselasky				<TH VALIGN=TOP>IOP</TH>
38335640Shselasky				<TD VALIGN=TOP>I/O Processors where the monitored ports exist in conjunction
39335640Shselasky								with a custom device driver/libpcap back-end.</TD>
40335640Shselasky			</TR>
41335640Shselasky		</TABLE>
42335640Shselasky	</CENTER>
43335640Shselasky	<P>
44335640Shselasky	Each IOP will be capable of supporting multiple connections from an SMP
45335640Shselasky	enabling monitoring of more than one interface at a time, each through
46335640Shselasky	its own seperate connection.  The IOP is responsible to ensure and report
47335640Shselasky	an error if any attempt is made to monitor the same interface more than once.
48335640Shselasky	<P>
49335640Shselasky	There are three applications that will be supported by the ACN version of libpcap.
50335640Shselasky	They each use a slightly different mode for looping/capturing and termination
51335640Shselasky	as summarized in the following table:
52335640Shselasky	<P>
53335640Shselasky	<CENTER>
54335640Shselasky	<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
55335640Shselasky    	<TR><TH>Application</TH>	<TH>Capture</TH>	<TH>Termination</TH></TR>
56335640Shselasky    	<TR><TH VALIGN=TOP NOWRAP>wireshark</TH>
57335640Shselasky			<TD VALIGN=TOP>pcap_dispatch(all packets in one buffer of capture only)</TD>
58335640Shselasky			<TD VALIGN=TOP>pcap_breakloop()</TD>
59335640Shselasky		</TR>
60335640Shselasky    	<TR><TH VALIGN=TOP NOWRAP>tshark</TH>
61335640Shselasky			<TD VALIGN=TOP>pcap_dispatch(one buffer of capture only)</TD>
62335640Shselasky			<TD VALIGN=TOP>Since a CTRL-C was used to terminate the application, pcap_breakloop() is never called.</TD>
63335640Shselasky		</TR>
64335640Shselasky    	<TR><TH VALIGN=TOP NOWRAP>tcpdump</TH>
65335640Shselasky			<TD VALIGN=TOP>pcap_loop(all packets in the next buffer, and loop forever)</TD>
66335640Shselasky			<TD VALIGN=TOP>pcap_breakloop()</TD>
67335640Shselasky		</TR>
68335640Shselasky	</TABLE>
69335640Shselasky	</CENTER>
70335640Shselasky	<P>
71335640Shselasky	<B>Note: </B>In all cases, the termination of capturing is always (apparently) followed by
72335640Shselasky	pcap_close().  Pcap_breakloop() is only used to stop/suspend looping/processing,
73335640Shselasky	and upon close interpretation of the function definitions, it is possible to resume
74335640Shselasky	capturing following a pcap_breakloop() without any re-initialization.
75335640Shselasky	<P>
76335640Shselasky	<H4>ACN Limitations</H4>
77335640Shselasky	<OL>
78335640Shselasky		<LI>Monitoring of backup IOPs is not currently supported.
79335640Shselasky		<LI>Ethernet interfaces cannot be monitored in promiscuous mode.
80335640Shselasky	</OL>
81335640Shselasky
82335640Shselasky</UL>
83335640Shselasky
84335640Shselasky<H3>ROUTINES</H3>
85335640Shselasky<UL>
86335640Shselasky		The following list of functions is the sub-set of Pcap functions that have been
87335640Shselasky		altered/enhanced to support the ACN remote monitoring facility.  The remainder of the Pcap
88335640Shselasky		functions continue to perform their duties un-altered.  Libpcap only supports this
89335640Shselasky		mode of operation if it has been configured/compiled for SITA/ACN support.
90335640Shselasky		<P>
91335640Shselasky		<UL><FONT FACE=COURIER>
92335640Shselasky			pcap_findalldevs<BR>
93335640Shselasky			pcap_freealldevs<BR>
94335640Shselasky			pcap_open_live<BR>
95335640Shselasky			pcap_close<BR>
96335640Shselasky			pcap_setfilter<BR>
97335640Shselasky			pcap_dispatch<BR>
98335640Shselasky			pcap_loop<BR>
99335640Shselasky			pcap_next<BR>
100335640Shselasky			pcap_next_ex<BR>
101335640Shselasky			pcap_stats<BR>
102335640Shselasky		</FONT></UL>
103335640Shselasky
104335640Shselasky	These subroutines have been modified for the ACN specific distributed and remote monitoring
105335640Shselasky	ability perform the following basic functions.  More detail is provided in the
106335640Shselasky	"SMP/IOP Inter-Process Communication Protocol" section.
107335640Shselasky	<P>
108335640Shselasky<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
109335640Shselasky	<TR>
110335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_open_live()</B></TD>
111335640Shselasky		<TD VALIGN=TOP>Used to obtain a packet capture descriptor to look at packets on the network.</TD>
112335640Shselasky	</TR>
113335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
114335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
115335640Shselasky			<TD>
116335640Shselasky			The SMP will open a connection to the selected IOP on its 'sniffer' port
117335640Shselasky			to ensure it is available.  It sends a null terminated string identifying
118335640Shselasky			the interface to be monitored.
119335640Shselasky			</TD>
120335640Shselasky		</TR>
121335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
122335640Shselasky			<TD>
123335640Shselasky			After any required processing is complete, the IOP will return a
124335640Shselasky			null terminated string containing an error message if one occured.
125335640Shselasky			If no error occured, a empty string is still returned.
126335640Shselasky			Errors are:
127335640Shselasky			<UL>
128335640Shselasky			<LI>"Interface (xxx) does not exist."
129335640Shselasky			<LI>"Interface (xxx) not configured."
130335640Shselasky			<LI>"Interface (xxx) already being monitored."
131335640Shselasky			</UL>
132335640Shselasky			</TD>
133335640Shselasky		</TR>
134335640Shselasky	</TABLE></TD></TR>
135335640Shselasky
136335640Shselasky	<TR>
137335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_findalldevs()</B></TD>
138335640Shselasky		<TD VALIGN=TOP>It constructs a list of network devices that can be opened with pcap_open_live().</TD>
139335640Shselasky	</TR>
140335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
141335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
142335640Shselasky			<TD>
143335640Shselasky			It obtains a list of IOPs currently available (via /etc/hosts).
144335640Shselasky			</TD>
145335640Shselasky		</TR>
146335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
147335640Shselasky			<TD>
148335640Shselasky			The SMP will sequentially open a connection to each IOP on its 'sniffer' port to ensure
149335640Shselasky			the IOP is available.
150335640Shselasky			It sends a null terminated empty interface ID followed by the query request command.
151335640Shselasky			</TD>
152335640Shselasky		</TR>
153335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
154335640Shselasky			<TD>The IOP returns an error response and its list of devices.
155335640Shselasky			</TD>
156335640Shselasky		</TR>
157335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
158335640Shselasky			<TD>
159335640Shselasky			The SMP closes the TCP connection with each IOP.
160335640Shselasky			</TD>
161335640Shselasky		</TR>
162335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
163335640Shselasky			<TD>
164335640Shselasky			The SMP adds the received information to its internal structure.
165335640Shselasky			</TD>
166335640Shselasky		</TR>
167335640Shselasky	</TABLE></TD></TR>
168335640Shselasky
169335640Shselasky	<TR>
170335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_freealldevs()</B></TD>
171335640Shselasky		<TD VALIGN=TOP>Used to free a list allocated by pcap_findalldevs().</TD>
172335640Shselasky	</TR>
173335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
174335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
175335640Shselasky			<TD>
176335640Shselasky			The SMP frees the structure it built as a result of the previous
177335640Shselasky			invocation of pcap_findalldevs().
178335640Shselasky			</TD>
179335640Shselasky		</TR>
180335640Shselasky	</TABLE></TD></TR>
181335640Shselasky
182335640Shselasky	<TR>
183335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_dispatch()</B></TD>
184335640Shselasky		<TD VALIGN=TOP>Used to collect and process packets.</TD>
185335640Shselasky	</TR>
186335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
187335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
188335640Shselasky			<TD>
189335640Shselasky			On the first invocation of pcap_dispatch(), pcap_loop(), or pcap_next(), or pcap_next_ex() following a pcap_open_live(),
190335640Shselasky			the SMP will pass down the monitor start command and various parameters the IOP should use.
191335640Shselasky			</TD>
192335640Shselasky		</TR>
193335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
194335640Shselasky			<TD>
195335640Shselasky			The IOP now sends a stream of captured data.
196335640Shselasky			</TD>
197335640Shselasky		</TR>
198335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
199335640Shselasky			<TD>
200335640Shselasky			The SMP will read the reverse channel of the connection between the SMP and the
201335640Shselasky			IOP that provides the captured data (via 'p->read_op' which is 'pcap_read_linux()'
202335640Shselasky			until the select() call returns a 'no more data' indication.
203335640Shselasky			It will the process (at most) the next 'cnt' packets and invoke the specified
204335640Shselasky			callback function for each packet processed.
205335640Shselasky			</TD>
206335640Shselasky		</TR>
207335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP</TH>
208335640Shselasky			<TD>
209335640Shselasky			The IOP continues to listen for additional commands as well as capturing and forwarding data to the SMP.
210335640Shselasky			</TD>
211335640Shselasky		</TR>
212335640Shselasky	</TABLE></TD></TR>
213335640Shselasky
214335640Shselasky	<TR>
215335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_loop()</B></TD>
216335640Shselasky		<TD VALIGN=TOP>
217335640Shselasky				Is similar to pcap_dispatch() except it keeps reading packets until
218335640Shselasky				the requested number of packets are processed or an error occurs.
219335640Shselasky		</TD>
220335640Shselasky	</TR>
221335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
222335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
223335640Shselasky			<TD>
224335640Shselasky			On the first invocation of pcap_dispatch(), pcap_loop(), or pcap_next(), or pcap_next_ex() following a pcap_open_live(),
225335640Shselasky			the SMP will pass down the monitor start command and various parameters the IOP should use.
226335640Shselasky			</TD>
227335640Shselasky		</TR>
228335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
229335640Shselasky			<TD>
230335640Shselasky			The IOP now sends a stream of captured data.
231335640Shselasky			</TD>
232335640Shselasky		</TR>
233335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
234335640Shselasky			<TD>
235335640Shselasky			The SMP continuously reads the next packet from the reverse channel of the connection
236335640Shselasky			between the SMP and the IOP that provides the captured data (via 'p->read_op'
237335640Shselasky			which is 'pcap_read_linux()' until 'cnt' packets have been received.
238335640Shselasky			The specified callback function will be invoked for each packet received.
239335640Shselasky			</TD>
240335640Shselasky		</TR>
241335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP</TH>
242335640Shselasky			<TD>
243335640Shselasky			The IOP continues to listen for additional commands as well as capturing and forwarding data to the SMP.
244335640Shselasky			</TD>
245335640Shselasky		</TR>
246335640Shselasky	</TABLE></TD></TR>
247335640Shselasky
248335640Shselasky	<TR>
249335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_next()</B></TD>
250335640Shselasky		<TD VALIGN=TOP>
251335640Shselasky			It reads the next packet (by calling pcap_dispatch() with a count of 1)
252335640Shselasky			and returns a pointer to the data in that packet.
253335640Shselasky		</TD>
254335640Shselasky	</TR>
255335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
256335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
257335640Shselasky			<TD>
258335640Shselasky			On the first invocation of pcap_dispatch(), pcap_loop(), or pcap_next(), or pcap_next_ex() following a pcap_open_live(),
259335640Shselasky			the SMP will pass down the monitor start command and various parameters the IOP should use.
260335640Shselasky			</TD>
261335640Shselasky		</TR>
262335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
263335640Shselasky			<TD>
264335640Shselasky			The IOP now sends a stream of captured data.
265335640Shselasky			</TD>
266335640Shselasky		</TR>
267335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
268335640Shselasky			<TD>
269335640Shselasky			The SMP reads only the next packet from the reverse channel of the connection
270335640Shselasky			between the SMP and the IOP that provides the captured data (via calling pcap_dispatch()
271335640Shselasky			with a count of 1) and returns a pointer to that data by invoking an internal callback.
272335640Shselasky			</TD>
273335640Shselasky		</TR>
274335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP</TH>
275335640Shselasky			<TD>
276335640Shselasky			The IOP continues to listen for additional commands as well as capturing and forwarding data to the SMP.
277335640Shselasky			</TD>
278335640Shselasky		</TR>
279335640Shselasky	</TABLE></TD></TR>
280335640Shselasky
281335640Shselasky	<TR>
282335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_next_ex()</B></TD>
283335640Shselasky		<TD VALIGN=TOP>Reads the next packet and returns a success/failure indication.</TD>
284335640Shselasky	</TR>
285335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
286335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
287335640Shselasky			<TD>
288335640Shselasky			On the first invocation of pcap_dispatch(), pcap_loop(), or pcap_next(), or pcap_next_ex() following a pcap_open_live(),
289335640Shselasky			the SMP will pass down the monitor start command and various parameters the IOP should use.
290335640Shselasky			</TD>
291335640Shselasky		</TR>
292335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
293335640Shselasky			<TD>
294335640Shselasky			The IOP now sends a stream of captured data.
295335640Shselasky			</TD>
296335640Shselasky		</TR>
297335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
298335640Shselasky			<TD>
299335640Shselasky			The SMP reads only the next packet from the reverse channel of the connection
300335640Shselasky			between the SMP and the IOP that provides the captured data (via calling pcap_dispatch()
301335640Shselasky			with a count of 1) and returns seperate pointers to both the
302335640Shselasky			packet header and packet data by invoking an internal callback.
303335640Shselasky			</TD>
304335640Shselasky		</TR>
305335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP</TH>
306335640Shselasky			<TD>
307335640Shselasky			The IOP continues to listen for additional commands as well as capturing and forwarding data to the SMP.
308335640Shselasky			</TD>
309335640Shselasky		</TR>
310335640Shselasky	</TABLE></TD></TR>
311335640Shselasky
312335640Shselasky	<TR>
313335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_setfilter()</B></TD>
314335640Shselasky        <TD VALIGN=TOP>Used to specify a filter program.</TD>
315335640Shselasky	</TR>
316335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
317335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
318335640Shselasky			<TD>
319335640Shselasky			The SMP sends a 'set filter' command followed by the BPF commands.
320335640Shselasky			</TD>
321335640Shselasky		</TR>
322335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
323335640Shselasky			<TD>
324335640Shselasky			The IOP returns a null terminated error string if it failed to accept the filter.
325335640Shselasky			If no error occured, then a NULL terminated empty string is returned instead.
326335640Shselasky			Errors are:
327335640Shselasky			<UL>
328335640Shselasky			<LI>"Invalid BPF."
329335640Shselasky			<LI>"Insufficient resources for BPF."
330335640Shselasky			</UL>
331335640Shselasky			</TD>
332335640Shselasky		</TR>
333335640Shselasky	</TABLE></TD></TR>
334335640Shselasky
335335640Shselasky	<TR>
336335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_stats()</B></TD>
337335640Shselasky        <TD VALIGN=TOP>Fills in a pcap_stat struct with packet statistics.</TD>
338335640Shselasky	</TR>
339335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
340335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
341335640Shselasky			<TD>
342335640Shselasky			The SMP sends a message to the IOP requesting its statistics.
343335640Shselasky			</TD>
344335640Shselasky		</TR>
345335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP -> SMP</TH>
346335640Shselasky			<TD>
347335640Shselasky			The IOP returns the statistics.
348335640Shselasky			</TD>
349335640Shselasky		</TR>
350335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP</TH>
351335640Shselasky			<TD>
352335640Shselasky			The SMP fills in the structure provided with the information retrieved from the IOP.
353335640Shselasky			</TD>
354335640Shselasky		</TR>
355335640Shselasky	</TABLE></TD></TR>
356335640Shselasky
357335640Shselasky	<TR>
358335640Shselasky		<TD VALIGN=TOP ROWSPAN=2><B>pcap_close()</B></TD>
359335640Shselasky        <TD VALIGN=TOP>Closes the file and deallocates resources.</TD>
360335640Shselasky	</TR>
361335640Shselasky	<TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100%>
362335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>SMP -> IOP</TH>
363335640Shselasky			<TD>
364335640Shselasky			The SMP closes the file descriptor, and if the descriptor is that of
365335640Shselasky			the comminucation session with an IOP, it too is terminated.
366335640Shselasky			</TD>
367335640Shselasky		</TR>
368335640Shselasky		<TR><TH VALIGN=TOP NOWRAP>IOP</TH>
369335640Shselasky			<TD>
370335640Shselasky			If the IOP detects that its communication session with an SMP
371335640Shselasky			has closed, it will terminate any monitoring in progress,
372335640Shselasky			release any resources and close its end of the session.
373335640Shselasky			It will not maintain persistance of any information or prior mode of operation.
374335640Shselasky			</TD>
375335640Shselasky		</TR>
376335640Shselasky	</TABLE></TD></TR>
377335640Shselasky</TABLE>
378335640Shselasky</UL>
379335640Shselasky
380335640Shselasky<P>
381335640Shselasky<H3>SMP/IOP Inter-Process Communication Protocol</H3>
382335640Shselasky
383335640Shselasky<UL>
384335640Shselasky	<LI><P>Communications between an SMP and an IOP consists of a TCP session
385335640Shselasky			between an ephemeral port on the SMP and the well known port of 49152
386335640Shselasky			(which is the first available port in the 'dynamic and/or private port'
387335640Shselasky			range) on an IOP.
388335640Shselasky	<LI><P>Following a TCP open operation the IOP receives a null terminated
389335640Shselasky			'interface ID' string to determine the type of operation that follows:
390335640Shselasky	<LI><P>Every command received by an IOP implies a 'stop trace/stop forwarding' operation must
391335640Shselasky			occur before executing the received command.
392335640Shselasky	<LI><P>A session is closed when the SMP closes the TCP session with the IOP.
393335640Shselasky			Obviously monitoring and forwarding is also stopped at that time.
394335640Shselasky
395335640Shselasky	<B>Note: </B>All multi-octet entities are sent in network neutral order.
396335640Shselasky	<P>
397335640Shselasky
398335640Shselasky	<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5>
399335640Shselasky		<TR><TH COLSPAN=3><HR WIDTH=100%></TH></TR>
400335640Shselasky		<TR>
401335640Shselasky			<TD VALIGN=TOP ROWSPAN=6>pcap_findalldevs()</TD>
402335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
403335640Shselasky			<TD VALIGN=TOP>Open socket (to each IOP), and sends:
404335640Shselasky				<P>
405335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
406335640Shselasky					<TR>
407335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
408335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
409335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
410335640Shselasky					</TR>
411335640Shselasky					<TR>
412335640Shselasky						<TD VALIGN=TOP>Interface ID</TD>
413335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
414356341Scy						<TD VALIGN=TOP>A NULL to indicate an empty 'interface ID'.</TD>
415335640Shselasky					</TR>
416335640Shselasky				</TABLE>
417335640Shselasky			</TD>
418335640Shselasky		</TR>
419335640Shselasky		<TR>
420335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>IOP -> SMP</TD>
421335640Shselasky			<TD VALIGN=TOP>Send its (possibly empty) NULL terminated error response string.</TD>
422335640Shselasky		</TR>
423335640Shselasky		<TR>
424335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
425335640Shselasky			<TD VALIGN=TOP>Sends the 'interface query request':
426335640Shselasky				<P>
427335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
428335640Shselasky					<TR>
429335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
430335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
431335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
432335640Shselasky					</TR>
433335640Shselasky					<TR>
434335640Shselasky						<TD VALIGN=TOP>Interface ID</TD>
435335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
436335640Shselasky						<TD VALIGN=TOP>A 'Q' (indicating 'interface query request').</TD>
437335640Shselasky					</TR>
438335640Shselasky				</TABLE>
439335640Shselasky			</TD>
440335640Shselasky		</TR>
441335640Shselasky		<TR>
442335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>IOP -> SMP</TD>
443335640Shselasky			<TD VALIGN=TOP>The IOP returns a list of sequences of information as
444335640Shselasky				defined by the return parameter of this function call (as shown in the following table).
445335640Shselasky				Elements are specified by providing an unsigned byte preceeding the actual data that contains length information.
446335640Shselasky				<P>
447335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
448335640Shselasky				<TR>
449335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Notes:</TH>
450335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
451335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
452335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
453335640Shselasky				</TR>
454335640Shselasky				<TR>
455335640Shselasky					<TD ROWSPAN=7>&nbsp;</TD>
456335640Shselasky					<TD VALIGN=TOP ALIGN=RIGHT>length</TD>
457335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
458335640Shselasky					<TD VALIGN=TOP>The number of octets in the name field that follows.</TD>
459335640Shselasky				</TR>
460335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Name</TD>
461335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1-255</TD>
462335640Shselasky					<TD VALIGN=TOP>The name of the interface. The format of the name is an alphabetic string (indicating
463335640Shselasky									the type of interface) followed by an optional numeric string (indicating the interface's
464335640Shselasky									sequence number).
465335640Shselasky									Sequence numbers (if needed) will begin at zero and progress monotonically upwards.
466335640Shselasky									(i.e. 'eth0', 'lo', 'wan0', etc.)
467335640Shselasky									<P>
468335640Shselasky									For an IOP, the alphabetic string will be one of: 'eth', 'wan', and 'lo'
469335640Shselasky									for Ethernet, WAN ports and the IP loopback device respectively.
470335640Shselasky									An IOP currently supports: 'eth0', 'eth1', 'lo', 'wan0' ... 'wan7'.
471335640Shselasky									<P>
472335640Shselasky						<B>Note:</B> IOPs and ACNs will not currently support the concept of 'any' interface.</TD>
473335640Shselasky				</TR>
474335640Shselasky				<TR><TD VALIGN=TOP ALIGN=RIGHT>length</TD>
475335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
476335640Shselasky					<TD VALIGN=TOP>The number of octets in the interface description field that follows.</TD>
477335640Shselasky				</TR>
478335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Interface Description</TD>
479335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>0-255</TD>
480335640Shselasky					<TD VALIGN=TOP>A description of the interface or it may be an empty string. (i.e. 'ALC')</TD>
481335640Shselasky				</TR>
482335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Interface Type</TD>
483335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>4</TD>
484335640Shselasky					<TD VALIGN=TOP>The type of interface as defined in the description for pcap_datalink() (in network neutral order).</TD>
485335640Shselasky				</TR>
486335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Loopback Flag</TD>
487335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
488335640Shselasky					<TD VALIGN=TOP>1 = if the interface is a loopback interface, zero = otherwise.</TD>
489335640Shselasky				</TR>
490335640Shselasky				<TR><TD VALIGN=TOP ALIGN=RIGHT>count</TD>
491335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
492335640Shselasky					<TD VALIGN=TOP># of address entries that follow.
493335640Shselasky						Each entry is a series of bytes in network neutral order.
494335640Shselasky						See the parameter definition above for more details.</TD>
495335640Shselasky				</TR>
496335640Shselasky				<TR>
497335640Shselasky					<TD ALIGN=CENTER ROWSPAN=8 WIDTH=1%>Repeated 'count' number of times.</TD>
498335640Shselasky					<TD VALIGN=TOP ALIGN=RIGHT>length</TD>
499335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
500335640Shselasky					<TD VALIGN=TOP>The number of octets in the address field that follows.</TD>
501335640Shselasky				</TR>
502335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Address</TD>
503335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1-255</TD>
504335640Shselasky					<TD VALIGN=TOP>The address of this interface (in network neutral order).</TD>
505335640Shselasky				</TR>
506335640Shselasky				<TR><TD VALIGN=TOP ALIGN=RIGHT>length</TD>
507335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
508335640Shselasky					<TD VALIGN=TOP>The number of octets in the netmask field that follows.</TD>
509335640Shselasky				</TR>
510335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Network Mask</TD>
511335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>0-255</TD>
512335640Shselasky					<TD VALIGN=TOP>The network mask used on this interface (if applicable) (in network neutral order).</TD>
513335640Shselasky				</TR>
514335640Shselasky				<TR><TD VALIGN=TOP ALIGN=RIGHT>length</TD>
515335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
516335640Shselasky					<TD VALIGN=TOP>The number of octets in the broadcast address field that follows.</TD>
517335640Shselasky				</TR>
518335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Broadcast Address</TD>
519335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>0-255</TD>
520335640Shselasky					<TD VALIGN=TOP>The broadcast address of this interface (if applicable) (in network neutral order).</TD>
521335640Shselasky				</TR>
522335640Shselasky				<TR><TD VALIGN=TOP ALIGN=RIGHT>length</TD>
523335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>1</TD>
524335640Shselasky					<TD VALIGN=TOP>The number of octets in the destination address field that follows.</TD>
525335640Shselasky				</TR>
526335640Shselasky				<TR><TD VALIGN=TOP ALIGN=LEFT>Destination Address</TD>
527335640Shselasky					<TD VALIGN=TOP ALIGN=CENTER>0-255</TD>
528335640Shselasky					<TD VALIGN=TOP>The destination address of this interface (if applicable) (in network neutral order).</TD>
529335640Shselasky				</TR>
530335640Shselasky				</TABLE>
531335640Shselasky		</TR>
532335640Shselasky		<TR>
533335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
534335640Shselasky			<TD VALIGN=TOP>Close the socket.</TD>
535335640Shselasky		</TR>
536335640Shselasky		<TR>
537335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>IOP -> SMP</TD>
538335640Shselasky			<TD VALIGN=TOP>Close the socket.</TD>
539335640Shselasky		</TR>
540335640Shselasky		<TR><TH COLSPAN=3><HR WIDTH=100%></TH></TR>
541335640Shselasky		<TR>
542335640Shselasky			<TD VALIGN=TOP ROWSPAN=2>pcap_open_live()</TD>
543335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
544335640Shselasky			<TD VALIGN=TOP>Open socket, and sends:
545335640Shselasky				<P>
546335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
547335640Shselasky					<TR>
548335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
549335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
550335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
551335640Shselasky					</TR>
552335640Shselasky					<TR>
553335640Shselasky						<TD VALIGN=TOP>Interface ID</TD>
554335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>'n'</TD>
555335640Shselasky						<TD VALIGN=TOP>'n' octets containing a NULL terminated interface name string.</TD>
556335640Shselasky					</TR>
557335640Shselasky				</TABLE>
558335640Shselasky			</TD>
559335640Shselasky		</TR>
560335640Shselasky		<TR>
561335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>IOP -> SMP</TD>
562335640Shselasky			<TD VALIGN=TOP>Send its NULL terminated error response string.</TD>
563335640Shselasky		</TR>
564335640Shselasky		<TR><TH COLSPAN=3><HR WIDTH=100%></TH></TR>
565335640Shselasky		<TR>
566335640Shselasky			<TD VALIGN=TOP NOWRAP ROWSPAN=2>pcap_dispatch()<BR>pcap_loop()<BR>pcap_next()<BR>pcap_next_ex()</TD>
567335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
568335640Shselasky			<TD VALIGN=TOP>On the first invocation following a pcap_open_live() or pcap_breakloop() additional information is sent:
569335640Shselasky				<P>
570335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
571335640Shselasky					<TR>
572335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
573335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
574335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
575335640Shselasky					</TR>
576335640Shselasky					<TR>
577335640Shselasky						<TD VALIGN=TOP>command</TD>
578335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
579335640Shselasky						<TD VALIGN=TOP>'M' (indicating 'monitor start')</TD>
580335640Shselasky					</TR>
581335640Shselasky					<TR>
582335640Shselasky						<TD VALIGN=TOP>snaplen</TD>
583335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>4</TD>
584335640Shselasky						<TD VALIGN=TOP>snaplen</TD>
585335640Shselasky					</TR>
586335640Shselasky					<TR>
587335640Shselasky						<TD VALIGN=TOP>timeout</TD>
588335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
589335640Shselasky						<TD VALIGN=TOP>timeout value (in milliseconds)</TD>
590335640Shselasky					</TR>
591335640Shselasky					<TR>
592335640Shselasky						<TD VALIGN=TOP>promiscuous</TD>
593335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
594335640Shselasky						<TD VALIGN=TOP>A flag indicating that the interface being monitored show operate
595335640Shselasky							in promiscuous mode. [off(0) / on(NZ)]</TD>
596335640Shselasky					</TR>
597335640Shselasky					<TR>
598335640Shselasky						<TD VALIGN=TOP>direction</TD>
599335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
600335640Shselasky						<TD VALIGN=TOP>A flag indicating the direction of traffic that should be captuted [both(0) / in(1) / out(2)]</TD>
601335640Shselasky					</TR>
602335640Shselasky				</TABLE>
603335640Shselasky			</TD>
604335640Shselasky		</TR>
605335640Shselasky		<TR>
606335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>IOP -> SMP</TD>
607335640Shselasky			<TD VALIGN=TOP>Sends captured packets.</TD>
608335640Shselasky		</TR>
609335640Shselasky		<TR><TH COLSPAN=3><HR WIDTH=100%></TH></TR>
610335640Shselasky		<TR>
611335640Shselasky			<TD VALIGN=TOP ROWSPAN=2>pcap_setfilter()</TD>
612335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
613335640Shselasky			<TD VALIGN=TOP>At any time, the SMP can issue a set filter command which contains
614335640Shselasky							an indicator, a count of the number of statements in the filter,
615335640Shselasky							followed by the sequence of filter commands represented as a sequence
616335640Shselasky							of C-style structures.
617335640Shselasky				<P>
618335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
619335640Shselasky					<TR>
620335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
621335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
622335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
623335640Shselasky					</TR>
624335640Shselasky					<TR>
625335640Shselasky						<TD VALIGN=TOP>command</TD>
626335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
627335640Shselasky						<TD VALIGN=TOP>'F' (indicating 'filter')</TD>
628335640Shselasky					</TR>
629335640Shselasky					<TR>
630335640Shselasky						<TD VALIGN=TOP>count</TD>
631335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>4</TD>
632335640Shselasky						<TD VALIGN=TOP>The number of command in the Berkeley Packet Filter that follow.</TD>
633335640Shselasky					</TR>
634335640Shselasky					<TR>
635335640Shselasky						<TD VALIGN=TOP>BPF program</TD>
636335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>'n'</TD>
637335640Shselasky						<TD VALIGN=TOP>8 bytes of each command (repeated 'n' times).<BR>
638335640Shselasky								 	Each command consists of that C-style structure which contains:
639335640Shselasky							<P>
640335640Shselasky							<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
641335640Shselasky								<TR>
642335640Shselasky								<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
643335640Shselasky								<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
644335640Shselasky								<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
645335640Shselasky								</TR>
646335640Shselasky								<TR>
647335640Shselasky									<TD VALIGN=TOP>opcode</TD>
648335640Shselasky									<TD VALIGN=TOP ALIGN=CENTER>2</TD>
649335640Shselasky									<TD VALIGN=TOP>The command's opcode.</TD>
650335640Shselasky								</TR>
651335640Shselasky								<TR>
652335640Shselasky									<TD VALIGN=TOP>'jt'</TD>
653335640Shselasky									<TD VALIGN=TOP ALIGN=CENTER>1</TD>
654335640Shselasky									<TD VALIGN=TOP>The 'jump if true' program counter offset.</TD>
655335640Shselasky								</TR>
656335640Shselasky								<TR>
657335640Shselasky									<TD VALIGN=TOP>'jf'</TD>
658335640Shselasky									<TD VALIGN=TOP ALIGN=CENTER>1</TD>
659335640Shselasky									<TD VALIGN=TOP>The 'jump if false' program counter offset.</TD>
660335640Shselasky								</TR>
661335640Shselasky								<TR>
662335640Shselasky									<TD VALIGN=TOP>'k'</TD>
663335640Shselasky									<TD VALIGN=TOP ALIGN=CENTER>4</TD>
664335640Shselasky									<TD VALIGN=TOP>The 'other' data field.</TD>
665335640Shselasky								</TR>
666335640Shselasky							</TABLE>
667335640Shselasky							<P>
668335640Shselasky							Refer to the bpf(4) man page for more details.
669335640Shselasky						</TD>
670335640Shselasky					</TR>
671335640Shselasky				</TABLE>
672335640Shselasky			</TD>
673335640Shselasky		</TR>
674335640Shselasky		<TR>
675335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>IOP -> SMP</TD>
676335640Shselasky			<TD VALIGN=TOP>In return the IOP will send its (possibly empty) NULL terminated error response string.</TD>
677335640Shselasky		</TR>
678335640Shselasky		<TR><TH COLSPAN=3><HR WIDTH=100%></TH></TR>
679335640Shselasky		<TR>
680335640Shselasky			<TD VALIGN=TOP ROWSPAN=2>pcap_stats()</TD>
681335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
682335640Shselasky			<TD VALIGN=TOP>At any time, the SMP can issue a 'retrieve statistics' command which contains:<BR>
683335640Shselasky				<P>
684335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
685335640Shselasky					<TR>
686335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
687335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
688335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
689335640Shselasky					</TR>
690335640Shselasky					<TR>
691335640Shselasky						<TD VALIGN=TOP>command</TD>
692335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>1</TD>
693335640Shselasky						<TD VALIGN=TOP>'S' (indicating 'request statistics')</TD>
694335640Shselasky					</TR>
695335640Shselasky				</TABLE>
696335640Shselasky			</TD>
697335640Shselasky		</TR>
698335640Shselasky		<TR>
699335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>IOP -> SMP</TD>
700335640Shselasky			<TD VALIGN=TOP>In return the IOP will send:
701335640Shselasky				<P>
702335640Shselasky				<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
703335640Shselasky					<TR>
704335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Name/<BR>Purpose</TH>
705335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER NOWRAP>Size<BR>(in bytes)</TH>
706335640Shselasky					<TH VALIGN=TOP ALIGN=CENTER>Description</TH>
707335640Shselasky					</TR>
708335640Shselasky					<TR>
709335640Shselasky						<TD VALIGN=TOP>ps_recv</TD>
710335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>4</TD>
711335640Shselasky						<TD VALIGN=TOP>The number of packets that passed the filter.</TD>
712335640Shselasky					</TR>
713335640Shselasky					<TR>
714335640Shselasky						<TD VALIGN=TOP>ps_drop</TD>
715335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>4</TD>
716335640Shselasky						<TD VALIGN=TOP>The number of packets that were dropped because the input queue was full,
717335640Shselasky							regardless of whether they passed the filter.</TD>
718335640Shselasky					</TR>
719335640Shselasky					<TR>
720335640Shselasky						<TD VALIGN=TOP>ps_ifdrop</TD>
721335640Shselasky						<TD VALIGN=TOP ALIGN=CENTER>4</TD>
722335640Shselasky						<TD VALIGN=TOP>The number of packets dropped by the network inteface
723335640Shselasky							(regardless of whether they would have passed the input filter).</TD>
724335640Shselasky					</TR>
725335640Shselasky				</TABLE>
726335640Shselasky			</TD>
727335640Shselasky		</TR>
728335640Shselasky		<TR><TH COLSPAN=3><HR WIDTH=100%></TH></TR>
729335640Shselasky		<TR>
730335640Shselasky			<TD VALIGN=TOP ROWSPAN=1>pcap_close()</TD>
731335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER NOWRAP>SMP -> IOP</TD>
732335640Shselasky			<TD VALIGN=TOP>At any time, the SMP can close the TCP session with the IOP.</TD>
733335640Shselasky		</TR>
734335640Shselasky		<TR><TH COLSPAN=3><HR WIDTH=100%></TH></TR>
735335640Shselasky	</TABLE>
736335640Shselasky</UL>
737335640Shselasky
738335640Shselasky<H3>Interface ID Naming Convention</H3>
739335640Shselasky<UL>
740335640Shselasky	Each interface within an IOP will be referred to uniquely.  Since an currently contains
741335640Shselasky	8 monitorable WAN ports and a monitorable Ethernet port, the naming convention is:
742335640Shselasky	<P>
743335640Shselasky	<CENTER>
744335640Shselasky	<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
745335640Shselasky		<TR><TH>Interface #</TH>		<TH>Type</TH>					<TH>Name</TH></TR>
746335640Shselasky		<TR><TD ALIGN=CENTER>1</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan0</TD></TR>
747335640Shselasky		<TR><TD ALIGN=CENTER>2</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan1</TD></TR>
748335640Shselasky		<TR><TD ALIGN=CENTER>3</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan2</TD></TR>
749335640Shselasky		<TR><TD ALIGN=CENTER>4</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan3</TD></TR>
750335640Shselasky		<TR><TD ALIGN=CENTER>5</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan4</TD></TR>
751335640Shselasky		<TR><TD ALIGN=CENTER>6</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan5</TD></TR>
752335640Shselasky		<TR><TD ALIGN=CENTER>7</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan6</TD></TR>
753335640Shselasky		<TR><TD ALIGN=CENTER>8</TD>		<TD ALIGN=CENTER>WAN</TD>		<TD ALIGN=CENTER>wan7</TD></TR>
754335640Shselasky		<TR><TD ALIGN=CENTER>9</TD>		<TD ALIGN=CENTER>Ethernet</TD>	<TD ALIGN=CENTER>eth0</TD></TR>
755335640Shselasky		<TR><TD ALIGN=CENTER>10</TD>	<TD ALIGN=CENTER>Ethernet</TD>	<TD ALIGN=CENTER>eth1</TD></TR>
756335640Shselasky	</TABLE>
757335640Shselasky	</CENTER>
758335640Shselasky</UL>
759335640Shselasky
760335640Shselasky<H3>Packet Trace Data Format</H3>
761335640Shselasky<UL>
762335640Shselasky	The format of the trace data that is sent to the SMP follows a portion of the libpcap file format
763335640Shselasky	and is summarized here.  This format specifies the generic requirements needed to
764335640Shselasky	be able to decode packets, but does not cover ACN specifics such as custom MAC addressing
765335640Shselasky	and WAN protocol support.
766335640Shselasky	<P>
767335640Shselasky
768335640Shselasky	Although a libpcap file begins with a global header followed by zero or
769335640Shselasky	more records for each captured packet, trace data sent to the SMP does NOT begin with a global header.
770335640Shselasky	A trace sequence looks like this:
771335640Shselasky	<P>
772335640Shselasky	<TABLE>
773335640Shselasky		<TR>
774335640Shselasky  			<TD STYLE="background-color: #c0FFc0">&nbsp;[Packet Header]&nbsp;</TD>
775335640Shselasky  			<TD STYLE="background-color: #c0FFc0">&nbsp;[Packet Data]&nbsp;</TD>
776335640Shselasky  			<TD STYLE="background-color: #c0c0FF">&nbsp;[Packet Header]&nbsp;</TD>
777335640Shselasky  			<TD STYLE="background-color: #c0c0FF">&nbsp;[Packet Data]&nbsp;</TD>
778335640Shselasky  			<TD STYLE="background-color: #e0c0c0">&nbsp;[Packet Header]&nbsp;</TD>
779335640Shselasky  			<TD STYLE="background-color: #e0c0c0">&nbsp;[Packet Data]&nbsp;</TD>
780335640Shselasky  			<TD>...</TD>
781335640Shselasky		</TR>
782335640Shselasky	</TABLE>
783335640Shselasky
784335640Shselasky<H4>Packet Header</H4>
785335640Shselasky	<UL>
786335640Shselasky		Each captured packet starts with a header that contains the following values
787335640Shselasky		(in network neutral order):
788335640Shselasky
789335640Shselasky		<FONT SIZE=-1>
790335640Shselasky		<PRE>
791335640Shselasky uint32 tv_sec;  /* timestamp seconds */
792335640Shselasky uint32 tv_usec; /* timestamp microseconds */
793335640Shselasky uint32 caplen;  /* number of octets in the following packet */
794335640Shselasky uint32 len;     /* original length of packet on the wire */
795335640Shselasky		</PRE>
796335640Shselasky		</FONT>
797335640Shselasky
798335640Shselasky		<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
799335640Shselasky			<TR>
800335640Shselasky				<TD VALIGN=TOP>tv_sec</TD>
801335640Shselasky				<TD>The date and time when this packet was captured.
802335640Shselasky					This value is in seconds since January 1, 1970 00:00:00 GMT;
803335640Shselasky					this is also known as a UN*X time_t. You can use the ANSI C
804335640Shselasky					<em>time()</em> function from <em>time.h</em> to get this value,
805335640Shselasky					but you might use a more optimized way to get this timestamp value.
806335640Shselasky					If this timestamp isn't based on GMT (UTC), use <em>thiszone</em>
807335640Shselasky					from the global header for adjustments.</TD>
808335640Shselasky			</TR>
809335640Shselasky			<TR>
810335640Shselasky				<TD VALIGN=TOP>tv_usec</TD>
811335640Shselasky				<TD>The microseconds when this packet was captured, as an offset to <em>ts_sec</em>.
812335640Shselasky					<B>Beware: </B>this value must never reach 1 second (1,000,000),
813335640Shselasky					in this case <em>ts_sec</em> must be increased instead!</TD>
814335640Shselasky			</TR>
815335640Shselasky			<TR>
816335640Shselasky				<TD VALIGN=TOP>caplen</TD>
817335640Shselasky				<TD>The number of bytes actually provided in the capture record.
818335640Shselasky					This value should never become larger than <em>len</em> or the
819335640Shselasky					<em>snaplen</em> value specified during the capture.</TD>
820335640Shselasky			</TR>
821335640Shselasky			<TR>
822335640Shselasky				<TD VALIGN=TOP>len</TD>
823335640Shselasky				<TD>The length of the packet "on the wire" when it was captured.
824335640Shselasky					If <em>caplen</em> and <em>len</em> differ, the actually
825335640Shselasky					saved packet size was limited by the value of <em>snaplen</em> specified
826335640Shselasky					during one of the capture directives such as pcap_dispatch().</TD>
827335640Shselasky			</TR>
828335640Shselasky		</TABLE>
829335640Shselasky	</UL>
830335640Shselasky
831335640Shselasky<H4>Packet Data</H4>
832335640Shselasky	<UL>
833335640Shselasky	The actual packet data will immediately follow the packet header as a sequence of <em>caplen</em> octets.
834335640Shselasky	Depending on the DLT encoding number assigned to the interface, the packet data will contain an additional
835335640Shselasky	custom header used to convey WAN port related information.
836335640Shselasky	</UL>
837335640Shselasky
838335640Shselasky<H4>ACN Custom Packet Header</H4>
839335640Shselasky	<UL>
840335640Shselasky	PCAP, Wireshark and Tcpdump enhancements have been added to the ACN to support
841335640Shselasky	monitoring of its ports, however each of these facilities were focused on capturing
842335640Shselasky	and displaying traffic from LAN interfaces.  The SITA extentions to these facilities
843335640Shselasky	are used to also provide the ability to capture, filter, and display information from
844335640Shselasky	an ACN's WAN ports.
845335640Shselasky	<P>
846335640Shselasky	Although each packet follows the standard libpcap format, since there are
847335640Shselasky	two types of interfaces that can be monitored, the format of the data
848335640Shselasky	packet varies slightly.
849335640Shselasky	<P>
850335640Shselasky	<UL TYPE=DISC>
851335640Shselasky		<LI>For Ethernet (like) devices, the packet format is unchanged from the standard Pcap format.
852335640Shselasky		<LI>For WAN devices, the packet contains a 5 byte header that preceeds the actual captured data
853335640Shselasky			described by the following table:
854335640Shselasky	</UL>
855335640Shselasky	<P>
856335640Shselasky	<CENTER>
857335640Shselasky	<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
858335640Shselasky	<TR>	<TH>Octet</TH>
859335640Shselasky			<TH>Name</TH>
860335640Shselasky			<TH>Mask/Value</TH>
861335640Shselasky			<TH COLSPAN=2>Definition</TH>		</TR>
862335640Shselasky
863335640Shselasky	<TR>	<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=3>0</TH>
864335640Shselasky			<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=3>Control / Status</TH>
865335640Shselasky
866335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxxx0</FONT></TD>
867335640Shselasky			<TD>Transmitted by capture device</TD>
868335640Shselasky			<TD ROWSPAN=2 ALIGN=CENTER>(see 'Errors' octets)</TD>							</TR>
869335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxxx1</FONT></TD>
870335640Shselasky			<TD>Received by capture device</TD>												</TR>
871335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">1xxxxxxx</FONT></TD>
872335640Shselasky			<TD COLSPAN=2>No buffer was available during capture of previous packet.</TD>	</TR>
873335640Shselasky
874335640Shselasky	<TR>	<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=8>1</TH>
875335640Shselasky			<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=8>Signals</TH>
876335640Shselasky
877335640Shselasky			<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxxx1</FONT></TD>	<TD COLSPAN=2>DSR asserted</TD>		</TR>
878335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxx1x</FONT></TD>	<TD COLSPAN=2>DTR asserted</TD>		</TR>
879335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxx1xx</FONT></TD>	<TD COLSPAN=2>CTS asserted</TD>		</TR>
880335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxx1xxx</FONT></TD>	<TD COLSPAN=2>RTS asserted</TD>		</TR>
881335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxx1xxxx</FONT></TD>	<TD COLSPAN=2>DCD asserted</TD>		</TR>
882335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xx1xxxxx</FONT></TD>	<TD COLSPAN=2>Undefined</TD>		</TR>
883335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">x1xxxxxx</FONT></TD>	<TD COLSPAN=2>Undefined</TD>		</TR>
884335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">1xxxxxxx</FONT></TD>	<TD COLSPAN=2>Undefined</TD>		</TR>
885335640Shselasky
886335640Shselasky	<TR>	<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=9>2</TH>
887335640Shselasky			<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=9>Errors<BR>(octet 1)</TH>
888335640Shselasky
889335640Shselasky			<TH>&nbsp;</TH>															<TH>Tx</TH>						<TH>Rx</TH>				</TR>
890335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxxx1</FONT></TD>	<TD>Underrun</TD>				<TD>Framing</TD>		</TR>
891335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxx1x</FONT></TD>	<TD>CTS Lost</TD>				<TD>Parity</TD>			</TR>
892335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxx1xx</FONT></TD>	<TD>UART Error</TD>				<TD>Collision</TD>		</TR>
893335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxx1xxx</FONT></TD>	<TD>Re-Tx Limit Reached</TD>	<TD>Long Frame</TD>		</TR>
894335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxx1xxxx</FONT></TD>	<TD>Undefined</TD>				<TD>Short Frame</TD>	</TR>
895335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xx1xxxxx</FONT></TD>	<TD>Undefined</TD>				<TD>Undefined</TD>		</TR>
896335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">x1xxxxxx</FONT></TD>	<TD>Undefined</TD>				<TD>Undefined</TD>		</TR>
897335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">1xxxxxxx</FONT></TD>	<TD>Undefined</TD>				<TD>Undefined</TD>		</TR>
898335640Shselasky
899335640Shselasky	<TR>	<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=9>3</TH>
900335640Shselasky			<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=9>Errors<BR>(octet 2)</TH>
901335640Shselasky
902335640Shselasky			<TH>&nbsp;</TH>															<TH>Tx</TH>			<TH>Rx</TH>						</TR>
903335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxxx1</FONT></TD>	<TD>Undefined</TD>	<TD>Non-Octet Aligned</TD>		</TR>
904335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxxx1x</FONT></TD>	<TD>Undefined</TD>	<TD>Abort Received</TD>			</TR>
905335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxxx1xx</FONT></TD>	<TD>Undefined</TD>	<TD>CD Lost</TD>				</TR>
906335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxxx1xxx</FONT></TD>	<TD>Undefined</TD>	<TD>Digital PLL Error</TD>		</TR>
907335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xxx1xxxx</FONT></TD>	<TD>Undefined</TD>	<TD>Overrun</TD>				</TR>
908335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">xx1xxxxx</FONT></TD>	<TD>Undefined</TD>	<TD>Frame Length Violation</TD>	</TR>
909335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">x1xxxxxx</FONT></TD>	<TD>Undefined</TD>	<TD>CRC Error</TD>				</TR>
910335640Shselasky	<TR>	<TD VALIGN=TOP ALIGN=CENTER><FONT FACE="COURIER">1xxxxxxx</FONT></TD>	<TD>Undefined</TD>	<TD>Break Received</TD>			</TR>
911335640Shselasky
912335640Shselasky	<TR>	<TH VALIGN=TOP ALIGN=CENTER ROWSPAN=12>4</TH>
913335640Shselasky			<TH VALIGN=TOP ALIGN=CENTER>Protocol</TH>
914335640Shselasky
915335640Shselasky			<TD COLSPAN=3>
916335640Shselasky				<CENTER>
917335640Shselasky				<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
918335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x01</TD>	<TD>-</TD>	<TD>LAPB (BOP)				<SUP>&nbsp;</SUP>	</TD>	</TR>
919335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x02</TD>	<TD>-</TD>	<TD>Ethernet				<SUP>1</SUP>		</TD>	</TR>
920335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x03</TD>	<TD>-</TD>	<TD>Async (Interrupt IO)	<SUP>&nbsp;</SUP>	</TD>	</TR>
921335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x04</TD>	<TD>-</TD>	<TD>Async (Block IO)		<SUP>&nbsp;</SUP>	</TD>	</TR>
922335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x05</TD>	<TD>-</TD>	<TD>IPARS					<SUP>&nbsp;</SUP>	</TD>	</TR>
923335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x06</TD>	<TD>-</TD>	<TD>UTS						<SUP>&nbsp;</SUP>	</TD>	</TR>
924335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x07</TD>	<TD>-</TD>	<TD>PPP (HDLC)				<SUP>&nbsp;</SUP>	</TD>	</TR>
925335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x08</TD>	<TD>-</TD>	<TD>SDLC					<SUP>&nbsp;</SUP>	</TD>	</TR>
926335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x09</TD>	<TD>-</TD>	<TD>Token Ring				<SUP>1</SUP>		</TD>	</TR>
927335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x10</TD>	<TD>-</TD>	<TD>I2C						<SUP>&nbsp;</SUP>	</TD>	</TR>
928335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x11</TD>	<TD>-</TD>	<TD>DPM Link				<SUP>&nbsp;</SUP>	</TD>	</TR>
929335640Shselasky					<TR VALIGN=BOTTOM><TD ALIGN=CENTER>0x12</TD>	<TD>-</TD>	<TD>Frame Relay (BOP)		<SUP>&nbsp;</SUP>	</TD>	</TR>
930335640Shselasky				</TABLE>
931335640Shselasky				</CENTER>
932335640Shselasky				<P>
933335640Shselasky				<STRONG>Note 1:</STRONG>
934335640Shselasky				Ethernet and Token Ring frames will never be sent as DLT_SITA (with the 5 octet header),
935335640Shselasky				but will be sent as their corresponding DLT types instead.
936335640Shselasky			</TD>
937335640Shselasky	</TR>
938335640Shselasky	</TABLE>
939335640Shselasky	</CENTER>
940335640Shselasky</UL>
941335640Shselasky<P>
942335640Shselasky</UL>
943335640Shselasky</UL>
944