ip.h

来自「Hermit-at-1.1.3,一款bootloader」· C头文件 代码 · 共 48 行

H
48
字号
#ifndef _HERMIT_IP_H_#define _HERMIT_IP_H_#define IP_VERSION 4#define LEN_IP_Header 20typedef enum _ip_proc_mode{  ICMP_WAIT,  TCP_WAIT,  UDP_WAIT,}ip_proc_mode;typedef struct _ip_frame{  unsigned char  header_len:4,                 version:4;  unsigned char  diffserv;  unsigned short data_len;  unsigned short id;#if 0  unsigned short flag_offset:13,                 flag:3;#else  unsigned short flag;#endif  unsigned char  ttl;//time to live  unsigned char  protocol;  unsigned short checksum;  unsigned char  src_ipaddr[4];  unsigned char  dst_ipaddr[4];}ip_frame;typedef enum _ip_protocol_id{  IP_PROTOCOL_ICMP = 0x01,  IP_PROTOCOL_TCP  = 0x06,  IP_PROTOCOL_UDP  = 0x11,}ip_protocol_id;int ip_send(const unsigned char *dst_ipaddr, const unsigned char protocol,	    const void *pbuf, const unsigned int pbuflen);int ip_proc(const int mode, void **pbuf, unsigned int *pbuflen);#endif

⌨️ 快捷键说明

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