2019-07-28 10:31:56 +08:00
|
|
|
#ifndef __STD_AFX_INCLUDE_H__
|
2014-11-19 00:25:21 +08:00
|
|
|
#define __STD_AFX_INCLUDE_H__
|
|
|
|
|
|
|
|
#ifdef ACL_PREPARE_COMPILE
|
|
|
|
|
|
|
|
# include "stdlib/acl_define.h"
|
|
|
|
|
|
|
|
# include <string.h>
|
2016-07-29 16:43:46 +08:00
|
|
|
# include <errno.h>
|
2014-11-19 00:25:21 +08:00
|
|
|
# include <float.h> /* DBL_MAX_10_EXP */
|
|
|
|
# include <ctype.h>
|
|
|
|
# include <limits.h> /* CHAR_BIT */
|
2022-11-17 14:28:31 +08:00
|
|
|
# include <assert.h>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
2019-03-08 11:17:32 +08:00
|
|
|
# if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
# include <process.h>
|
|
|
|
# include <stdio.h>
|
|
|
|
# include <stdarg.h>
|
2019-03-08 11:17:32 +08:00
|
|
|
# if(_MSC_VER >= 1300)
|
|
|
|
# include <winsock2.h>
|
|
|
|
# include <mswsock.h>
|
|
|
|
# else
|
|
|
|
# include <winsock.h>
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# include <ws2tcpip.h> /* for getaddrinfo */
|
2020-01-09 00:04:02 +08:00
|
|
|
# if _MSC_VER >= 1500
|
|
|
|
# include <netioapi.h>
|
|
|
|
# endif
|
2019-03-08 11:17:32 +08:00
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
# ifdef __STDC_WANT_SECURE_LIB__
|
|
|
|
int acl_secure_snprintf(char *buf, size_t size, const char *fmt, ...);
|
|
|
|
int acl_secure_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap);
|
|
|
|
# define snprintf acl_secure_snprintf
|
|
|
|
# define vsnprintf acl_secure_vsnprintf
|
|
|
|
# else
|
|
|
|
# define snprintf _snprintf
|
|
|
|
# define vsnprintf _vsnprintf
|
|
|
|
# endif /* __STDC_WANT_SECURE_LIB__ */
|
2015-06-29 17:33:11 +08:00
|
|
|
# endif /* _WIN32 */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
# ifdef ACL_UNIX
|
|
|
|
# ifndef _GNU_SOURCE
|
|
|
|
# define _GNU_SOURCE
|
|
|
|
# endif
|
2017-09-11 11:38:06 +08:00
|
|
|
# ifndef __USE_UNIX98
|
|
|
|
# define __USE_UNIX98
|
|
|
|
# endif
|
2014-11-19 00:25:21 +08:00
|
|
|
# include <stdio.h>
|
|
|
|
# include <stdlib.h>
|
|
|
|
# include <unistd.h>
|
|
|
|
# include <signal.h>
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <sys/wait.h>
|
|
|
|
# include <pthread.h>
|
|
|
|
# include <dlfcn.h>
|
|
|
|
# include <dirent.h>
|
2017-03-12 14:49:48 +08:00
|
|
|
# include <fcntl.h>
|
2016-04-12 21:04:47 +08:00
|
|
|
# include <netinet/in.h>
|
2014-11-19 00:25:21 +08:00
|
|
|
# include <netinet/ip.h>
|
|
|
|
# include <netinet/tcp.h>
|
|
|
|
# include <netdb.h>
|
|
|
|
# include <stdarg.h>
|
|
|
|
# include <pthread.h>
|
|
|
|
# include <signal.h>
|
|
|
|
# include <sys/stat.h>
|
|
|
|
# include <sys/socket.h>
|
|
|
|
# include <sys/un.h>
|
2016-02-25 19:57:02 +08:00
|
|
|
# include <sys/mman.h>
|
2014-11-19 00:25:21 +08:00
|
|
|
# ifdef ACL_FREEBSD
|
|
|
|
# include <netinet/in_systm.h>
|
|
|
|
# include <netinet/in.h>
|
|
|
|
# endif
|
|
|
|
# endif /* ACL_UNIX */
|
|
|
|
|
|
|
|
# include "lib_acl.h"
|
|
|
|
|
2017-04-23 20:27:54 +08:00
|
|
|
#if defined (_WIN32) || defined(_WIN64)
|
|
|
|
/* for vc2003 */
|
|
|
|
# if _MSC_VER <= 1310
|
|
|
|
int inet_pton(int af, const char *src, void *dst);
|
|
|
|
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
|
2021-02-02 22:09:03 +08:00
|
|
|
|
|
|
|
#define POLLRDNORM 0x0100
|
|
|
|
#define POLLRDBAND 0x0200
|
|
|
|
#define POLLIN (POLLRDNORM | POLLRDBAND)
|
|
|
|
#define POLLPRI 0x0400
|
|
|
|
|
|
|
|
#define POLLWRNORM 0x0010
|
|
|
|
#define POLLOUT (POLLWRNORM)
|
|
|
|
#define POLLWRBAND 0x0020
|
|
|
|
|
|
|
|
#define POLLERR 0x0001
|
|
|
|
#define POLLHUP 0x0002
|
|
|
|
#define POLLNVAL 0x0004
|
|
|
|
|
|
|
|
typedef struct pollfd {
|
|
|
|
SOCKET fd;
|
|
|
|
short events;
|
|
|
|
short revents;
|
|
|
|
} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
|
|
|
|
|
2020-06-01 06:30:57 +08:00
|
|
|
int WSAAPI WSAPoll(LPWSAPOLLFD fdArray, ULONG fds, INT timeout);
|
2017-04-23 20:27:54 +08:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
#endif /* ACL_PREPARE_COMPILE */
|
|
|
|
|
2019-01-15 11:57:19 +08:00
|
|
|
//#define ACL_DEBUG_MIN 0
|
|
|
|
//#define ACL_DEBUG_MAX 30
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
#endif
|
|
|
|
|