yb_arm/osp/inc/ospUdp.h
2023-07-12 14:14:31 +08:00

47 lines
1.2 KiB
C

#ifndef __OSPUDPH__
#define __OSPUDPH__
#ifdef __cplusplus
extern "C" {
#endif
#define OSP_UDP_RX 0
#define OSP_UDP_TX 1
extern int32_t osp_create_rxucp(int32_t port);
extern int32_t osp_create_txucp(int32_t port, char *targetIp);
extern int32_t osp_udp_send(char *pMsg, int32_t msgLen, int32_t udp_id);
extern int32_t osp_udp_receive(char *pbuf, int32_t size ,int32_t udp_id);
extern int32_t osp_send_udpmsg(Osp_Msg_Head *pMsg, uint64_t udp_id);
extern Osp_Msg_Head *osp_rev_udpmsg(uint64_t udp_id);
extern void OSP_Udp_Test_Main(Osp_Msg_Head *pMsg);
extern int32_t osp_udp_init(void);
extern void osp_show_udp(void);
extern int32_t osp_set_udp_noblock(int32_t udpid);
extern uint32_t osp_get_udp_rx_addr(int32_t udpid);
extern int32_t osp_get_txudp(char *ip, int32_t port);
extern int32_t osp_get_rxudp(char *ip, int32_t port);
extern int32_t osp_get_ip_port(int32_t udpid, char *ip, int32_t *port);
extern int32_t osp_check_udpid(int32_t udpid);
/*udp port distribution*/
#define OSP_NETSHELL_RX_PORT 10003
#define OSP_UDPID_TO_QUE(t, r) ((t) << 16 | (r))
#define OSP_UDPID_TO_TX(x) ((x) >> 16)
#define OSP_UDPID_TO_RX(x) ((x) & 0xffff)
#ifdef __cplusplus
}
#endif
#endif /*__OSPBUFH__ */