⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netudp.h

📁 一个tcp/ip协议栈,带有PPP、IP、TCP、UDP等协议
💻 H
字号:
#ifndef _NETUDP_H_
#define _NETUDP_H_

/**
 * UDP header based on RFC768
 */
typedef struct udphdr{
	u_int16_t srcPort;		/* source port */
	u_int16_t dstPort;		/* destination port */
	u_int16_t length;
	u_int16_t checksum;
} UDPHdr;

/** Default time-to-live for UDP datagrams */
#define UDPTTL 0x3d

// Application Level functions
int udpPoll(int ud);
void udpUnblockRead(u_int ud);

// Added ONE TASK UDP support 
#if ONETASK_SUPPORT > 0
extern int udpOpen(void (*receiveEvent)(int ud, USHORT bytes));
#else
extern int udpOpen(void);
#endif

extern int udpClose(int ud);
extern int udpPoll(int ud);
extern int udpConnect(u_int ud, const struct sockaddr_in *remoteAddr, u_char tos);
extern int udpListen(u_int ud, int backLog);
extern int udpBind(u_int ud, struct sockaddr_in *peerAddr);
extern int udpRead(u_int ud, void *buf, long len);
extern int udpWrite(u_int ud, const void *buf, long len);
extern long udpRecvFrom(int ud, void  *buf, long len, struct sockaddr_in *from);
extern long udpSendTo(int ud, const void  *buf, long len, const struct sockaddr_in *to);

// Internal functions, used from within uC/IP
extern void udpInit(void);
extern void udpInput(NBuf *inBuf, u_int ipHeadLen);

#endif /* _NETUDP_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -