zhangzengfei
2022-07-20 c90c3e794bdd95127d0c34ff1d9e8759d18a0445
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
/****************************************************************************
 *
 *  Copyright (C) 2000-2001 RealNetworks, Inc. All rights reserved.
 *
 *  This program is free software.  It may be distributed under the terms
 *  in the file LICENSE, found in the top level of the source distribution.
 *
 */
 
#ifndef _TYPES_H
#define _TYPES_H
 
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
 
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <time.h>
#include <sys/stat.h>
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif
 
#ifdef _UNIX
#ifdef SOLARIS_GCC_HACK
#include "/usr/include/sys/types.h"
#else
#include <sys/types.h>
#endif
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/stat.h>
#endif
 
#ifndef NULL
#define NULL 0
#endif
 
typedef void* PVOID;
typedef const void* CPVOID;
 
typedef char* PCHAR;
typedef const char* CPCHAR;
 
typedef unsigned char Byte;
typedef unsigned char* PByte;
typedef const unsigned char* CPByte;
 
typedef signed   char INT8;
typedef unsigned char UINT8;
 
typedef signed   short INT16;
//typedef unsigned short WORD;
typedef unsigned short UINT16;
 
typedef signed   int INT32;
 
#ifdef __x86_64__
typedef unsigned long UINT32;
#else
typedef unsigned int UINT32;
#endif
 
// time_t is signed
#define MAX_TIME_T 0x7FFFFFFF
 
#ifndef HIWORD
#define HIWORD(dw) ((dw)>>16)
#endif
#ifndef LOWORD
#define LOWORD(dw) ((dw)&0xffff)
#endif
#ifndef MAKEDWORD
#define MAKEDWORD(w1,w2) (((w1)<<16)|(w2))
#endif
 
#ifndef INADDR_NONE
#define INADDR_NONE ((UINT32)0xFFFFFFFF)
#endif
#ifndef INADDR_ANY
#define INADDR_ANY  ((UINT32)0x00000000)
#endif
 
#if defined(_WIN32) || defined(_SOLARIS)
int inet_aton( const char*, struct in_addr* );
#endif
 
// Routines to copy and byteswap blocks of memory
// Note: cnt is always the ordinal number of values, NOT bytes
void htons_buf( UINT16* pnbuf, const void* phbuf, UINT32 cnt );
void ntohs_buf( UINT16* phbuf, const void* pnbuf, UINT32 cnt );
void htonl_buf( UINT32* pnbuf, const void* phbuf, UINT32 cnt );
void ntohl_buf( UINT32* phbuf, const void* pnbuf, UINT32 cnt );
 
#endif //ndef _TYPES_H