当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 43

fengMark/sarudp
关闭

forked from yuanhack/sarudp
关闭
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
sarudp_peer.h 2.46 KB
一键复制 编辑 原始数据 按行查看 历史
#ifndef __YH_SARUDP_PEER_H__
#define __YH_SARUDP_PEER_H__
#include "sarudp_comm.h"
typedef struct sar_udp_peer su_peer_t;
typedef void cb_su_peer_receiver_t(su_peer_t *ps, char* buff, int len);
/* SYN/ACK/Retransfer UDP peer manager */
struct sar_udp_peer {
/* foreign host info */
int fd;
SAUN destaddr;
socklen_t destlen;
uint16_t sid;
uint32_t seq;
struct rtt_info rttinfo;
int retry;
int retransmission; /* retransmit counting */
int rttinit;
/* event driver */
fe_t fe;
cb_su_peer_receiver_t * reliable_request_handle;
cb_su_peer_receiver_t * ordinary_request_handle;
pthread_t tid;
int run;
pthread_mutex_t mutex;
pthread_mutex_t lock;
pthread_cond_t ackcond;
pthread_cond_t syncond;
int ackwaitnum; /* SU_RELIABLE Requester number */
/* frames_t list: foreign respnose */
struct list ackrecvls; /* SU_RELIABLE Reply of the foreign host */
/* frames_t list: foreign request */
struct list synrecvls; /* Receive foreign host the active request */
frames_t *nowsynframe; /* Currently working with active request (syn) */
/* container cache_t: foreign reply result datas */
struct list lsackcache; /* The cache results for timeout check */
rb_root_t rbackcache; /* The cache results for re-syn search */
pthread_mutex_t cachelock;
};
int su_peer_create(su_peer_t *psar, const SA *ptoaddr, socklen_t servlen);
int su_peer_create_bind(su_peer_t *psar, int port, const SA *ptoaddr, socklen_t servlen);
void su_peer_destroy(su_peer_t *psar);
void su_peer_reliable_request_handle_install(su_peer_t *psar, cb_su_peer_receiver_t* reliable_request_handle);
void su_peer_ordinary_request_handle_install(su_peer_t *psar, cb_su_peer_receiver_t* ordinary_request_handle);
void su_peer_reliable_request_handle_uninstall(su_peer_t *psar);
void su_peer_ordinary_request_handle_uninstall(su_peer_t *psar);
int su_peer_send(su_peer_t *psar, const void *outbuff, int outbytes);
int su_peer_request(su_peer_t *psar, const void *outbuff, int outbytes, void *inbuff, int inbytes);
int su_peer_request_retry(su_peer_t *psar, const void *outbuff, int outbytes, void *inbuff, int inbytes);
int su_peer_getsrcaddr(su_peer_t *psar, SAUN *addr);
int su_peer_reply(su_peer_t *psar, const void *outbuff, int outbytes);
int su_peer_reply_ack(su_peer_t *psar);
void su_peer_reply_ignore(su_peer_t *psar);
#endif /* __YH_SARUDP_PEER_H__ */
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/github-22398575/sarudp.git
git@gitee.com:github-22398575/sarudp.git
github-22398575
sarudp
sarudp
master

搜索帮助