ap.h
7.52 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#ifndef _BIDL2SL_AP_H_
#define _BIDL2SL_AP_H_
#include <string>
#include <vector>
#include <set>
#include <map>
#include <bgcc.h>
#include "acdcommon.h"
namespace ap {
class ApAgentInfo {
public:
ApAgentInfo();
~ApAgentInfo();
std::string agentId;
std::string agentDn;
std::string agentPwd;
acd::StatusChangeT statusChangetype;
bool autoAnswer;
bool fcSignin;
std::string skills;
std::string proxyname;
std::string proxyname_old;
int64_t handle;
int32_t flag;
bool operator==(const ApAgentInfo& rhs) const;
bool operator!=(const ApAgentInfo& rhs) const;
bool operator< (const ApAgentInfo& rhs) const;
int32_t read(char *request, int32_t request_len, bgcc::SharedPointer<bgcc::IProtocol> proto);
int32_t write(bgcc::SharedPointer<bgcc::IProtocol> proto) const;
};
typedef std::vector<ApAgentInfo> ApAgentInfoListT;
class apapi : public bgcc::Shareable {
public:
virtual ~apapi() { }
virtual bool ReLoadConfig(
const std::map<std::string, std::string>& ctx) = 0;
virtual bool GetAgents(
ApAgentInfoListT & agentInfoList,
const std::map<std::string, std::string>& ctx) = 0;
};
class apapi_ReLoadConfig_args {
public:
apapi_ReLoadConfig_args();
virtual ~apapi_ReLoadConfig_args();
bool operator==(const apapi_ReLoadConfig_args& rhs) const;
bool operator!=(const apapi_ReLoadConfig_args& rhs) const;
bool operator< (const apapi_ReLoadConfig_args& rhs) const;
int32_t read(char* request, int32_t request_len, bgcc::SharedPointer<bgcc::IProtocol> proto);
};
class apapi_GetAgents_args {
public:
apapi_GetAgents_args();
virtual ~apapi_GetAgents_args();
bool operator==(const apapi_GetAgents_args& rhs) const;
bool operator!=(const apapi_GetAgents_args& rhs) const;
bool operator< (const apapi_GetAgents_args& rhs) const;
int32_t read(char* request, int32_t request_len, bgcc::SharedPointer<bgcc::IProtocol> proto);
};
class apapi_ReLoadConfig_pargs {
public:
virtual ~apapi_ReLoadConfig_pargs();
int32_t write(bgcc::SharedPointer<bgcc::IProtocol> proto) const;
};
class apapi_GetAgents_pargs {
public:
virtual ~apapi_GetAgents_pargs();
int32_t write(bgcc::SharedPointer<bgcc::IProtocol> proto) const;
};
class apapi_ReLoadConfig_result {
public:
apapi_ReLoadConfig_result();
virtual ~apapi_ReLoadConfig_result();
bool return_value;
bool operator==(const apapi_ReLoadConfig_result& rhs) const;
bool operator!=(const apapi_ReLoadConfig_result& rhs) const;
bool operator< (const apapi_ReLoadConfig_result& rhs) const;
int32_t write(bgcc::SharedPointer<bgcc::IProtocol> proto) const;
};
class apapi_GetAgents_result {
public:
apapi_GetAgents_result();
virtual ~apapi_GetAgents_result();
bool return_value;
ApAgentInfoListT agentInfoList;
bool operator==(const apapi_GetAgents_result& rhs) const;
bool operator!=(const apapi_GetAgents_result& rhs) const;
bool operator< (const apapi_GetAgents_result& rhs) const;
int32_t write(bgcc::SharedPointer<bgcc::IProtocol> proto) const;
};
class apapi_ReLoadConfig_presult {
public:
virtual ~apapi_ReLoadConfig_presult();
bool* return_value;
int32_t read(char *request, int32_t request_len, bgcc::SharedPointer<bgcc::IProtocol> proto) const;
};
class apapi_GetAgents_presult {
public:
virtual ~apapi_GetAgents_presult();
bool* return_value;
ApAgentInfoListT* agentInfoList;
int32_t read(char *request, int32_t request_len, bgcc::SharedPointer<bgcc::IProtocol> proto) const;
};
class apapiProxy : public bgcc::BaseProxy {
public:
apapiProxy(
bgcc::ServerInfo serverinfo,
int32_t maxConn,
bgcc::ServiceManager* mgr = NULL,
int32_t tryCount = 5,
int32_t tryInterval = 500);
apapiProxy(
bgcc::ServerInfo serverinfo,
bgcc::ServiceManager* mgr = NULL,
int32_t tryCount = 5,
int32_t tryInterval = 500);
apapiProxy(
const std::string& proxy_name,
int32_t tryCount = 5,
int32_t tryInterval = 500);
bool ReLoadConfig(
bool last = false);
bool GetAgents(
ApAgentInfoListT& agentInfoList,
bool last = false);
private:
void send_ReLoadConfig(
int32_t seqid,
bgcc::SharedPointer<bgcc::ConnInfo> conn);
bool recv_ReLoadConfig(
bgcc::SharedPointer<bgcc::ConnInfo> conn);
void send_GetAgents(
int32_t seqid,
bgcc::SharedPointer<bgcc::ConnInfo> conn);
bool recv_GetAgents(
ApAgentInfoListT& agentInfoList,
bgcc::SharedPointer<bgcc::ConnInfo> conn);
};
class SSLapapiProxy : public bgcc::SSLBaseProxy {
public:
SSLapapiProxy(
bgcc::ServerInfo serverinfo,
int32_t maxConn,
bgcc::ServiceManager* mgr = NULL,
int32_t tryCount = 5,
int32_t tryInterval = 500);
SSLapapiProxy(
bgcc::ServerInfo serverinfo,
bgcc::ServiceManager* mgr = NULL,
int32_t tryCount = 5,
int32_t tryInterval = 500);
SSLapapiProxy(
const std::string& proxy_name,
int32_t tryCount = 5,
int32_t tryInterval = 500);
bool ReLoadConfig(
bool last = false);
bool GetAgents(
ApAgentInfoListT& agentInfoList,
bool last = false);
private:
void send_ReLoadConfig(
int32_t seqid,
bgcc::SharedPointer<bgcc::ConnInfo> conn);
bool recv_ReLoadConfig(
bgcc::SharedPointer<bgcc::ConnInfo> conn);
void send_GetAgents(
int32_t seqid,
bgcc::SharedPointer<bgcc::ConnInfo> conn);
bool recv_GetAgents(
ApAgentInfoListT& agentInfoList,
bgcc::SharedPointer<bgcc::ConnInfo> conn);
};
class apapiProcessor : public bgcc::BaseProcessor {
public:
apapiProcessor(bgcc::SharedPointer<apapi> intf);
virtual ~apapiProcessor(){ }
virtual int32_t process(
char* request,
int32_t request_len,
bgcc::SharedPointer<bgcc::IProtocol> proto);
virtual std::string get_name() const;
protected:
virtual int32_t do_function__(
char* request,
int32_t request_len,
bgcc::SharedPointer<bgcc::IProtocol> proto,
const std::string& fname, int32_t seqid);
bgcc::SharedPointer<apapi> __intf;
private:
int32_t do_ReLoadConfig(
char* request,
int32_t request_len,
bgcc::SharedPointer<bgcc::IProtocol> proto,
int32_t seqid);
int32_t do_GetAgents(
char* request,
int32_t request_len,
bgcc::SharedPointer<bgcc::IProtocol> proto,
int32_t seqid);
typedef int32_t (apapiProcessor::* do_function_ptr)(
char* request,
int32_t request_len,
bgcc::SharedPointer<bgcc::IProtocol> proto,
int32_t seqid);
std::map<std::string, do_function_ptr> __fun_map;
};
}
#endif