Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (56 sloc) 1.46 KB
#ifndef __BASE_H__
#define __BASE_H__
#define MAX_RECV_BUF_LEN (128)
#define MAX_POST_BUF_LEN (128)
#define MAX_POP_S2C_CODE_NUM (32)
#define MAX_POP_C2S_CODE_NUM (32)
#define MAX_CODE_BUF_LEN (256)
#define MSG_QUEUE_LENGTH (1000)
#define MAX_DISPATCH_MSG_NUM (32)
#define MAX_GET_CLIENT_MSG_NUM (32)
#define MAX_GET_SERVER_MSG_NUM (32)
#define MAX_CONNECT_NUM (1000)
#define IP_LEN (20)
#define MSG_PREFIX_LEN (4)
#define QUEUE_RESERVED_LEN (8) // reserved len: Avoid the head-tail
#define MAX_POLL_FD_NUM (1000)
#define INVALID_SOCKET (-1)
#define RECV_DATA (1)
#define SEND_DATA (2)
// switch
//////////////////////////////////
#define __IO_MULTIPLEX__
#define __EPOLL__
//#define __SELECT__
//#define __POLL__
//////////////////////////////////
#include "queue.h"
#include "message.h"
#include "codequeue.h"
#include "shmfactory.h"
#include "messagebody.h"
#include "messagehead.h"
#include "messagebody.h"
#include "sharedmemory.h"
#include "objectmanager.h"
#include "messageobject.h"
#include <errno.h>
#include <cstring>
#include <unistd.h>
#include <iostream>
#include <fcntl.h>
#include <arpa/inet.h>
#if defined(__POLL__)
#include <poll.h>
#elif defined(__SELECT__)
#include <sys/select.h>
#elif defined(__EPOLL__)
#include <sys/epoll.h>
#endif
struct NetHead {
int socket_index;
};
struct ClientInfo {
int socket_index;
};
#endif /* __BASE_H__ */