forked from lizj3624/https-github.com-mogutt-TTServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathostype.h
More file actions
80 lines (71 loc) · 1.57 KB
/
Copy pathostype.h
File metadata and controls
80 lines (71 loc) · 1.57 KB
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
// OS dependant type definition
#ifndef __OS_TYPE_H__
#define __OS_TYPE_H__
#ifdef _WIN32
#include <WinSock2.h>
#include <Windows.h>
#else
#ifdef __APPLE__
#include <sys/event.h>
#include <sys/time.h>
#include <sys/syscall.h> // syscall(SYS_gettid)
#else
#include <sys/epoll.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h> // define int8_t ...
#include <signal.h>
#define closesocket close
#define ioctlsocket ioctl
#endif
#ifdef _WIN32
#if (_MSC_VER >= 1800)
//vs2013+
#include <stdint.h>
#else
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif
typedef int socklen_t;
#else
typedef int SOCKET;
typedef int BOOL;
const int TRUE = 1;
const int FALSE = 0;
const int SOCKET_ERROR = -1;
const int INVALID_SOCKET = -1;
#endif
typedef unsigned char uchar_t;
typedef int net_handle_t;
typedef int conn_handle_t;
enum {
NETLIB_OK = 0,
NETLIB_ERROR = -1
};
#define NETLIB_INVALID_HANDLE -1
enum
{
NETLIB_MSG_CONNECT = 1,
NETLIB_MSG_CONFIRM,
NETLIB_MSG_READ,
NETLIB_MSG_WRITE,
NETLIB_MSG_CLOSE,
NETLIB_MSG_TIMER
};
typedef void (*callback_t)(void* callback_data, uint8_t msg, uint32_t handle, void* pParam);
#endif