-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinterface.pkg
96 lines (81 loc) · 2.21 KB
/
interface.pkg
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
$#include "interface_c.h"
$#include "MemcachedHandler.h"
module packet
{
void write_begin(short cmd);
void write_end();
void write_byte(unsigned char value);
void write_int(int value);
void write_short(short value);
void write_uint(unsigned long value);
void write_string(char* value);
void write_binary(char *buf, int len);
int send_raw_packet(int fd);
int send_packet(int fd);
int send_buffer(int fd, char* buffer, int len);
int transfer(int fd);
int transfer_raw(int fd);
}
module log
{
void error(const char* msg);
void info(const char* msg);
void debug(const char* msg);
}
module timer
{
int create_timer();
int start_timer(unsigned long timer_id, int time);
int reset_timer(unsigned long timer_id);
int stop_timer(unsigned long timer_id);
int clear_timer(unsigned long timer_id);
int remain_timer(unsigned long timer_id);
}
//server模块,用来接受客户端连接的
module server
{
int create_listener(int port);
int close_socket(int fd);
}
//客户端模块,连接服务器
module client
{
int connect_server(char* ip, int port);
int connect_server(char* ip, int port, bool is_encrypt, int conn_flag);
int close_socket(int fd);
}
module mysql
{
int connect_mysql(const char* host, const char* user, const char* password, const char* dbname, unsigned int port);
int query(const char* sql);
}
module redis
{
int connect_redis(const char* host, unsigned int port, unsigned short second = 0);
int get_redis_value(const char* key);
int set_redis_value(const char* key, const char* value);
int set_redis_expire(const char* key, int expire);
int Enqueue(const char* queue, const char* value);
int Dequeue(const char* queue);
bool IsActived();
int S_IsMember(const char* key, const char* value);
int S_IsMember(const char* key, const int value);
int HSet(const char* key,const int field, const char* value);
int HGet(const char* key,const int field);
int HDel(const char* key,const int field);
int Del(const char* key);
}
module uuid
{
void NewUUID();
}
module mc
{
class CMemcachedHandler {
public:
CMemcachedHandler(const string& host);
~CMemcachedHandler();
string Get(string& key);
int Set(const string& key, const string& value);
};
}