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 __PCAP_RPCAP_INT_H__ 35335640Shselasky#define __PCAP_RPCAP_INT_H__ 36335640Shselasky 37335640Shselasky#include "pcap.h" 38335640Shselasky#include "sockutils.h" /* Needed for some structures (like SOCKET, sockaddr_in) which are used here */ 39335640Shselasky 40335640Shselasky/* 41335640Shselasky * \file pcap-rpcap-int.h 42335640Shselasky * 43335640Shselasky * This file keeps all the definitions used by the RPCAP client and server, 44335640Shselasky * other than the protocol definitions. 45335640Shselasky * 46335640Shselasky * \warning All the RPCAP functions that are allowed to return a buffer containing 47335640Shselasky * the error description can return max PCAP_ERRBUF_SIZE characters. 48335640Shselasky * However there is no guarantees that the string will be zero-terminated. 49335640Shselasky * Best practice is to define the errbuf variable as a char of size 'PCAP_ERRBUF_SIZE+1' 50335640Shselasky * and to insert manually the termination char at the end of the buffer. This will 51335640Shselasky * guarantee that no buffer overflows occur even if we use the printf() to show 52335640Shselasky * the error on the screen. 53335640Shselasky */ 54335640Shselasky 55335640Shselasky/********************************************************* 56335640Shselasky * * 57335640Shselasky * General definitions / typedefs for the RPCAP protocol * 58335640Shselasky * * 59335640Shselasky *********************************************************/ 60335640Shselasky 61335640Shselasky/* 62335640Shselasky * \brief Buffer used by socket functions to send-receive packets. 63335640Shselasky * In case you plan to have messages larger than this value, you have to increase it. 64335640Shselasky */ 65335640Shselasky#define RPCAP_NETBUF_SIZE 64000 66335640Shselasky 67335640Shselasky/********************************************************* 68335640Shselasky * * 69335640Shselasky * Exported function prototypes * 70335640Shselasky * * 71335640Shselasky *********************************************************/ 72335640Shselaskyvoid rpcap_createhdr(struct rpcap_header *header, uint8 type, uint16 value, uint32 length); 73335640Shselaskyint rpcap_senderror(SOCKET sock, char *error, unsigned short errcode, char *errbuf); 74335640Shselasky 75335640Shselasky#endif 76