pcap-rpcap-int.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifndef __PCAP_RPCAP_INT_H__
  34. #define __PCAP_RPCAP_INT_H__
  35. #include "pcap.h"
  36. #include "sockutils.h" /* Needed for some structures (like SOCKET, sockaddr_in) which are used here */
  37. /*
  38. * \file pcap-rpcap-int.h
  39. *
  40. * This file keeps all the definitions used by the RPCAP client and server,
  41. * other than the protocol definitions.
  42. *
  43. * \warning All the RPCAP functions that are allowed to return a buffer containing
  44. * the error description can return max PCAP_ERRBUF_SIZE characters.
  45. * However there is no guarantees that the string will be zero-terminated.
  46. * Best practice is to define the errbuf variable as a char of size 'PCAP_ERRBUF_SIZE+1'
  47. * and to insert manually the termination char at the end of the buffer. This will
  48. * guarantee that no buffer overflows occur even if we use the printf() to show
  49. * the error on the screen.
  50. */
  51. /*********************************************************
  52. * *
  53. * General definitions / typedefs for the RPCAP protocol *
  54. * *
  55. *********************************************************/
  56. /*
  57. * \brief Buffer used by socket functions to send-receive packets.
  58. * In case you plan to have messages larger than this value, you have to increase it.
  59. */
  60. #define RPCAP_NETBUF_SIZE 64000
  61. /*********************************************************
  62. * *
  63. * Exported function prototypes *
  64. * *
  65. *********************************************************/
  66. void rpcap_createhdr(struct rpcap_header *header, uint8 type, uint16 value, uint32 length);
  67. int rpcap_senderror(SOCKET sock, char *error, unsigned short errcode, char *errbuf);
  68. #endif