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

📄 udp.h

📁 实用的程序代码
💻 H
字号:
/* * UDP  Header File */#ifndef _UDP_H#define _UDP_H#include <net/ip.h>#define UDP_HDR_LEN         0x0008      /* 8-byte header */#define NO_UDP_CHECKSUM     0x0000      /* No udp checksum is calculated */#define IP_PROTO_UDP        17          /* protocol field in IP header */ #define UDP_STRIP_HDR       0x01        /* remove header for udp handler type */#define UDP_ADD_HDR         0x02        /* add header for udp handler type */#define UDP_PORT            69          /* tftp port no. */#define UDP_DATA            1460        /* max possible udp data for ethernet */// udp header structurestruct xilnet_udp_hdr {  unsigned short src_port;  unsigned short dst_port;  unsigned short udp_len;  unsigned short check_sum;};// udp packetstruct xilnet_udp_pkt {  struct xilnet_udp_hdr udp_hdr;  unsigned char data[UDP_DATA];};// udp connection management#define MAX_UDP_CONNS         5      // maximum no of open udp conns#define UDP_CONN_OPEN         0      // waiting for client connection (only src port is known)#define UDP_CONN_CLOSED       1      // connection can be used #define UDP_CONN_ESTABLISHED  2      // full conn established (both src and dst ports are known)struct xilnet_udp_conn {   unsigned short src_port;   unsigned short dst_port;   unsigned char src_ip[IP_VERSION];   unsigned char dst_ip[IP_VERSION];   unsigned char state;   int fd; // socket descriptor into xsock_sockets table} ;extern struct xilnet_udp_conn xilnet_udp_conns[MAX_UDP_CONNS];extern void xilnet_udp_init_conns();#endif	/* _UDP_H */

⌨️ 快捷键说明

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