-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathprotocal.h
47 lines (38 loc) · 934 Bytes
/
protocal.h
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
#ifndef BOYAA_PROTOCAL_H_20120207
#define BOYAA_PROTOCAL_H_20120207
extern "C"
{
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}
#include <string.h>
#include <map>
using namespace std;
typedef int (*CALLBACK_FUNC)(const char* format, ...); //命令处理回调函数
typedef struct _message {
int cmd; //命令字类型
char format[128]; //格式
char desc[256]; //描述
char call_back[32]; //回调函数
_message()
{
memset(this, 0, sizeof(_message));
}
}Message;
typedef map<unsigned short, Message> MessageMap_t;
typedef MessageMap_t::iterator MessageMapItr_t;
class CProtocal
{
public:
CProtocal();
~CProtocal();
public:
static int init();
static void trace_message();
static Message get_message(unsigned short cmd);
public:
static int message_count;
static MessageMap_t message_table;
};
#endif