acl  3.5.3.0
fiber_define.h
浏览该文件的文档.
1 #ifndef FIBER_DEFINE_INCLUDE_H
2 #define FIBER_DEFINE_INCLUDE_H
3 #include <stdint.h>
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 typedef intptr_t acl_handle_t;
10 
11 #if defined(_WIN32) || defined (_WIN64)
12 # include <winsock2.h>
13 
14 /* typedef intptr_t ssize_t; */
15 # ifndef HAS_SSIZE_T
16 # define HAS_SSIZE_T
17 /* typedef intptr_t ssize_t; */
18 # if defined(_WIN64)
19 typedef __int64 ssize_t;
20 # elif defined(_WIN32)
21 typedef int ssize_t;
22 # else
23 typedef long ssize_t;
24 # endif
25 # endif
26 typedef SOCKET socket_t;
27 typedef int socklen_t;
28 
29 # define FIBER_ETIMEDOUT WSAETIMEDOUT
30 # define FIBER_ENOMEM WSAENOBUFS
31 # define FIBER_EINVAL WSAEINVAL
32 # define FIBER_ECONNREFUSED WSAECONNREFUSED
33 # define FIBER_ECONNRESET WSAECONNRESET
34 # define FIBER_EHOSTDOWN WSAEHOSTDOWN
35 # define FIBER_EHOSTUNREACH WSAEHOSTUNREACH
36 # define FIBER_EINTR WSAEINTR
37 # define FIBER_ENETDOWN WSAENETDOWN
38 # define FIBER_ENETUNREACH WSAENETUNREACH
39 # define FIBER_ENOTCONN WSAENOTCONN
40 # define FIBER_EISCONN WSAEISCONN
41 # define FIBER_EWOULDBLOCK WSAEWOULDBLOCK
42 # define FIBER_EAGAIN FIBER_EWOULDBLOCK /* xxx */
43 # define FIBER_ENOBUFS WSAENOBUFS
44 # define FIBER_ECONNABORTED WSAECONNABORTED
45 # define FIBER_EINPROGRESS WSAEINPROGRESS
46 
47 #else
48 
49 # include <errno.h>
50 # include <sys/types.h>
51 # include <sys/socket.h>
52 # include <sys/time.h>
53 # include <sys/select.h>
54 # include <poll.h>
55 # include <unistd.h>
56 # include <netdb.h>
57 
58 # define INVALID_SOCKET -1
59 typedef int socket_t;
60 
61 # define FIBER_ETIMEDOUT ETIMEDOUT
62 # define FIBER_ENOMEM ENOMEM
63 # define FIBER_EINVAL EINVAL
64 # define FIBER_ECONNREFUSED ECONNREFUSED
65 # define FIBER_ECONNRESET ECONNRESET
66 # define FIBER_EHOSTDOWN EHOSTDOWN
67 # define FIBER_EHOSTUNREACH EHOSTUNREACH
68 # define FIBER_EINTR EINTR
69 # define FIBER_EAGAIN EAGAIN
70 # define FIBER_ENETDOWN ENETDOWN
71 # define FIBER_ENETUNREACH ENETUNREACH
72 # define FIBER_ENOTCONN ENOTCONN
73 # define FIBER_EISCONN EISCONN
74 # define FIBER_EWOULDBLOCK EWOULDBLOCK
75 # define FIBER_ENOBUFS ENOBUFS
76 # define FIBER_ECONNABORTED ECONNABORTED
77 # define FIBER_EINPROGRESS EINPROGRESS
78 
79 #endif
80 
81 #ifdef FIBER_LIB
82 # ifndef FIBER_API
83 # define FIBER_API
84 # endif
85 #elif defined(FIBER_DLL) // || defined(_WINDLL)
86 # if defined(FIBER_EXPORTS) || defined(fiber_EXPORTS)
87 # ifndef FIBER_API
88 # define FIBER_API __declspec(dllexport)
89 # endif
90 # elif !defined(FIBER_API)
91 # define FIBER_API __declspec(dllimport)
92 # endif
93 #elif !defined(FIBER_API)
94 # define FIBER_API
95 #endif
96 
97 /**
98  * the fiber struct type definition
99  */
100 typedef struct ACL_FIBER ACL_FIBER;
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif
int socket_t
Definition: fiber_define.h:59
intptr_t acl_handle_t
Definition: fiber_define.h:9
struct ACL_FIBER ACL_FIBER
Definition: fiber_define.h:100