pcap-stdinc.h revision 190225
1127664Sbms/*
2214518Srpaulo * Copyright (c) 2002 - 2003
3214518Srpaulo * NetGroup, Politecnico di Torino (Italy)
4127664Sbms * All rights reserved.
5127664Sbms *
6127664Sbms * Redistribution and use in source and binary forms, with or without
7127664Sbms * modification, are permitted provided that the following conditions
8127664Sbms * are met:
9127664Sbms *
10127664Sbms * 1. Redistributions of source code must retain the above copyright
11127664Sbms * notice, this list of conditions and the following disclaimer.
12127664Sbms * 2. Redistributions in binary form must reproduce the above copyright
13127664Sbms * notice, this list of conditions and the following disclaimer in the
14127664Sbms * documentation and/or other materials provided with the distribution.
15127664Sbms * 3. Neither the name of the Politecnico di Torino nor the names of its
16127664Sbms * contributors may be used to endorse or promote products derived from
17127664Sbms * this software without specific prior written permission.
18127664Sbms *
19127664Sbms * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20127664Sbms * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21127664Sbms * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22127664Sbms * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23127664Sbms * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24127664Sbms * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25127664Sbms * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26127664Sbms * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27127664Sbms * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28127664Sbms * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29127664Sbms * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30127664Sbms *
31190225Srpaulo * @(#) $Header: /tcpdump/master/libpcap/pcap-stdinc.h,v 1.10.2.1 2008-10-06 15:38:39 gianluca Exp $ (LBL)
32127664Sbms */
33214518Srpaulo
34214518Srpaulo#define SIZEOF_CHAR 1
35127664Sbms#define SIZEOF_SHORT 2
36127664Sbms#define SIZEOF_INT 4
37127664Sbms#ifndef _MSC_EXTENSIONS
38127664Sbms#define SIZEOF_LONG_LONG 8
39162012Ssam#endif
40162012Ssam
41162012Ssam/*
42127664Sbms * Avoids a compiler warning in case this was already defined
43127664Sbms * (someone defined _WINSOCKAPI_ when including 'windows.h', in order
44127664Sbms * to prevent it from including 'winsock.h')
45127664Sbms */
46127664Sbms#ifdef _WINSOCKAPI_
47127664Sbms#undef _WINSOCKAPI_
48127664Sbms#endif
49127664Sbms#include <winsock2.h>
50127664Sbms
51127664Sbms#include <fcntl.h>
52127664Sbms
53127664Sbms#include "bittypes.h"
54127664Sbms#include <time.h>
55127664Sbms#include <io.h>
56127664Sbms
57127664Sbms#ifndef __MINGW32__
58127664Sbms#include "IP6_misc.h"
59127664Sbms#endif
60127664Sbms
61127664Sbms#define caddr_t char*
62127664Sbms
63127664Sbms#define snprintf _snprintf
64127664Sbms#define vsnprintf _vsnprintf
65214518Srpaulo#define strdup _strdup
66127664Sbms#define inline __inline
67127664Sbms
68190225Srpaulo#ifdef __MINGW32__
69214518Srpaulo#include <stdint.h>
70214518Srpaulo#else /*__MINGW32__*/
71127664Sbms/* MSVC compiler */
72190225Srpaulo#ifndef _UINTPTR_T_DEFINED
73190225Srpaulo#ifdef  _WIN64
74190225Srpaulotypedef unsigned __int64    uintptr_t;
75190225Srpaulo#else
76190225Srpaulotypedef _W64 unsigned int   uintptr_t;
77190225Srpaulo#endif
78190225Srpaulo#define _UINTPTR_T_DEFINED
79190225Srpaulo#endif
80190225Srpaulo
81190225Srpaulo#ifndef _INTPTR_T_DEFINED
82190225Srpaulo#ifdef  _WIN64
83190225Srpaulotypedef __int64    intptr_t;
84190225Srpaulo#else
85190225Srpaulotypedef _W64 int   intptr_t;
86190225Srpaulo#endif
87190225Srpaulo#define _INTPTR_T_DEFINED
88190225Srpaulo#endif
89190225Srpaulo
90190225Srpaulo#endif /*__MINGW32__*/
91190225Srpaulo