天佐.追日靴  tianzuo.Zhuiri
可靠UDP传输 reliable UDP transmission
Loading...
Searching...
No Matches
tianzuo.ZhuiriInterface.h
Go to the documentation of this file.
1
2// *@file tianzuo_ZhuiriInterface.h
3// *@brief 天佐.追日靴 (tianzuo.Zhuiri)
4// *@version 1.0
5// *@section LICENSE Copyright © 2003-2103 郑天佐 Corporation
6// *@author 郑天佐 (zhengtianzuo)
7// *@date 2013-4-3
8#pragma once
9#include "tianzuo.Zhuiri.h"
10
12#undef tianzuo_Zhuiri_lib
13#if defined (WIN32)
14#define tianzuo_Zhuiri_atr
15#if defined (tianzuo_Zhuiri_dllexport)
16#define tianzuo_Zhuiri_lib _declspec(dllexport)
17#else
18#define tianzuo_Zhuiri_lib _declspec(dllimport)
19#endif
20#else
21#define tianzuo_Zhuiri_atr __attribute__((visibility("default")))
22#define tianzuo_Zhuiri_lib
23#endif
24
27typedef struct Zhuiri_param_tag {
29 m_sender_index = 0;
30 m_init_server_port = 0;
31 m_msg_init_size = 0;
32 m_recv_ex_data_max = 0;
33 m_retry_max = 0;
34 m_retry_all_number = 0;
35 m_init_retry_time = 0;
36 }
37
39 int sender_index,
40 int init_server_port,
41 int msg_init_size,
42 int recv_ex_data_max,
43 int retry_max,
44 int retry_all_number,
45 int init_retry_time) {
46 m_sender_index = sender_index;
47 m_init_server_port = init_server_port;
48 m_msg_init_size = msg_init_size;
49 m_recv_ex_data_max = recv_ex_data_max;
50 m_retry_max = retry_max;
51 m_retry_all_number = retry_all_number;
52 m_init_retry_time = init_retry_time;
53 }
54
55 int get_sender_index() const {
56 return m_sender_index;
57 }
58
59 void set_sender_index(int sender_index) {
60 m_sender_index = sender_index;
61 }
62
64 return m_init_server_port;
65 }
66
67 void set_init_server_port(int init_server_port) {
68 m_init_server_port = init_server_port;
69 }
70
71 int get_msg_init_size() const {
72 return m_msg_init_size;
73 }
74
75 void set_msg_init_size(int msg_init_size) {
76 m_msg_init_size = msg_init_size;
77 }
78
80 return m_recv_ex_data_max;
81 }
82
83 void set_recv_ex_data_max(int recv_ex_data_max) {
84 m_recv_ex_data_max = recv_ex_data_max;
85 }
86
87 int get_retry_max() const {
88 return m_retry_max;
89 }
90
91 void set_retry_max(int retry_max) {
92 m_retry_max = retry_max;
93 }
94
96 return m_retry_all_number;
97 }
98
99 void set_retry_all_number(int retry_all_number) {
100 m_retry_all_number = retry_all_number;
101 }
102
104 return m_init_retry_time;
105 }
106
107 void set_init_retry_time(int init_retry_time) {
108 m_init_retry_time = init_retry_time;
109 }
110
111private:
112 int m_sender_index;
113 int m_init_server_port;
114 int m_msg_init_size;
115 int m_recv_ex_data_max;
116 int m_retry_max;
117 int m_retry_all_number;
118 int m_init_retry_time;
120
123typedef struct Zhuiri_send_param_tag {
125 m_sender_index = 0;
126 m_ip = 0;
127 m_port = 0;
128 m_sign = 0;
129 m_function = 0;
130 m_send_data = NULL;
131 m_send_size = 0;
132 }
133
134 Zhuiri_send_param_tag(int sender_index, int ip, int port, int sign,
135 int function, char *send_data, int send_size) {
136 m_sender_index = sender_index;
137 m_ip = ip;
138 m_port = port;
139 m_sign = sign;
140 m_function = function;
141 m_send_data = send_data;
142 m_send_size = send_size;
143 }
144
145 int get_sender_index() const {
146 return m_sender_index;
147 }
148
149 void set_sender_index(int sender_index) {
150 m_sender_index = sender_index;
151 }
152
153 int get_ip() const {
154 return m_ip;
155 }
156
157 void set_ip(int ip) {
158 m_ip = ip;
159 }
160
161 int get_port() const {
162 return m_port;
163 }
164
165 void set_port(int port) {
166 m_port = port;
167 }
168
169 int get_sign() const {
170 return m_sign;
171 }
172
173 void set_sign(int sign) {
174 m_sign = sign;
175 }
176
177 int get_function() const {
178 return m_function;
179 }
180
181 void set_function(int function) {
182 m_function = function;
183 }
184
185 char *get_send_data() const {
186 return m_send_data;
187 }
188
189 void set_send_data(char * send_data) {
190 m_send_data = send_data;
191 }
192
193 int get_send_size() const {
194 return m_send_size;
195 }
196
197 void set_send_size(int send_size) {
198 m_send_size = send_size;
199 }
200
201private:
202 int m_sender_index;
203 int m_ip;
204 int m_port;
205 int m_sign;
206 int m_function;
207 char *m_send_data;
208 int m_send_size;
210
214 public:
217
231 virtual int initialize(
232 const char *ip_addr, int port,
233 const void *callback, const void *context, int const heart_check_time,
234 bool log_trace
235#ifdef WIN32
236 , void * iocp = nullptr
237#endif
238 ) = 0;
239
248 virtual int terminate() = 0;
249
258 virtual int set_param(Zhuiri_param_pointer param) = 0;
259
269 virtual int add_sender(
270 int *sender_index, int const sign) = 0;
271
280 virtual int begin_recv() = 0;
281
290 virtual int stop_recv() = 0;
291
301 virtual int data_free(
302 void *Zhuiri, int const data_index) const = 0;
303
312 virtual int send(Zhuiri_send_param_pointer send_param) = 0;
313
322 virtual int get_status() const = 0;
323
332 virtual int get_type() = 0;
333
342 virtual int get_bind_port() = 0;
343
352 virtual int heart_add(Zhuiri_pkg_recv_heart_pointer recv_heart) = 0;
353
364 virtual int heart_modify(
365 int const data_id, int const ip, int const port) = 0;
366
375 virtual int heart_update(int const data_id) = 0;
376
385 virtual int heart_remove(int const data_id) = 0;
386};
387
432
436 public:
439
448 virtual int initialize(int const init_size) = 0;
449
458 virtual void terminate() = 0;
459
468 virtual int push_back(const Zhuiri_data_pkg_pointer data) = 0;
469
478 virtual int pop_up(const Zhuiri_data_pkg_pointer data) = 0;
479
489 virtual void alloc_send_data(
490 Zhuiri_data_pkg_pointer *data, int const space_size) = 0;
491
500 virtual void free_send_data() = 0;
501
510 virtual int get_used_count() const = 0;
511
520 virtual int get_unuse_count() const = 0;
521
530 virtual int get_all_count() const = 0;
531
540 virtual void clear() = 0;
541};
542
587
590#ifdef __cplusplus
591extern "C"
592{
593#endif
594
604
614
624 tianzuo_ZhuiriInt* ZhuiriInt_pointer, const char* ip_addr, int port,
625 const void* callback, const void* context, int const heart_check_time, bool log_trace
626#ifdef WIN32
627 , void* iocp = nullptr
628#endif
629 );
630
640
650 int sender_index, int init_server_port, int msg_init_size,
651 int recv_ex_data_max, int retry_max, int retry_all_number,
652 int init_retry_time);
653
664 int *sender_index, int const sign);
665
675
685
695 tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_data_free(tianzuo_ZhuiriInt* ZhuiriInt_pointer, void *Zhuiri, int const data_index);
696
706 int sender_index, int ip, int port, int sign, int function, char* send_data, int send_size);
707
717
727
737
746 tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_heart_add(tianzuo_ZhuiriInt* ZhuiriInt_pointer, int user_id, int ip_adrs, int port, int user_type, int send_time, int sender_user_id, int sender_user_type);
747
759 int const data_id, int const ip, int const port);
760
769 tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_heart_update(tianzuo_ZhuiriInt* ZhuiriInt_pointer, int const data_id);
770
779 tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_heart_remove(tianzuo_ZhuiriInt* ZhuiriInt_pointer, int const data_id);
780
790
800
810
811#ifdef __cplusplus
812}
813#endif
追日靴数据队列模块类 for c++
Definition tianzuo.ZhuiriInterface.h:435
virtual int get_all_count() const =0
virtual ~tianzuo_DataQueue()
Definition tianzuo.ZhuiriInterface.h:438
tianzuo_DataQueue()
Definition tianzuo.ZhuiriInterface.h:437
virtual int get_used_count() const =0
virtual int get_unuse_count() const =0
virtual int pop_up(const Zhuiri_data_pkg_pointer data)=0
virtual void free_send_data()=0
virtual void clear()=0
virtual int initialize(int const init_size)=0
virtual int push_back(const Zhuiri_data_pkg_pointer data)=0
virtual void alloc_send_data(Zhuiri_data_pkg_pointer *data, int const space_size)=0
virtual void terminate()=0
追日靴数据队列接口 for c++
Definition tianzuo.ZhuiriInterface.h:545
static tianzuo_DataQueue * initialize()
static void terminate(tianzuo_DataQueue **data_queue)
virtual ~tianzuo_DataQueueInterface()
追日靴模块类 for c++
Definition tianzuo.ZhuiriInterface.h:213
virtual int heart_modify(int const data_id, int const ip, int const port)=0
virtual int get_type()=0
virtual ~tianzuo_ZhuiriInt()
Definition tianzuo.ZhuiriInterface.h:216
virtual int heart_update(int const data_id)=0
virtual int get_bind_port()=0
virtual int initialize(const char *ip_addr, int port, const void *callback, const void *context, int const heart_check_time, bool log_trace)=0
virtual int begin_recv()=0
virtual int data_free(void *Zhuiri, int const data_index) const =0
virtual int send(Zhuiri_send_param_pointer send_param)=0
virtual int stop_recv()=0
virtual int set_param(Zhuiri_param_pointer param)=0
virtual int heart_add(Zhuiri_pkg_recv_heart_pointer recv_heart)=0
virtual int add_sender(int *sender_index, int const sign)=0
tianzuo_ZhuiriInt()
Definition tianzuo.ZhuiriInterface.h:215
virtual int heart_remove(int const data_id)=0
virtual int terminate()=0
virtual int get_status() const =0
追日靴接口类 for c++
Definition tianzuo.ZhuiriInterface.h:390
virtual ~tianzuo_ZhuiriInterface()
static tianzuo_ZhuiriInt * initialize()
static void terminate(tianzuo_ZhuiriInt **Zhuiri)
数据包结构
Definition tianzuo.Zhuiri.h:116
参数
Definition tianzuo.ZhuiriInterface.h:27
int get_retry_max() const
Definition tianzuo.ZhuiriInterface.h:87
int get_sender_index() const
Definition tianzuo.ZhuiriInterface.h:55
void set_init_retry_time(int init_retry_time)
Definition tianzuo.ZhuiriInterface.h:107
int get_retry_all_number() const
Definition tianzuo.ZhuiriInterface.h:95
int get_recv_ex_data_max() const
Definition tianzuo.ZhuiriInterface.h:79
Zhuiri_param_tag()
Definition tianzuo.ZhuiriInterface.h:28
void set_retry_max(int retry_max)
Definition tianzuo.ZhuiriInterface.h:91
void set_recv_ex_data_max(int recv_ex_data_max)
Definition tianzuo.ZhuiriInterface.h:83
Zhuiri_param_tag(int sender_index, int init_server_port, int msg_init_size, int recv_ex_data_max, int retry_max, int retry_all_number, int init_retry_time)
Definition tianzuo.ZhuiriInterface.h:38
void set_msg_init_size(int msg_init_size)
Definition tianzuo.ZhuiriInterface.h:75
int get_init_retry_time() const
Definition tianzuo.ZhuiriInterface.h:103
int get_msg_init_size() const
Definition tianzuo.ZhuiriInterface.h:71
void set_init_server_port(int init_server_port)
Definition tianzuo.ZhuiriInterface.h:67
void set_sender_index(int sender_index)
Definition tianzuo.ZhuiriInterface.h:59
void set_retry_all_number(int retry_all_number)
Definition tianzuo.ZhuiriInterface.h:99
int get_init_server_port() const
Definition tianzuo.ZhuiriInterface.h:63
心跳包接收结构
Definition tianzuo.Zhuiri.h:189
发送参数
Definition tianzuo.ZhuiriInterface.h:123
void set_sender_index(int sender_index)
Definition tianzuo.ZhuiriInterface.h:149
int get_send_size() const
Definition tianzuo.ZhuiriInterface.h:193
int get_port() const
Definition tianzuo.ZhuiriInterface.h:161
void set_sign(int sign)
Definition tianzuo.ZhuiriInterface.h:173
void set_ip(int ip)
Definition tianzuo.ZhuiriInterface.h:157
void set_port(int port)
Definition tianzuo.ZhuiriInterface.h:165
void set_send_data(char *send_data)
Definition tianzuo.ZhuiriInterface.h:189
void set_function(int function)
Definition tianzuo.ZhuiriInterface.h:181
int get_sign() const
Definition tianzuo.ZhuiriInterface.h:169
Zhuiri_send_param_tag(int sender_index, int ip, int port, int sign, int function, char *send_data, int send_size)
Definition tianzuo.ZhuiriInterface.h:134
int get_sender_index() const
Definition tianzuo.ZhuiriInterface.h:145
char * get_send_data() const
Definition tianzuo.ZhuiriInterface.h:185
int get_ip() const
Definition tianzuo.ZhuiriInterface.h:153
Zhuiri_send_param_tag()
Definition tianzuo.ZhuiriInterface.h:124
void set_send_size(int send_size)
Definition tianzuo.ZhuiriInterface.h:197
int get_function() const
Definition tianzuo.ZhuiriInterface.h:177
#define tianzuo_Zhuiri_lib
Definition tianzuo.ZhuiriInterface.h:22
tianzuo_Zhuiri_lib void tianzuo_ZhuiriInterface_terminate(tianzuo_ZhuiriInt **ZhuiriInt_pointer)
tianzuo_Zhuiri_lib tianzuo_ZhuiriInt * tianzuo_ZhuiriInterface_initialize()
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_get_bind_port(tianzuo_ZhuiriInt *ZhuiriInt_pointer)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_add_sender(tianzuo_ZhuiriInt *ZhuiriInt_pointer, int *sender_index, int const sign)
tianzuo_Zhuiri_lib int tianzuo_DataQueueInt_initialize(int init_size)
tianzuo_Zhuiri_lib void tianzuo_DataQueueInterface_terminate(tianzuo_DataQueue **DataQueue_pointer)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_data_free(tianzuo_ZhuiriInt *ZhuiriInt_pointer, void *Zhuiri, int const data_index)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_initialize(tianzuo_ZhuiriInt *ZhuiriInt_pointer, const char *ip_addr, int port, const void *callback, const void *context, int const heart_check_time, bool log_trace)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_terminate(tianzuo_ZhuiriInt *ZhuiriInt_pointer)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_heart_remove(tianzuo_ZhuiriInt *ZhuiriInt_pointer, int const data_id)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_set_param(tianzuo_ZhuiriInt *ZhuiriInt_pointer, int sender_index, int init_server_port, int msg_init_size, int recv_ex_data_max, int retry_max, int retry_all_number, int init_retry_time)
tianzuo_Zhuiri_lib tianzuo_DataQueue * tianzuo_DataQueueInterface_initialize()
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_send(tianzuo_ZhuiriInt *ZhuiriInt_pointer, int sender_index, int ip, int port, int sign, int function, char *send_data, int send_size)
struct Zhuiri_send_param_tag * Zhuiri_send_param_pointer
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_get_status(tianzuo_ZhuiriInt *ZhuiriInt_pointer)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_heart_add(tianzuo_ZhuiriInt *ZhuiriInt_pointer, int user_id, int ip_adrs, int port, int user_type, int send_time, int sender_user_id, int sender_user_type)
struct Zhuiri_param_tag Zhuiri_param_struct
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_heart_update(tianzuo_ZhuiriInt *ZhuiriInt_pointer, int const data_id)
struct Zhuiri_param_tag * Zhuiri_param_pointer
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_heart_modify(tianzuo_ZhuiriInt *ZhuiriInt_pointer, int const data_id, int const ip, int const port)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_get_type(tianzuo_ZhuiriInt *ZhuiriInt_pointer)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_stop_recv(tianzuo_ZhuiriInt *ZhuiriInt_pointer)
tianzuo_Zhuiri_lib int tianzuo_ZhuiriInt_begin_recv(tianzuo_ZhuiriInt *ZhuiriInt_pointer)
struct Zhuiri_send_param_tag Zhuiri_send_param_struct