1335640Shselasky/*
2335640Shselasky * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3335640Shselasky * Copyright (c) 2005 - 2008 CACE Technologies, Davis (California)
4335640Shselasky * All rights reserved.
5335640Shselasky *
6335640Shselasky * Redistribution and use in source and binary forms, with or without
7335640Shselasky * modification, are permitted provided that the following conditions
8335640Shselasky * are met:
9335640Shselasky *
10335640Shselasky * 1. Redistributions of source code must retain the above copyright
11335640Shselasky * notice, this list of conditions and the following disclaimer.
12335640Shselasky * 2. Redistributions in binary form must reproduce the above copyright
13335640Shselasky * notice, this list of conditions and the following disclaimer in the
14335640Shselasky * documentation and/or other materials provided with the distribution.
15335640Shselasky * 3. Neither the name of the Politecnico di Torino, CACE Technologies
16335640Shselasky * nor the names of its contributors may be used to endorse or promote
17335640Shselasky * products derived from this software without specific prior written
18335640Shselasky * permission.
19335640Shselasky *
20335640Shselasky * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21335640Shselasky * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22335640Shselasky * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23335640Shselasky * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24335640Shselasky * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25335640Shselasky * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26335640Shselasky * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27335640Shselasky * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28335640Shselasky * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29335640Shselasky * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30335640Shselasky * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31335640Shselasky *
32335640Shselasky */
33335640Shselasky
34335640Shselasky#ifndef __RPCAP_PROTOCOL_H__
35335640Shselasky#define __RPCAP_PROTOCOL_H__
36335640Shselasky
37335640Shselasky#define RPCAP_DEFAULT_NETPORT "2002" /* Default port on which the RPCAP daemon is waiting for connections. */
38335640Shselasky/* Default port on which the client workstation is waiting for connections in case of active mode. */
39335640Shselasky#define RPCAP_DEFAULT_NETPORT_ACTIVE "2003"
40335640Shselasky#define RPCAP_DEFAULT_NETADDR ""	/* Default network address on which the RPCAP daemon binds to. */
41335640Shselasky
42335640Shselasky/*
43335640Shselasky * Minimum and maximum supported versions of the protocol.
44335640Shselasky *
45335640Shselasky * If new message types are added, the protocol version MUST be changed,
46335640Shselasky * so that a client knows, from the negotiated protocol version, what
47335640Shselasky * messages can be sent to the server.
48335640Shselasky *
49335640Shselasky * If the format of an existing message type is changed, the protocol
50335640Shselasky * version MUST be changed, so that each side knows, from the negotiated
51335640Shselasky * protocol version, what format should be used.
52335640Shselasky *
53335640Shselasky * The RPCAP_MSG_ERROR format MUST not change, as it's used to, among
54335640Shselasky * other things, report "incorrect version number" errors, where, if
55335640Shselasky * the format changed, the sender of the message might not know what
56335640Shselasky * versions the recipient would understand, or might know a version
57335640Shselasky * they support (the version number they sent) but might not know
58335640Shselasky * the format of the message in that version.
59335640Shselasky *
60335640Shselasky * Other message versions SHOULD not change, as that would complicate
61335640Shselasky * the process of interpreting the message, making it version-dependent.
62335640Shselasky * Introducing a new message with a new format is preferable.
63335640Shselasky *
64335640Shselasky * Version negotiation is done as part of the authentication process:
65335640Shselasky *
66356341Scy * The client sends an authentication request, with a version number
67356341Scy * of 0.  All servers must accept authentication requests with a version
68356341Scy * number of 0, even if they don't support version 0 for any other
69356341Scy * requests.
70335640Shselasky *
71356341Scy * The server attempts to authenticate the client.  If that succeeds,
72356341Scy * older servers - which only support version 0 - will send an
73356341Scy * authentication reply with no payload.  Newer servers - which might
74356341Scy * support other versions - will send an authentication reply with
75356341Scy * a payload giving the minimum and maximum versions it supports.
76335640Shselasky *
77356341Scy * The client attempts to find the largest version number that is
78356341Scy * in both its range of supported versions and the server's supported
79356341Scy * versions.  If it fails, it gives up; otherwise, it uses that version.
80335640Shselasky */
81335640Shselasky#define RPCAP_MIN_VERSION 0
82335640Shselasky#define RPCAP_MAX_VERSION 0
83335640Shselasky
84335640Shselasky/*
85335640Shselasky * Version numbers are unsigned, so if RPCAP_MIN_VERSION is 0, they
86335640Shselasky * are >= the minimum version, by definition; don't check against
87335640Shselasky * RPCAP_MIN_VERSION, as you may get compiler warnings that the
88335640Shselasky * comparison will always succeed.
89335640Shselasky */
90335640Shselasky#if RPCAP_MIN_VERSION == 0
91356341Scy#define RPCAP_VERSION_IS_SUPPORTED(v)	\
92356341Scy	((v) <= RPCAP_MAX_VERSION)
93335640Shselasky#else
94335640Shselasky#define RPCAP_VERSION_IS_SUPPORTED(v)	\
95335640Shselasky	((v) >= RPCAP_MIN_VERSION && (v) <= RPCAP_MAX_VERSION)
96335640Shselasky#endif
97335640Shselasky
98335640Shselasky/*
99335640Shselasky * Separators used for the host list.
100335640Shselasky *
101335640Shselasky * It is used:
102335640Shselasky * - by the rpcapd daemon, when you types a list of allowed connecting hosts
103335640Shselasky * - by the rpcap client in active mode, when the client waits for incoming
104335640Shselasky * connections from other hosts
105335640Shselasky */
106335640Shselasky#define RPCAP_HOSTLIST_SEP " ,;\n\r"
107335640Shselasky
108335640Shselasky/*********************************************************
109335640Shselasky *                                                       *
110335640Shselasky * Protocol messages formats                             *
111335640Shselasky *                                                       *
112335640Shselasky *********************************************************/
113335640Shselasky/*
114335640Shselasky * WARNING: This file defines some structures that are used to transfer
115335640Shselasky * data on the network.
116335640Shselasky * Note that your compiler MUST not insert padding into these structures
117335640Shselasky * for better alignment.
118335640Shselasky * These structures have been created in order to be correctly aligned to
119335640Shselasky * a 32-bit boundary, but be careful in any case.
120356341Scy *
121356341Scy * The layout of these structures MUST not be changed.  If a packet
122356341Scy * format is different in different versions of the protocol, versions
123356341Scy * of the structure should be provided for all the different versions or
124356341Scy * version ranges (if more than one version of the protocol has the same
125356341Scy * layout) that we support.
126335640Shselasky */
127335640Shselasky
128335640Shselasky/*
129335640Shselasky * WARNING: These typedefs MUST be of a specific size.
130335640Shselasky * You might have to change them on your platform.
131335640Shselasky *
132335640Shselasky * XXX - use the C99 types?  Microsoft's newer versions of Visual Studio
133335640Shselasky * support them.
134335640Shselasky */
135335640Shselaskytypedef unsigned char uint8;	/* 8-bit unsigned integer */
136335640Shselaskytypedef unsigned short uint16;	/* 16-bit unsigned integer */
137335640Shselaskytypedef unsigned int uint32;	/* 32-bit unsigned integer */
138335640Shselaskytypedef int int32;		/* 32-bit signed integer */
139335640Shselasky
140335640Shselasky/* Common header for all the RPCAP messages */
141335640Shselaskystruct rpcap_header
142335640Shselasky{
143335640Shselasky	uint8 ver;	/* RPCAP version number */
144335640Shselasky	uint8 type;	/* RPCAP message type (error, findalldevs, ...) */
145335640Shselasky	uint16 value;	/* Message-dependent value (not always used) */
146335640Shselasky	uint32 plen;	/* Length of the payload of this RPCAP message */
147335640Shselasky};
148335640Shselasky
149356341Scy/*
150356341Scy * Format of data that may appear at the end of an authentication reply,
151356341Scy * giving the minimum and maximum versions of the protocol that the
152356341Scy * server supports.
153356341Scy *
154356341Scy * Older servers don't provide this; they support only version 0.
155356341Scy */
156356341Scystruct rpcap_authreply
157356341Scy{
158356341Scy	uint8 minvers;	/* Minimum version supported */
159356341Scy	uint8 maxvers;	/* Maximum version supported */
160356341Scy};
161356341Scy
162335640Shselasky/* Format of the message for the interface description (findalldevs command) */
163335640Shselaskystruct rpcap_findalldevs_if
164335640Shselasky{
165335640Shselasky	uint16 namelen;	/* Length of the interface name */
166335640Shselasky	uint16 desclen;	/* Length of the interface description */
167335640Shselasky	uint32 flags;	/* Interface flags */
168335640Shselasky	uint16 naddr;	/* Number of addresses */
169335640Shselasky	uint16 dummy;	/* Must be zero */
170335640Shselasky};
171335640Shselasky
172335640Shselasky/*
173335640Shselasky * Format of an address as sent over the wire.
174335640Shselasky *
175335640Shselasky * Do *NOT* use struct sockaddr_storage, as the layout for that is
176335640Shselasky * machine-dependent.
177335640Shselasky *
178335640Shselasky * RFC 2553 gives two sample layouts, both of which are 128 bytes long,
179335640Shselasky * both of which are aligned on an 8-byte boundary, and both of which
180335640Shselasky * have 2 bytes before the address data.
181335640Shselasky *
182335640Shselasky * However, one has a 2-byte address family value at the beginning
183335640Shselasky * and the other has a 1-byte address length value and a 1-byte
184335640Shselasky * address family value; this reflects the fact that the original
185335640Shselasky * BSD sockaddr structure had a 2-byte address family value, which
186335640Shselasky * was later changed to a 1-byte address length value and a 1-byte
187335640Shselasky * address family value, when support for variable-length OSI
188335640Shselasky * network-layer addresses was added.
189335640Shselasky *
190335640Shselasky * Furthermore, Solaris's struct sockaddr_storage is 256 bytes
191335640Shselasky * long.
192335640Shselasky *
193335640Shselasky * This structure is supposed to be aligned on an 8-byte boundary;
194335640Shselasky * the message header is 8 bytes long, so we don't have to do
195335640Shselasky * anything to ensure it's aligned on that boundary within a packet,
196335640Shselasky * so we just define it as 128 bytes long, with a 2-byte address
197335640Shselasky * family.  (We only support IPv4 and IPv6 addresses, which are fixed-
198335640Shselasky * length.)  That way, it's the same size as sockaddr_storage on
199335640Shselasky * Windows, and it'll look like what an older Windows client will
200335640Shselasky * expect.
201335640Shselasky *
202335640Shselasky * In addition, do *NOT* use the host's AF_ value for an address,
203335640Shselasky * as the value for AF_INET6 is machine-dependent.  We use the
204335640Shselasky * Windows value, so it'll look like what an older Windows client
205335640Shselasky * will expect.
206335640Shselasky *
207335640Shselasky * (The Windows client is the only one that has been distributed
208335640Shselasky * as a standard part of *pcap; UN*X clients are probably built
209335640Shselasky * from source by the user or administrator, so they're in a
210335640Shselasky * better position to upgrade an old client.  Therefore, we
211335640Shselasky * try to make what goes over the wire look like what comes
212335640Shselasky * from a Windows server.)
213335640Shselasky */
214335640Shselaskystruct rpcap_sockaddr
215335640Shselasky{
216335640Shselasky	uint16	family;			/* Address family */
217335640Shselasky	char	data[128-2];		/* Data */
218335640Shselasky};
219335640Shselasky
220335640Shselasky/*
221335640Shselasky * Format of an IPv4 address as sent over the wire.
222335640Shselasky */
223335640Shselasky#define RPCAP_AF_INET	2		/* Value on all OSes */
224335640Shselaskystruct rpcap_sockaddr_in
225335640Shselasky{
226335640Shselasky	uint16	family;			/* Address family */
227335640Shselasky	uint16	port;			/* Port number */
228335640Shselasky	uint32	addr;			/* IPv4 address */
229335640Shselasky	uint8	zero[8];		/* Padding */
230335640Shselasky};
231335640Shselasky
232335640Shselasky/*
233335640Shselasky * Format of an IPv6 address as sent over the wire.
234335640Shselasky */
235335640Shselasky#define RPCAP_AF_INET6	23		/* Value on Windows */
236335640Shselaskystruct rpcap_sockaddr_in6
237335640Shselasky{
238335640Shselasky	uint16	family;			/* Address family */
239335640Shselasky	uint16	port;			/* Port number */
240335640Shselasky	uint32	flowinfo;		/* IPv6 flow information */
241335640Shselasky	uint8	addr[16];		/* IPv6 address */
242335640Shselasky	uint32	scope_id;		/* Scope zone index */
243335640Shselasky};
244335640Shselasky
245335640Shselasky/* Format of the message for the address listing (findalldevs command) */
246335640Shselaskystruct rpcap_findalldevs_ifaddr
247335640Shselasky{
248335640Shselasky	struct rpcap_sockaddr addr;		/* Network address */
249335640Shselasky	struct rpcap_sockaddr netmask;		/* Netmask for that address */
250335640Shselasky	struct rpcap_sockaddr broadaddr;	/* Broadcast address for that address */
251335640Shselasky	struct rpcap_sockaddr dstaddr;		/* P2P destination address for that address */
252335640Shselasky};
253335640Shselasky
254335640Shselasky/*
255335640Shselasky * \brief Format of the message of the connection opening reply (open command).
256335640Shselasky *
257335640Shselasky * This structure transfers over the network some of the values useful on the client side.
258335640Shselasky */
259335640Shselaskystruct rpcap_openreply
260335640Shselasky{
261335640Shselasky	int32 linktype;	/* Link type */
262335640Shselasky	int32 tzoff;	/* Timezone offset */
263335640Shselasky};
264335640Shselasky
265335640Shselasky/* Format of the message that starts a remote capture (startcap command) */
266335640Shselaskystruct rpcap_startcapreq
267335640Shselasky{
268335640Shselasky	uint32 snaplen;		/* Length of the snapshot (number of bytes to capture for each packet) */
269335640Shselasky	uint32 read_timeout;	/* Read timeout in milliseconds */
270335640Shselasky	uint16 flags;		/* Flags (see RPCAP_STARTCAPREQ_FLAG_xxx) */
271335640Shselasky	uint16 portdata;	/* Network port on which the client is waiting at (if 'serveropen') */
272335640Shselasky};
273335640Shselasky
274335640Shselasky/* Format of the reply message that devoted to start a remote capture (startcap reply command) */
275335640Shselaskystruct rpcap_startcapreply
276335640Shselasky{
277335640Shselasky	int32 bufsize;		/* Size of the user buffer allocated by WinPcap; it can be different from the one we chose */
278335640Shselasky	uint16 portdata;	/* Network port on which the server is waiting at (passive mode only) */
279335640Shselasky	uint16 dummy;		/* Must be zero */
280335640Shselasky};
281335640Shselasky
282335640Shselasky/*
283335640Shselasky * \brief Format of the header which encapsulates captured packets when transmitted on the network.
284335640Shselasky *
285335640Shselasky * This message requires the general header as well, since we want to be able to exchange
286335640Shselasky * more information across the network in the future (for example statistics, and kind like that).
287335640Shselasky */
288335640Shselaskystruct rpcap_pkthdr
289335640Shselasky{
290335640Shselasky	uint32 timestamp_sec;	/* 'struct timeval' compatible, it represents the 'tv_sec' field */
291335640Shselasky	uint32 timestamp_usec;	/* 'struct timeval' compatible, it represents the 'tv_usec' field */
292335640Shselasky	uint32 caplen;		/* Length of portion present in the capture */
293335640Shselasky	uint32 len;		/* Real length this packet (off wire) */
294335640Shselasky	uint32 npkt;		/* Ordinal number of the packet (i.e. the first one captured has '1', the second one '2', etc) */
295335640Shselasky};
296335640Shselasky
297335640Shselasky/* General header used for the pcap_setfilter() command; keeps just the number of BPF instructions */
298335640Shselaskystruct rpcap_filter
299335640Shselasky{
300335640Shselasky	uint16 filtertype;	/* type of the filter transferred (BPF instructions, ...) */
301335640Shselasky	uint16 dummy;		/* Must be zero */
302335640Shselasky	uint32 nitems;		/* Number of items contained into the filter (e.g. BPF instructions for BPF filters) */
303335640Shselasky};
304335640Shselasky
305335640Shselasky/* Structure that keeps a single BPF instuction; it is repeated 'ninsn' times according to the 'rpcap_filterbpf' header */
306335640Shselaskystruct rpcap_filterbpf_insn
307335640Shselasky{
308335640Shselasky	uint16 code;	/* opcode of the instruction */
309335640Shselasky	uint8 jt;	/* relative offset to jump to in case of 'true' */
310335640Shselasky	uint8 jf;	/* relative offset to jump to in case of 'false' */
311335640Shselasky	int32 k;	/* instruction-dependent value */
312335640Shselasky};
313335640Shselasky
314335640Shselasky/* Structure that keeps the data required for the authentication on the remote host */
315335640Shselaskystruct rpcap_auth
316335640Shselasky{
317335640Shselasky	uint16 type;	/* Authentication type */
318335640Shselasky	uint16 dummy;	/* Must be zero */
319335640Shselasky	uint16 slen1;	/* Length of the first authentication item (e.g. username) */
320335640Shselasky	uint16 slen2;	/* Length of the second authentication item (e.g. password) */
321335640Shselasky};
322335640Shselasky
323335640Shselasky/* Structure that keeps the statistics about the number of packets captured, dropped, etc. */
324335640Shselaskystruct rpcap_stats
325335640Shselasky{
326335640Shselasky	uint32 ifrecv;		/* Packets received by the kernel filter (i.e. pcap_stats.ps_recv) */
327335640Shselasky	uint32 ifdrop;		/* Packets dropped by the network interface (e.g. not enough buffers) (i.e. pcap_stats.ps_ifdrop) */
328335640Shselasky	uint32 krnldrop;	/* Packets dropped by the kernel filter (i.e. pcap_stats.ps_drop) */
329335640Shselasky	uint32 svrcapt;		/* Packets captured by the RPCAP daemon and sent on the network */
330335640Shselasky};
331335640Shselasky
332335640Shselasky/* Structure that is needed to set sampling parameters */
333335640Shselaskystruct rpcap_sampling
334335640Shselasky{
335335640Shselasky	uint8 method;	/* Sampling method */
336335640Shselasky	uint8 dummy1;	/* Must be zero */
337335640Shselasky	uint16 dummy2;	/* Must be zero */
338335640Shselasky	uint32 value;	/* Parameter related to the sampling method */
339335640Shselasky};
340335640Shselasky
341356341Scy/*
342356341Scy * Messages field coding.
343356341Scy *
344356341Scy * These values are used in messages sent over the network, and MUST
345356341Scy * not be changed.
346356341Scy */
347335640Shselasky#define RPCAP_MSG_IS_REPLY		0x080	/* Flag indicating a reply */
348335640Shselasky
349335640Shselasky#define RPCAP_MSG_ERROR			1	/* Message that keeps an error notification */
350335640Shselasky#define RPCAP_MSG_FINDALLIF_REQ		2	/* Request to list all the remote interfaces */
351335640Shselasky#define RPCAP_MSG_OPEN_REQ		3	/* Request to open a remote device */
352335640Shselasky#define RPCAP_MSG_STARTCAP_REQ		4	/* Request to start a capture on a remote device */
353335640Shselasky#define RPCAP_MSG_UPDATEFILTER_REQ	5	/* Send a compiled filter into the remote device */
354335640Shselasky#define RPCAP_MSG_CLOSE			6	/* Close the connection with the remote peer */
355335640Shselasky#define RPCAP_MSG_PACKET		7	/* This is a 'data' message, which carries a network packet */
356335640Shselasky#define RPCAP_MSG_AUTH_REQ		8	/* Message that keeps the authentication parameters */
357335640Shselasky#define RPCAP_MSG_STATS_REQ		9	/* It requires to have network statistics */
358335640Shselasky#define RPCAP_MSG_ENDCAP_REQ		10	/* Stops the current capture, keeping the device open */
359335640Shselasky#define RPCAP_MSG_SETSAMPLING_REQ	11	/* Set sampling parameters */
360335640Shselasky
361335640Shselasky#define RPCAP_MSG_FINDALLIF_REPLY	(RPCAP_MSG_FINDALLIF_REQ | RPCAP_MSG_IS_REPLY)		/* Keeps the list of all the remote interfaces */
362335640Shselasky#define RPCAP_MSG_OPEN_REPLY		(RPCAP_MSG_OPEN_REQ | RPCAP_MSG_IS_REPLY)		/* The remote device has been opened correctly */
363335640Shselasky#define RPCAP_MSG_STARTCAP_REPLY	(RPCAP_MSG_STARTCAP_REQ | RPCAP_MSG_IS_REPLY)		/* The capture is starting correctly */
364335640Shselasky#define RPCAP_MSG_UPDATEFILTER_REPLY	(RPCAP_MSG_UPDATEFILTER_REQ | RPCAP_MSG_IS_REPLY)	/* The filter has been applied correctly on the remote device */
365335640Shselasky#define RPCAP_MSG_AUTH_REPLY		(RPCAP_MSG_AUTH_REQ | RPCAP_MSG_IS_REPLY)		/* Sends a message that says 'ok, authorization successful' */
366335640Shselasky#define RPCAP_MSG_STATS_REPLY		(RPCAP_MSG_STATS_REQ | RPCAP_MSG_IS_REPLY)		/* Message that keeps the network statistics */
367335640Shselasky#define RPCAP_MSG_ENDCAP_REPLY		(RPCAP_MSG_ENDCAP_REQ | RPCAP_MSG_IS_REPLY)		/* Confirms that the capture stopped successfully */
368335640Shselasky#define RPCAP_MSG_SETSAMPLING_REPLY	(RPCAP_MSG_SETSAMPLING_REQ | RPCAP_MSG_IS_REPLY)		/* Confirms that the capture stopped successfully */
369335640Shselasky
370335640Shselasky#define RPCAP_STARTCAPREQ_FLAG_PROMISC		0x00000001	/* Enables promiscuous mode (default: disabled) */
371335640Shselasky#define RPCAP_STARTCAPREQ_FLAG_DGRAM		0x00000002	/* Use a datagram (i.e. UDP) connection for the data stream (default: use TCP)*/
372335640Shselasky#define RPCAP_STARTCAPREQ_FLAG_SERVEROPEN	0x00000004	/* The server has to open the data connection toward the client */
373335640Shselasky#define RPCAP_STARTCAPREQ_FLAG_INBOUND		0x00000008	/* Capture only inbound packets (take care: the flag has no effect with promiscuous enabled) */
374335640Shselasky#define RPCAP_STARTCAPREQ_FLAG_OUTBOUND		0x00000010	/* Capture only outbound packets (take care: the flag has no effect with promiscuous enabled) */
375335640Shselasky
376335640Shselasky#define RPCAP_UPDATEFILTER_BPF 1			/* This code tells us that the filter is encoded with the BPF/NPF syntax */
377335640Shselasky
378356341Scy/*
379356341Scy * Network error codes.
380356341Scy *
381356341Scy * These values are used in messages sent over the network, and MUST
382356341Scy * not be changed.
383356341Scy */
384356341Scy#define PCAP_ERR_NETW			1	/* Network error */
385356341Scy#define PCAP_ERR_INITTIMEOUT		2	/* The RPCAP initial timeout has expired */
386356341Scy#define PCAP_ERR_AUTH			3	/* Generic authentication error */
387356341Scy#define PCAP_ERR_FINDALLIF		4	/* Generic findalldevs error */
388356341Scy#define PCAP_ERR_NOREMOTEIF		5	/* The findalldevs was ok, but the remote end had no interfaces to list */
389356341Scy#define PCAP_ERR_OPEN			6	/* Generic pcap_open error */
390356341Scy#define PCAP_ERR_UPDATEFILTER		7	/* Generic updatefilter error */
391356341Scy#define PCAP_ERR_GETSTATS		8	/* Generic pcap_stats error */
392356341Scy#define PCAP_ERR_READEX			9	/* Generic pcap_next_ex error */
393356341Scy#define PCAP_ERR_HOSTNOAUTH		10	/* The host is not authorized to connect to this server */
394356341Scy#define PCAP_ERR_REMOTEACCEPT		11	/* Generic pcap_remoteaccept error */
395356341Scy#define PCAP_ERR_STARTCAPTURE		12	/* Generic pcap_startcapture error */
396356341Scy#define PCAP_ERR_ENDCAPTURE		13	/* Generic pcap_endcapture error */
397356341Scy#define PCAP_ERR_RUNTIMETIMEOUT		14	/* The RPCAP run-time timeout has expired */
398356341Scy#define PCAP_ERR_SETSAMPLING		15	/* Error during the settings of sampling parameters */
399356341Scy#define PCAP_ERR_WRONGMSG		16	/* The other end endpoint sent a message which has not been recognized */
400356341Scy#define PCAP_ERR_WRONGVER		17	/* The other end endpoint has a version number that is not compatible with our */
401356341Scy#define PCAP_ERR_AUTH_FAILED		18	/* The user couldn't be authenticated */
402356341Scy#define PCAP_ERR_TLS_REQUIRED		19	/* The server requires TLS to connect */
403356341Scy#define PCAP_ERR_AUTH_TYPE_NOTSUP	20	/* The authentication type isn't supported */
404335640Shselasky
405335640Shselasky/*
406335640Shselasky * \brief Buffer used by socket functions to send-receive packets.
407335640Shselasky * In case you plan to have messages larger than this value, you have to increase it.
408335640Shselasky */
409335640Shselasky#define RPCAP_NETBUF_SIZE 64000
410335640Shselasky
411335640Shselasky/*********************************************************
412335640Shselasky *                                                       *
413335640Shselasky * Routines used by the rpcap client and rpcap daemon    *
414335640Shselasky *                                                       *
415335640Shselasky *********************************************************/
416335640Shselasky
417335640Shselasky#include "sockutils.h"
418335640Shselasky
419335640Shselaskyextern void rpcap_createhdr(struct rpcap_header *header, uint8 ver, uint8 type, uint16 value, uint32 length);
420335640Shselaskyextern const char *rpcap_msg_type_string(uint8 type);
421335640Shselaskyextern int rpcap_senderror(SOCKET sock, uint8 ver, uint16 errcode, const char *error, char *errbuf);
422335640Shselasky
423335640Shselasky#endif
424