-
Notifications
You must be signed in to change notification settings - Fork 2
/
bindconf.h
executable file
·57 lines (45 loc) · 1.08 KB
/
bindconf.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
47
48
49
50
51
52
53
54
55
56
57
#ifndef ASYNC_SERVER_BIND_CONF_H_
#define ASYNC_SERVER_BIND_CONF_H_
#ifdef __cplusplus
extern "C" {
#endif
// POSIX
#include <netinet/in.h>
// Self-define
#include "shmq.h"
#include "libtaomee/lua/lua.h"
enum {
max_listen_fds = 500
};
typedef struct bind_config_elem {
uint32_t online_id;
char online_name[16];
char bind_ip[16];
in_port_t bind_port;
uint8_t restart_cnt;
shm_queue_t sendq;
shm_queue_t recvq;
} bind_config_elem_t;
typedef struct bind_config {
int bind_num;
bind_config_elem_t configs[max_listen_fds];
} bind_config_t;
extern bind_config_t bindconf;
int load_bind_file(const char* file_name);
static inline bind_config_t*
get_bind_conf()
{
return &bindconf;
}
static inline int
get_bind_conf_idx(const bind_config_elem_t* bc_elem)
{
return (bc_elem - &(bindconf.configs[0]));
}
int load_bind_from_lua(lua_State * L );
double getnumber_by_index(lua_State* L , int index );
const char * getstring_by_index(lua_State* L , int index );
#ifdef __cplusplus
}
#endif
#endif // ASYNC_SERVER_BIND_CONF_H_