1 /*
2  * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3  * Copyright (c) 2005 - 2008 CACE Technologies, Davis (California)
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the Politecnico di Torino, CACE Technologies
16  * nor the names of its contributors may be used to endorse or promote
17  * products derived from this software without specific prior written
18  * permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #ifndef __PCAP_RPCAP_INT_H__
35 #define __PCAP_RPCAP_INT_H__
36 
37 #include "pcap.h"
38 #include "sockutils.h"	/* Needed for some structures (like SOCKET, sockaddr_in) which are used here */
39 
40 /*
41  * \file pcap-rpcap-int.h
42  *
43  * This file keeps all the definitions used by the RPCAP client and server,
44  * other than the protocol definitions.
45  *
46  * \warning All the RPCAP functions that are allowed to return a buffer containing
47  * the error description can return max PCAP_ERRBUF_SIZE characters.
48  * However there is no guarantees that the string will be zero-terminated.
49  * Best practice is to define the errbuf variable as a char of size 'PCAP_ERRBUF_SIZE+1'
50  * and to insert manually the termination char at the end of the buffer. This will
51  * guarantee that no buffer overflows occur even if we use the printf() to show
52  * the error on the screen.
53  */
54 
55 /*********************************************************
56  *                                                       *
57  * General definitions / typedefs for the RPCAP protocol *
58  *                                                       *
59  *********************************************************/
60 
61 /*
62  * \brief Buffer used by socket functions to send-receive packets.
63  * In case you plan to have messages larger than this value, you have to increase it.
64  */
65 #define RPCAP_NETBUF_SIZE 64000
66 
67 /*********************************************************
68  *                                                       *
69  * Exported function prototypes                          *
70  *                                                       *
71  *********************************************************/
72 void rpcap_createhdr(struct rpcap_header *header, uint8 type, uint16 value, uint32 length);
73 int rpcap_senderror(SOCKET sock, char *error, unsigned short errcode, char *errbuf);
74 
75 #endif
76