forked from avih/miniweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttppil.h
128 lines (106 loc) · 2.49 KB
/
httppil.h
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
///////////////////////////////////////////////////////////////////////
//
// httpapi.h
//
// Header file for Miniweb Platform Independent Layer
//
///////////////////////////////////////////////////////////////////////
#ifndef _HTTPPIL_H_
#define _HTTPPIL_H_
#ifdef SYS_MINGW
#ifndef WIN32
#define WIN32
#endif
#endif
#ifdef WINCE
#include <winsock2.h>
#include <windows.h>
#define snprintf _snprintf
#elif defined(WIN32)
#include <winsock2.h>
#include <ws2tcpip.h> /* socklen_t */
#include <windows.h>
#include <io.h>
#define snprintf _snprintf
#else
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/select.h>
#include <netdb.h>
#include <stdint.h>
#if !defined(O_BINARY)
#define O_BINARY 0
#endif
#endif
#ifdef HAVE_PTHREAD
#include <pthread.h>
#endif
#if defined(WIN32) || defined(WINCE)
#define ssize_t size_t
#define socklen_t int
#ifndef HAVE_PTHREAD
typedef HANDLE pthread_t;
typedef HANDLE pthread_mutex_t;
#endif
#define open _open
#define read _read
#define write _write
#define close _close
#define atoll _atoi64
typedef DWORD (WINAPI *PFNGetProcessId)(HANDLE hProcess);
#else
#define closesocket close
#ifndef MAX_PATH
#define MAX_PATH 256
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
typedef int SOCKET;
typedef unsigned int DWORD;
typedef unsigned short int WORD;
typedef unsigned char BYTE;
typedef int BOOL;
#endif
typedef unsigned char OCTET;
#define SHELL_NOREDIRECT 1
#define SHELL_SHOWWINDOW 2
#define SHELL_NOWAIT 4
#if defined(_WIN32_WCE) || defined(WIN32)
#define msleep(ms) (Sleep(ms))
#else
#define msleep(ms) (usleep(ms<<10))
#endif
#ifdef __cplusplus
extern "C" {
#endif
int InitSocket();
void UninitSocket();
char *GetTimeString();
int ThreadCreate(pthread_t *pth, void* (*start_routine)(void*), void* arg);
int ThreadKill(pthread_t pth);
int ThreadWait(pthread_t pth, int timeout, void** ret);
void MutexCreate(pthread_mutex_t* mutex);
void MutexDestroy(pthread_mutex_t* mutex);
void MutexLock(pthread_mutex_t* mutex);
void MutexUnlock(pthread_mutex_t* mutex);
int ReadDir(const char* pchDir, char* pchFileNameBuf);
int IsFileExist(const char* filename);
int IsDir(const char* pchName);
#ifndef WIN32
unsigned int GetTickCount();
#endif
#ifdef __cplusplus
}
#endif
#endif