pcap-stdinc.h revision 214518
1127664Sbms/*
2127664Sbms * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3127664Sbms * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California)
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 */
33127664Sbms#ifndef pcap_stdinc_h
34127664Sbms#define pcap_stdinc_h
35127664Sbms
36127664Sbms#define SIZEOF_CHAR 1
37162012Ssam#define SIZEOF_SHORT 2
38162012Ssam#define SIZEOF_INT 4
39162012Ssam#ifndef _MSC_EXTENSIONS
40127664Sbms#define SIZEOF_LONG_LONG 8
41127664Sbms#endif
42127664Sbms
43127664Sbms/*
44127664Sbms * Avoids a compiler warning in case this was already defined
45127664Sbms * (someone defined _WINSOCKAPI_ when including 'windows.h', in order
46127664Sbms * to prevent it from including 'winsock.h')
47127664Sbms */
48127664Sbms#ifdef _WINSOCKAPI_
49127664Sbms#undef _WINSOCKAPI_
50127664Sbms#endif
51127664Sbms#include <winsock2.h>
52127664Sbms
53127664Sbms#include <fcntl.h>
54127664Sbms
55127664Sbms#include "bittypes.h"
56127664Sbms#include <time.h>
57127664Sbms#include <io.h>
58127664Sbms
59127664Sbms#ifndef __MINGW32__
60127664Sbms#include "IP6_misc.h"
61127664Sbms#endif
62127664Sbms
63127664Sbms#define caddr_t char*
64127664Sbms
65190225Srpaulo#if _MSC_VER < 1500
66127664Sbms#define snprintf _snprintf
67190225Srpaulo#define vsnprintf _vsnprintf
68190225Srpaulo#define strdup _strdup
69190225Srpaulo#endif
70190225Srpaulo
71190225Srpaulo#define inline __inline
72190225Srpaulo
73190225Srpaulo#ifdef __MINGW32__
74190225Srpaulo#include <stdint.h>
75190225Srpaulo#else /*__MINGW32__*/
76190225Srpaulo/* MSVC compiler */
77190225Srpaulo#ifndef _UINTPTR_T_DEFINED
78190225Srpaulo#ifdef  _WIN64
79190225Srpaulotypedef unsigned __int64    uintptr_t;
80190225Srpaulo#else
81190225Srpaulotypedef _W64 unsigned int   uintptr_t;
82190225Srpaulo#endif
83190225Srpaulo#define _UINTPTR_T_DEFINED
84190225Srpaulo#endif
85190225Srpaulo
86190225Srpaulo#ifndef _INTPTR_T_DEFINED
87190225Srpaulo#ifdef  _WIN64
88190225Srpaulotypedef __int64    intptr_t;
89190225Srpaulo#else
90190225Srpaulotypedef _W64 int   intptr_t;
91#endif
92#define _INTPTR_T_DEFINED
93#endif
94
95#endif /*__MINGW32__*/
96#endif /* pcap_stdinc_h */
97