lobby_service.h
1.59 KB
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
47
48
49
50
51
52
#pragma once
#include <common.h>
#include <share_msg.pb.h>
class user_t;
//////////////////////////////////////////////////////////////////////////
//binding cmd
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
#define BIND_PROTO_CMD(cmd,fun_name, proto_name)\
static const CMD_ID lobby_gateway_##proto_name##_cmd = cmd;
#define BIND_PROTO_CMD_NO_CB(cmd,fun_name, proto_name)\
static const CMD_ID lobby_gateway_##proto_name##_cmd = cmd;
#include <lobby_gateway_cmd.h>
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
#define LOBBY_MSG_HANDLE_FUN_PAR el::lib_tcp_peer_info_t* peer_fd_info, google::protobuf::Message* msg, USER_ID uid, uint32_t sequence_generator, uint32_t ret, user_t* user
DEF_MSG_HANDLE_FUN(lobby_service_t, LOBBY)
class lobby_service_t : public el_async::service_base_pb_t
{
public:
lobby_service_t();
virtual ~lobby_service_t();
int send_msg(google::protobuf::Message* msg, USER_ID ack_uid, CMD_ID cmd);
int on_recv(el::lib_tcp_peer_info_t* peer_fd_info, CMD_ID cmd, char* pdata,
int len, USER_ID uid, uint32_t seq, uint32_t ret);
void offline();
protected:
//////////////////////////////////////////////////////////////////////////
//binding cmd and processing function
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
#define BIND_PROTO_CMD(cmd, fun_name, proto_name)\
int fun_name##_res(LOBBY_MSG_HANDLE_FUN_PAR)
#define BIND_PROTO_CMD_NO_CB(cmd, fun_name, proto_name)\
int fun_name##_res(LOBBY_MSG_HANDLE_FUN_PAR)
#include <lobby_gateway_cmd.h>
#undef BIND_PROTO_CMD
#undef BIND_PROTO_CMD_NO_CB
private:
LOBBY_MSG_MAP_T msg_map;
};
extern lobby_service_t* g_lobby_service;