1109998Smarkm/*
2280304Sjkim * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3280304Sjkim * Copyright (c) 2005 - 2008 CACE Technologies, Davis (California)
4280304Sjkim * All rights reserved.
5109998Smarkm *
6109998Smarkm * Redistribution and use in source and binary forms, with or without
7109998Smarkm * modification, are permitted provided that the following conditions
8109998Smarkm * are met:
9109998Smarkm *
10109998Smarkm * 1. Redistributions of source code must retain the above copyright
11109998Smarkm * notice, this list of conditions and the following disclaimer.
12109998Smarkm * 2. Redistributions in binary form must reproduce the above copyright
13109998Smarkm * notice, this list of conditions and the following disclaimer in the
14280304Sjkim * documentation and/or other materials provided with the distribution.
15109998Smarkm * 3. Neither the name of the Politecnico di Torino, CACE Technologies
16109998Smarkm * nor the names of its contributors may be used to endorse or promote
17109998Smarkm * products derived from this software without specific prior written
18109998Smarkm * permission.
19109998Smarkm *
20109998Smarkm * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21109998Smarkm * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22109998Smarkm * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23109998Smarkm * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24109998Smarkm * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25109998Smarkm * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26109998Smarkm * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27109998Smarkm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28109998Smarkm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29109998Smarkm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30109998Smarkm * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31109998Smarkm *
32109998Smarkm */
33109998Smarkm
34109998Smarkm#ifndef __PCAP_RPCAP_INT_H__
35109998Smarkm#define __PCAP_RPCAP_INT_H__
36109998Smarkm
37109998Smarkm#include "pcap.h"
38109998Smarkm#include "sockutils.h"	/* Needed for some structures (like SOCKET, sockaddr_in) which are used here */
39109998Smarkm
40109998Smarkm/*
41109998Smarkm * \file pcap-rpcap-int.h
42109998Smarkm *
43109998Smarkm * This file keeps all the definitions used by the RPCAP client and server,
44109998Smarkm * other than the protocol definitions.
45109998Smarkm *
46109998Smarkm * \warning All the RPCAP functions that are allowed to return a buffer containing
47109998Smarkm * the error description can return max PCAP_ERRBUF_SIZE characters.
48109998Smarkm * However there is no guarantees that the string will be zero-terminated.
49109998Smarkm * Best practice is to define the errbuf variable as a char of size 'PCAP_ERRBUF_SIZE+1'
50109998Smarkm * and to insert manually the termination char at the end of the buffer. This will
51109998Smarkm * guarantee that no buffer overflows occur even if we use the printf() to show
52109998Smarkm * the error on the screen.
53109998Smarkm */
54109998Smarkm
55109998Smarkm/*********************************************************
56109998Smarkm *                                                       *
57109998Smarkm * General definitions / typedefs for the RPCAP protocol *
58109998Smarkm *                                                       *
59160814Ssimon *********************************************************/
60160814Ssimon
61280304Sjkim/*
62160814Ssimon * \brief Buffer used by socket functions to send-receive packets.
63160814Ssimon * In case you plan to have messages larger than this value, you have to increase it.
64109998Smarkm */
65109998Smarkm#define RPCAP_NETBUF_SIZE 64000
66280304Sjkim
67109998Smarkm/*********************************************************
68280304Sjkim *                                                       *
69109998Smarkm * Exported function prototypes                          *
70280304Sjkim *                                                       *
71109998Smarkm *********************************************************/
72109998Smarkmvoid rpcap_createhdr(struct rpcap_header *header, uint8 type, uint16 value, uint32 length);
73109998Smarkmint rpcap_senderror(SOCKET sock, char *error, unsigned short errcode, char *errbuf);
74109998Smarkm
75109998Smarkm#endif
76280304Sjkim