1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#if defined( WIN32 ) || defined( UNDER_CE )
#pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
#pragma warning( disable : 4275 ) // non dll-interface class 'X' used as base for dll-interface class 'Y'
#pragma warning( disable : 4251 ) // 'm' : class 'X' needs to have dll-interface to be used by clients of class 'Y'
#endif
#include <winsock.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
//#include <assert.h>
#ifdef _WINSOCK2API_
// Some definition missing from winsock2
/*
* Options for use with [gs]etsockopt at the IP level.
*/
#define IP_OPTIONS 1 /* set/get IP per-packet options */
#define IP_MULTICAST_IF 2 /* set/get IP multicast interface */
#define IP_MULTICAST_TTL 3 /* set/get IP multicast timetolive */
#define IP_MULTICAST_LOOP 4 /* set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 5 /* add an IP group membership */
#define IP_DROP_MEMBERSHIP 6 /* drop an IP group membership */
#define IP_TTL 7 /* set/get IP Time To Live */
#define IP_TOS 8 /* set/get IP Type Of Service */
#define IP_DONTFRAGMENT 9 /* set/get IP Don't Fragment flag */
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
#endif
#ifndef IN_CLASSD
#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
#endif
#ifndef UNDER_CE
//#define STL
#endif
#ifdef STL
#include <string>
#include <vector>
#include <map>
#include <list>
using std::string;
using std::vector;
using std::list;
#else
#include "DataTypes.h"
#endif
#ifdef WIN32
#ifndef TRACE
void DebugTrace ( const char *fmt , ... );
#define TRACE DebugTrace
#endif
#ifndef ASSERT
#define ASSERT(expr) \
do { \
if (! (expr) ) \
{\
TRACE( "Assert (%s) at %s:%d\n", #expr, __FILE__ , __LINE__ ); \
DebugBreak(); \
}\
} while (0)
#endif
#elif defined( _WIN32_WCE )
#ifndef TRACE
void DebugTrace ( const char *fmt , ... );
#define TRACE DebugTrace
#endif
#ifndef ASSERT
#define ASSERT(expr) \
do { \
if (! (expr) ) \
{\
TRACE( "Assert (%s) failed in file %s at line %d\r\n", #expr, __FILE__ , __LINE__ ); \
DebugBreak(); \
}\
} while (0)
#endif
#else
#include <assert.h>
#define TRACE printf
#define ASSERT(expr) assert( expr )
#endif
#ifdef WIN32
void* __cdecl operator new(size_t nSize, const char * lpszFileName, int nLine);
void __cdecl operator delete(void *p, const char * lpszFileName, int nLine);
#endif
|