<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,6 +2,9 @@ The following instructions apply if you have a Linux platform and want
 libpcap to support the 'ACN' WAN/LAN router product from from SITA
 (http://www.sita.aero)
 
+This might also work on non-Linux Unix-compatible platforms, but that
+has not been tested.
+
 See also the libpcap INSTALL.txt file for further libpcap configuration
 options.
 
@@ -48,9 +51,9 @@ All captured packets are then forwarded across that TCP session
 back to the local 'top layer' for forwarding to the actual
 sniffing program (wireshark...)
 
-Note that the DLT_SITA protocol includes a proprietary header
-that is documented as part of the SITA dissector of Wireshark
-and is also described in 'pcap-sita.html' for posterity sake.
+Note that the DLT_SITA link-layer type includes a proprietary header
+that is documented as part of the SITA dissector of Wireshark and is
+also described in 'pcap-sita.html' for posterity sake.
 
 That header provides:
 - Packet direction (in/out) (1 octet)</diff>
      <filename>README.sita</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.143 .
+# From configure.in Revision: 1.144 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
@@ -856,8 +856,8 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --without-gcc           don't use gcc
-  --with-pcap=TYPE        use packet capture TYPE
   --with-sita             include SITA support
+  --with-pcap=TYPE        use packet capture TYPE
   --with-dag[=DIR]        include Endace DAG support (&quot;yes&quot;, &quot;no&quot; or DIR; default=&quot;yes&quot; on BSD and Linux if present)
   --with-dag-includes=DIR   Endace DAG include directory
   --with-dag-libraries=DIR  Endace DAG library directory
@@ -5931,6 +5931,27 @@ fi
 echo &quot;$as_me:$LINENO: result: ${enable_protochain}&quot; &gt;&amp;5
 echo &quot;${ECHO_T}${enable_protochain}&quot; &gt;&amp;6
 
+#
+# SITA support is mutually exclusive with native capture support;
+# &quot;--with-sita&quot; selects SITA support.
+#
+
+# Check whether --with-sita or --without-sita was given.
+if test &quot;${with_sita+set}&quot; = set; then
+  withval=&quot;$with_sita&quot;
+
+
+cat &gt;&gt;confdefs.h &lt;&lt;\_ACEOF
+#define SITA 1
+_ACEOF
+
+	{ echo &quot;$as_me:$LINENO: Enabling SITA ACN support&quot; &gt;&amp;5
+echo &quot;$as_me: Enabling SITA ACN support&quot; &gt;&amp;6;}
+	V_PCAP=sita
+	V_FINDALLDEVS=sita
+
+else
+
 if test -z &quot;$with_pcap&quot; &amp;&amp; test &quot;$cross_compiling&quot; = yes; then
 	{ { echo &quot;$as_me:$LINENO: error: pcap type not determined when cross-compiling; use --with-pcap=...&quot; &gt;&amp;5
 echo &quot;$as_me: error: pcap type not determined when cross-compiling; use --with-pcap=...&quot; &gt;&amp;2;}
@@ -6356,6 +6377,8 @@ fi
 
 fi
 
+fi;
+
 echo &quot;$as_me:$LINENO: checking if --enable-ipv6 option is specified&quot; &gt;&amp;5
 echo $ECHO_N &quot;checking if --enable-ipv6 option is specified... $ECHO_C&quot; &gt;&amp;6
 # Check whether --enable-ipv6 or --disable-ipv6 was given.
@@ -6685,22 +6708,6 @@ cat &gt;&gt;confdefs.h &lt;&lt;\_ACEOF
 _ACEOF
 
    fi
-
-# Check whether --with-sita or --without-sita was given.
-if test &quot;${with_sita+set}&quot; = set; then
-  withval=&quot;$with_sita&quot;
-
-
-cat &gt;&gt;confdefs.h &lt;&lt;\_ACEOF
-#define SITA 1
-_ACEOF
-
-		SSRC=&quot;pcap-sita.c&quot;
-		{ echo &quot;$as_me:$LINENO: Enabling SITA ACN support&quot; &gt;&amp;5
-echo &quot;$as_me: Enabling SITA ACN support&quot; &gt;&amp;6;}
-		V_FINDALLDEVS=sita
-
-fi;
 	;;
 
 dag)</diff>
      <filename>configure</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.143 2008-01-01 03:49:11 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.144 2008-01-06 20:23:17 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl	The Regents of the University of California.  All rights reserved.
@@ -6,7 +6,7 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_REVISION($Revision: 1.143 $)
+AC_REVISION($Revision: 1.144 $)
 AC_PREREQ(2.50)
 AC_INIT(pcap.c)
 
@@ -197,6 +197,18 @@ if test &quot;$enable_protochain&quot; = &quot;disabled&quot;; then
 fi
 AC_MSG_RESULT(${enable_protochain})
 
+#
+# SITA support is mutually exclusive with native capture support;
+# &quot;--with-sita&quot; selects SITA support.
+#
+AC_ARG_WITH(sita, [  --with-sita             include SITA support],
+[
+	AC_DEFINE(SITA,1,[include ACN support])
+	AC_MSG_NOTICE(Enabling SITA ACN support)
+	V_PCAP=sita
+	V_FINDALLDEVS=sita
+],
+[
 dnl
 dnl Not all versions of test support -c (character special) but it's a
 dnl better way of testing since the device might be protected. So we
@@ -335,6 +347,7 @@ else
 			;;
 		esac])
 fi
+])
 
 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
 AC_ARG_ENABLE(ipv6, [  --enable-ipv6           build IPv6-capable version])
@@ -396,13 +409,6 @@ linux)
 		AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
 	fi
 	AC_LBL_TPACKET_STATS
-	AC_ARG_WITH(sita, [  --with-sita             include SITA support],
-	[
-		AC_DEFINE(SITA,1,[include ACN support])
-		SSRC=&quot;pcap-sita.c&quot;
-		AC_MSG_NOTICE(Enabling SITA ACN support)
-		V_FINDALLDEVS=sita
-	])
 	;;
 
 dag)</diff>
      <filename>configure.in</filename>
    </modified>
    <modified>
      <diff>@@ -33,10 +33,9 @@
 #include &lt;string.h&gt;
 #include &quot;pcap-int.h&quot;
 
-extern pcap_if_t	*acn_if_list;								/* pcap's list of available interfaces */
+#include &quot;pcap-sita.h&quot;
 
-extern int acn_parse_hosts_file(char *errbuf);
-extern int acn_findalldevs(char *errbuf);
+extern pcap_if_t	*acn_if_list;								/* pcap's list of available interfaces */
 
 int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) {
 </diff>
      <filename>fad-sita.c</filename>
    </modified>
    <modified>
      <diff>@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.86 2007-10-17 18:52:41 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.87 2008-01-06 20:23:17 guy Exp $ (LBL)
  */
 
 #ifndef pcap_int_h
@@ -114,20 +114,22 @@ struct pcap_md {
 	char	*device;	/* device name */
 #ifdef linux
 	int	sock_packet;	/* using Linux 2.0 compatible interface */
-	int	timeout;	/* timeout specified to pcap_open_live */
-	int	clear_promisc;	/* must clear promiscuous mode when we close */
 	int	cooked;		/* using SOCK_DGRAM rather than SOCK_RAW */
 	int	ifindex;	/* interface index of device we're bound to */
 	int	lo_ifindex;	/* interface index of the loopback device */
 	struct pcap *next;	/* list of open promiscuous sock_packet pcaps */
 	u_int	packets_read;	/* count of packets read with recvfrom() */
-#endif
+#endif /* linux */
+#if defined(linux) || defined(SITA)
+	int	timeout;	/* timeout specified to pcap_open_live */
+	int	clear_promisc;	/* must clear promiscuous mode when we close */
+#endif /* linux || SITA */
 
 #ifdef HAVE_DAG_API
 #ifdef HAVE_DAG_STREAMS_API
 	u_char	*dag_mem_bottom;	/* DAG card current memory bottom pointer */
 	u_char	*dag_mem_top;	/* DAG card current memory top pointer */
-#else
+#else /* HAVE_DAG_STREAMS_API */
 	void	*dag_mem_base;	/* DAG card memory base address */
 	u_int	dag_mem_bottom;	/* DAG card current memory bottom offset */
 	u_int	dag_mem_top;	/* DAG card current memory top offset */</diff>
      <filename>pcap-int.h</filename>
    </modified>
    <modified>
      <diff>@@ -34,7 +34,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    &quot;@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.132 2008-01-05 22:32:31 guy Exp $ (LBL)&quot;;
+    &quot;@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.133 2008-01-06 20:23:17 guy Exp $ (LBL)&quot;;
 #endif
 
 /*
@@ -103,10 +103,6 @@ static const char rcsid[] _U_ =
 #include &quot;pcap-bt-linux.h&quot;
 #endif
 
-#ifdef SITA
-#include &quot;pcap-sita.h&quot;
-#endif
-
 #include &lt;errno.h&gt;
 #include &lt;stdlib.h&gt;
 #include &lt;unistd.h&gt;
@@ -332,14 +328,8 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
 	handle-&gt;getnonblock_op = pcap_getnonblock_fd;
 	handle-&gt;setnonblock_op = pcap_setnonblock_fd;
 	handle-&gt;close_op = pcap_close_linux;
-
-#ifdef SITA
-	handle-&gt;read_op = pcap_read_acn;
-	handle-&gt;stats_op = pcap_stats_acn;
-#else
 	handle-&gt;read_op = pcap_read_linux;
 	handle-&gt;stats_op = pcap_stats_linux;
-#endif
 
 	/*
 	 * NULL and &quot;any&quot; are special devices which give us the hint to
@@ -375,12 +365,6 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
 	 * trying both methods with the newer method preferred.
 	 */
 
-#ifdef SITA
-	live_open_ok = acn_open_live((unsigned char *)device, ebuf, &amp;handle-&gt;linktype);
-	handle-&gt;md.clear_promisc = promisc;
-	handle-&gt;fd = live_open_ok;
-	handle-&gt;bufsize = handle-&gt;snapshot;
-#else
 	if ((err = live_open_new(handle, device, promisc, to_ms, ebuf)) == 1) {
 		live_open_ok = 1;
 		if (live_open_mmap(handle, ebuf) == 1)
@@ -391,7 +375,6 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
 		if (live_open_old(handle, device, promisc, to_ms, ebuf))
 			live_open_ok = 1;
 	}
-#endif
 	if (!live_open_ok) {
 		/*
 		 * Both methods to open the packet socket failed. Tidy
@@ -405,7 +388,6 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
 		return NULL;
 	}
 
-#ifndef SITA
 	/*
 	 * Compute the buffer size.
 	 *
@@ -488,7 +470,6 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
 		}
 		handle-&gt;bufsize = handle-&gt;snapshot;
 	}
-#endif
 
 	/* Allocate the buffer */
 
@@ -986,9 +967,6 @@ pcap_setfilter_linux(pcap_t *handle, struct bpf_program *filter)
 		return -1;
 	}
 
-#ifdef SITA
-	return acn_setfilter(handle-&gt;fd, filter);
-#else
 	/* Make our private copy of the filter */
 
 	if (install_bpf_program(handle, filter) &lt; 0)
@@ -1104,7 +1082,6 @@ pcap_setfilter_linux(pcap_t *handle, struct bpf_program *filter)
 #endif /* SO_ATTACH_FILTER */
 
 	return 0;
-#endif /* SITA */
 }
 
 /*
@@ -2107,9 +2084,6 @@ static void	pcap_close_all(void)
 
 static void	pcap_close_linux( pcap_t *handle )
 {
-#ifdef SITA
-	pcap_close_acn(handle);
-#else
 	struct pcap	*p, *prevp;
 	struct ifreq	ifr;
 
@@ -2178,7 +2152,6 @@ static void	pcap_close_linux( pcap_t *handle )
 		free(handle-&gt;md.device);
 	handle-&gt;md.device = NULL;
 	pcap_close_common(handle);
-#endif /* SITA */
 }
 
 /*</diff>
      <filename>pcap-linux.c</filename>
    </modified>
    <modified>
      <diff>@@ -42,6 +42,8 @@
 #include &lt;arpa/inet.h&gt;
 #include &quot;pcap-int.h&quot;
 
+#include &quot;pcap-sita.h&quot;
+
 	/* non-configureable manifests follow */
 
 #define IOP_SNIFFER_PORT	49152			/* TCP port on the IOP used for 'distributed pcap' usage */
@@ -81,7 +83,7 @@ static char			static_buf[32];
 
 pcap_if_t			*acn_if_list;							/* pcap's list of available interfaces */
 
-static void dump_interface_list() {
+static void dump_interface_list(void) {
 	pcap_if_t		*iff;
 	pcap_addr_t		*addr;
 	int				longest_name_len = 0;
@@ -114,7 +116,7 @@ static void dump_interface_list() {
 	}
 }
 
-static dump(unsigned char *ptr, int i, int indent) {
+static void dump(unsigned char *ptr, int i, int indent) {
 	fprintf(stderr, &quot;%*s&quot;, indent, &quot; &quot;);
 	for (; i &gt; 0; i--) {
 		fprintf(stderr, &quot;%2.2x &quot;, *ptr++);
@@ -122,11 +124,9 @@ static dump(unsigned char *ptr, int i, int indent) {
 	fprintf(stderr, &quot;\n&quot;);
 }
 
-static void dump_interface_list_p() {
+static void dump_interface_list_p(void) {
 	pcap_if_t		*iff;
 	pcap_addr_t		*addr;
-	int				longest_name_len = 0;
-	char			*n, *d, *f;
 	int				if_number = 0;
 
 	iff = acn_if_list;
@@ -144,7 +144,7 @@ static void dump_interface_list_p() {
 	}
 }
 
-static void dump_unit_table() {
+static void dump_unit_table(void) {
 	int		chassis, geoslot;
 	iface_t	*p;
 
@@ -209,7 +209,6 @@ static void empty_unit_iface(unit_t *u) {
 }
 
 static void empty_unit(int chassis, int geoslot) {
-	iface_t	*p, *cur;
 	unit_t	*u = &amp;units[chassis][geoslot];
 
 	empty_unit_iface(u);
@@ -218,7 +217,7 @@ static void empty_unit(int chassis, int geoslot) {
 	}
 }
 
-static void empty_unit_table() {
+static void empty_unit_table(void) {
 	int		chassis, geoslot;
 
 	for (chassis = 0; chassis &lt;= MAX_CHASSIS; chassis++) {
@@ -345,7 +344,7 @@ static void close_with_IOP(int chassis, int geoslot, int flag) {
 	}
 }
 
-void pcap_close_acn(pcap_t *handle) {
+static void pcap_close_acn(pcap_t *handle) {
 	int		chassis, geoslot;
 	unit_t	*u;
 
@@ -373,7 +372,7 @@ static void send_to_fd(int fd, int len, unsigned char *str) {
 	}
 }
 
-static void acn_freealldevs() {
+static void acn_freealldevs(void) {
 
 	pcap_if_t	*iff, *next_iff;
 	pcap_addr_t	*addr, *next_addr;
@@ -408,7 +407,7 @@ static char *unified_port_num(unit_t *u, int IOPportnum) {
 	return static_buf;
 }
 
-static char *translate_IOP_to_pcap_name(unit_t *u, char *IOPname, ulong iftype) {
+static char *translate_IOP_to_pcap_name(unit_t *u, char *IOPname, bpf_u_int32 iftype) {
 	iface_t		*iface_ptr, *iface;
 	char		*name;
 	char		buf[32];
@@ -489,7 +488,7 @@ static int if_sort(char *s1, char *s2) {
 	return strcmp(s1_p2, s2_p2);		/* otherwise we return the result of comparing the 2nd half of the string */
 }
 
-static void sort_if_table() {
+static void sort_if_table(void) {
 	pcap_if_t	*p1, *p2, *prev, *temp;
 	int			has_swapped;
 
@@ -534,7 +533,7 @@ static int process_client_data (char *errbuf) {								/* returns: -1 = error, 0
 	int					address_count;
 	struct sockaddr_in	*s;
 	char				*newname;
-	ulong				interfaceType;
+	bpf_u_int32				interfaceType;
 	unsigned char		flags;
 
 	prev_iff = 0;
@@ -574,7 +573,7 @@ static int process_client_data (char *errbuf) {								/* returns: -1 = error, 0
 				}
 				ptr++;
 
-				interfaceType = ntohl(*(ulong *)ptr);
+				interfaceType = ntohl(*(bpf_u_int32 *)ptr);
 				ptr += 4;													/* skip over the interface type */
 
 				flags = *ptr++;
@@ -599,7 +598,7 @@ static int process_client_data (char *errbuf) {								/* returns: -1 = error, 0
 						bzero((char *)s, sizeof(struct sockaddr_in));
 						addr-&gt;addr = (struct sockaddr *)s;
 						s-&gt;sin_family		= AF_INET;
-						s-&gt;sin_addr.s_addr	= *(ulong *)(ptr + 1);			/* copy the address in */
+						s-&gt;sin_addr.s_addr	= *(bpf_u_int32 *)(ptr + 1);			/* copy the address in */
 						ptr += *ptr;										/* now move the pointer forwards according to the specified length of the address */
 					}
 					ptr++;													/* then forwards one more for the 'length of the address' field */
@@ -611,7 +610,7 @@ static int process_client_data (char *errbuf) {								/* returns: -1 = error, 0
 						bzero((char *)s, sizeof(struct sockaddr_in));
 						addr-&gt;netmask = (struct sockaddr *)s;
 						s-&gt;sin_family		= AF_INET;
-						s-&gt;sin_addr.s_addr	= *(ulong*)(ptr + 1);
+						s-&gt;sin_addr.s_addr	= *(bpf_u_int32*)(ptr + 1);
 						ptr += *ptr;
 					}
 					ptr++;
@@ -623,7 +622,7 @@ static int process_client_data (char *errbuf) {								/* returns: -1 = error, 0
 						bzero((char *)s, sizeof(struct sockaddr_in));
 						addr-&gt;broadaddr = (struct sockaddr *)s;
 						s-&gt;sin_family		= AF_INET;
-						s-&gt;sin_addr.s_addr	= *(ulong*)(ptr + 1);
+						s-&gt;sin_addr.s_addr	= *(bpf_u_int32*)(ptr + 1);
 						ptr += *ptr;
 					}
 					ptr++;
@@ -635,7 +634,7 @@ static int process_client_data (char *errbuf) {								/* returns: -1 = error, 0
 						bzero((char *)s, sizeof(struct sockaddr_in));
 						addr-&gt;dstaddr = (struct sockaddr *)s;
 						s-&gt;sin_family		= AF_INET;
-						s-&gt;sin_addr.s_addr	= *(ulong*)(ptr + 1);
+						s-&gt;sin_addr.s_addr	= *(bpf_u_int32*)(ptr + 1);
 						ptr += *ptr;
 					}
 					ptr++;
@@ -672,7 +671,7 @@ static int read_client_data (int fd) {
 	return 1;
 }
 
-static void wait_for_all_answers() {
+static void wait_for_all_answers(void) {
 	int		retval;
 	struct	timeval tv;
 	int		fd;
@@ -719,9 +718,10 @@ static char *get_error_response(int fd, char *errbuf) {		/* return a pointer on
 			*errbuf++ = byte;							/* stick it in */
 			*errbuf = '\0';								/* ensure the string is null terminated just in case we might exceed the buffer's size */
 		}
-		if (byte == '\0')
+		if (byte == '\0') {
 			if (len &gt; 1)	{ return errbuf;	}
 			else			{ return NULL;		}
+		}
 	}
 }
 
@@ -755,7 +755,7 @@ int acn_findalldevs(char *errbuf) {								/* returns: -1 = error, 0 = OK */
 	return 0;
 }
 
-int pcap_stats_acn(pcap_t *handle, struct pcap_stat *ps) {
+static int pcap_stats_acn(pcap_t *handle, struct pcap_stat *ps) {
 	unsigned char	buf[12];
 
 	send_to_fd(handle-&gt;fd, 1, (unsigned char *)&quot;S&quot;);						/* send the get_stats command to the IOP */
@@ -769,7 +769,7 @@ int pcap_stats_acn(pcap_t *handle, struct pcap_stat *ps) {
 	return 0;
 }
 
-int acn_open_live(char *name, char *errbuf, int *linktype) {		/* returns 0 on error, else returns the file descriptor */
+static int acn_open_live(const char *name, char *errbuf, int *linktype) {		/* returns 0 on error, else returns the file descriptor */
 	int			chassis, geoslot;
 	unit_t		*u;
 	iface_t		*p;
@@ -787,7 +787,7 @@ int acn_open_live(char *name, char *errbuf, int *linktype) {		/* returns 0 on er
 						open_with_IOP(u, LIVE);													/* start a connection with that IOP */
 						send_to_fd(u-&gt;fd, strlen(p-&gt;IOPname)+1, (unsigned char *)p-&gt;IOPname);	/* send the IOP's interface name, and a terminating null */
 						if (get_error_response(u-&gt;fd, errbuf)) {
-							return 0;
+							return -1;
 						}
 						return u-&gt;fd;															/* and return that open descriptor */
 					}
@@ -796,10 +796,10 @@ int acn_open_live(char *name, char *errbuf, int *linktype) {		/* returns 0 on er
 			}
 		}
 	}
-	return 0;																				/* if the interface wasn't found, return an error */
+	return -1;																				/* if the interface wasn't found, return an error */
 }
 
-void acn_start_monitor(int fd, int snaplen, int timeout, int promiscuous, int direction) {
+static void acn_start_monitor(int fd, int snaplen, int timeout, int promiscuous, int direction) {
 	unsigned char	buf[8];
 	unit_t			*u;
 
@@ -818,7 +818,14 @@ void acn_start_monitor(int fd, int snaplen, int timeout, int promiscuous, int di
 	//printf(&quot;acn_start_monitor() complete\n&quot;);				// fulko
 }
 
-int acn_setfilter(int fd, struct bpf_program *bpf) {
+static int pcap_inject_acn(pcap_t *p, const void *buf _U_, size_t size _U_) {
+	strlcpy(p-&gt;errbuf, &quot;Sending packets isn't supported on ACN adapters&quot;,
+	    PCAP_ERRBUF_SIZE);
+	return (-1);
+}
+
+static int pcap_setfilter_acn(pcap_t *handle, struct bpf_program *bpf) {
+	int				fd = handle-&gt;fd;
 	int				count;
 	struct bpf_insn	*p;
 	uint16_t		shortInt;
@@ -843,7 +850,13 @@ int acn_setfilter(int fd, struct bpf_program *bpf) {
 	return 0;
 }
 
-int acn_read_n_bytes_with_timeout(pcap_t *handle, int count) {
+static int pcap_setdirection_acn(pcap_t *handle, pcap_direction_t d) {
+	snprintf(handle-&gt;errbuf, sizeof(handle-&gt;errbuf),
+	    &quot;Setting direction is not supported on ACN adapters&quot;);
+	return -1;
+}
+
+static int acn_read_n_bytes_with_timeout(pcap_t *handle, int count) {
 	struct		timeval tv;
 	int			retval, fd;
 	fd_set		r_fds;
@@ -880,7 +893,7 @@ int acn_read_n_bytes_with_timeout(pcap_t *handle, int count) {
 	return 0;
 }
 
-int pcap_read_acn(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user) {
+static int pcap_read_acn(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user) {
 	#define HEADER_SIZE (4 * 4)
 	unsigned char		packet_header[HEADER_SIZE];
 	struct pcap_pkthdr	pcap_header;
@@ -903,3 +916,61 @@ int pcap_read_acn(pcap_t *handle, int max_packets, pcap_handler callback, u_char
 	callback(user, &amp;pcap_header, handle-&gt;bp);										/* call the user supplied callback function */
 	return 1;
 }
+
+pcap_t *pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char *ebuf) {
+	pcap_t		*handle;
+	int		fd;
+
+	/* Allocate a handle for this session. */
+
+	handle = malloc(sizeof(*handle));
+	if (handle == NULL) {
+		snprintf(ebuf, PCAP_ERRBUF_SIZE, &quot;malloc: %s&quot;,
+			 pcap_strerror(errno));
+		return NULL;
+	}
+
+	/* Initialize some components of the pcap structure. */
+
+	memset(handle, 0, sizeof(*handle));
+	handle-&gt;snapshot	= snaplen;
+	handle-&gt;md.timeout	= to_ms;
+
+	handle-&gt;inject_op = pcap_inject_acn;
+	handle-&gt;setfilter_op = pcap_setfilter_acn;
+	handle-&gt;setdirection_op = pcap_setdirection_acn;
+	handle-&gt;set_datalink_op = NULL;	/* can't change data link type */
+	handle-&gt;getnonblock_op = pcap_getnonblock_fd;
+	handle-&gt;setnonblock_op = pcap_setnonblock_fd;
+	handle-&gt;close_op = pcap_close_acn;
+	handle-&gt;read_op = pcap_read_acn;
+	handle-&gt;stats_op = pcap_stats_acn;
+
+	fd = acn_open_live(device, ebuf, &amp;handle-&gt;linktype);
+	if (fd == -1) {
+		free(handle);
+		return NULL;
+	}
+	handle-&gt;md.clear_promisc = promisc;
+	handle-&gt;fd = fd;
+	handle-&gt;bufsize = handle-&gt;snapshot;
+
+	/* Allocate the buffer */
+
+	handle-&gt;buffer	 = malloc(handle-&gt;bufsize + handle-&gt;offset);
+	if (!handle-&gt;buffer) {
+	        snprintf(ebuf, PCAP_ERRBUF_SIZE,
+			 &quot;malloc: %s&quot;, pcap_strerror(errno));
+		pcap_close_acn(handle);
+		free(handle);
+		return NULL;
+	}
+
+	/*
+	 * &quot;handle-&gt;fd&quot; is a socket, so &quot;select()&quot; and &quot;poll()&quot;
+	 * should work on it.
+	 */
+	handle-&gt;selectable_fd = handle-&gt;fd;
+
+	return handle;
+}</diff>
      <filename>pcap-sita.c</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,5 @@
  * @(#) $Header: /tcpdump/master/libpcap/pcap-sita.h
  */
 
-void pcap_close_acn(pcap_t *handle);
-int pcap_stats_acn(pcap_t *handle, struct pcap_stat *ps);
-int pcap_read_acn(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user);
-
+extern int acn_parse_hosts_file(char *errbuf);
+extern int acn_findalldevs(char *errbuf);</diff>
      <filename>pcap-sita.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>92c5d33d7a89c624e90b55f95bb7fbc49ec06c5f</id>
    </parent>
  </parents>
  <author>
    <name>guy</name>
    <email>guy</email>
  </author>
  <url>http://github.com/mcr/libpcap/commit/f57d847d09ec7bbbedcda357c87b1895ce397872</url>
  <id>f57d847d09ec7bbbedcda357c87b1895ce397872</id>
  <committed-date>2008-01-06T12:23:17-08:00</committed-date>
  <authored-date>2008-01-06T12:23:17-08:00</authored-date>
  <message>The SITA code in pcap-linux.c shares very little with the Linux code;
move it into pcap-sita.c, and make --with-sita set the pcap type to
&quot;sita&quot;, so we build pcap-sita.c instead of, rather than in addition to,
pcap-linux.c.

Use &quot;bpf_u_int32&quot; rather than &quot;ulong&quot; in the SITA code, as it's intended
to be 32 bits long (the &quot;l&quot; in &quot;htonl()&quot; and &quot;ntohl()&quot; is historical -
they work on 32-bit quantities, and the &quot;l&quot; dates back to the days when
32-bit processors were a bit newer and 16-bit Unix was more common).

Those changes also, at least in theory, makes the SITA support work on
other Unix-compatible platforms; note that in README.sita.

Clean up pcap-sita.c, making routines no longer called outside it
static, folding trivial wrappers, and fixing various warnings.

Put the routines used by fad-sita.c and defined by pcap-sita.c into
pcap-sita.h.  Remove from pcap-sita.h the files that are now static to
pcap-sita.c.  Include pcap-sita.h in both fad-sita.c and pcap-sita.c, so
that we do cross-file prototype checking.</message>
  <tree>a2c83f14b4e8052c6b2d032a5a77749e1fb3a2bf</tree>
  <committer>
    <name>guy</name>
    <email>guy</email>
  </committer>
</commit>
