3 Star 2 Fork 5

张远浩/call_demo_server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ostype.h 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
zhangyuanhao 提交于 2015-08-15 22:38 . [MOD] 修改实现
// OS dependant type definition
#ifndef __OS_TYPE_H__
#define __OS_TYPE_H__
#ifdef _WIN32
#include <WinSock2.h>
#include <WinBase.h>
#include <Windows.h>
#include <direct.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 <pthread.h>
#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>
#include <unistd.h>
#define closesocket close
#define ioctlsocket ioctl
#endif
#include <stdexcept>
#include <unordered_map>
#ifdef _WIN32
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;
typedef int socklen_t;
#else
typedef int SOCKET;
typedef int BOOL;
#ifndef __APPLE__
const int TRUE = 1;
const int FALSE = 0;
#endif
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,
NETLIB_MSG_LOOP
};
const uint32_t INVALID_UINT32 = (uint32_t) -1;
const uint32_t INVALID_VALUE = 0;
typedef void (*callback_t)(void* callback_data, uint8_t msg, uint32_t handle, void* pParam);
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bluefoxah/call_demo_server.git
git@gitee.com:bluefoxah/call_demo_server.git
bluefoxah
call_demo_server
call_demo_server
master

搜索帮助