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

📄 zicmp.h

📁 uCOSII上实现的tcpip协议实现代码(gcc编译)
💻 H
字号:
#ifndef _ZICMP_H#define _ZICMP_H#include "zarch.h"#include "zdef.h"#include "zbuffer.h"#include "znetif.h"#include "zeth.h"#include "zipv4.h"#define ICMP_ER 0      /* echo reply */#define ICMP_DUR 3     /* destination unreachable */#define ICMP_SQ 4      /* source quench */#define ICMP_RD 5      /* redirect */#define ICMP_ECHO 8    /* echo */#define ICMP_TE 11     /* time exceeded */#define ICMP_PP 12     /* parameter problem */#define ICMP_TS 13     /* timestamp */#define ICMP_TSR 14    /* timestamp reply */#define ICMP_IRQ 15    /* information request */#define ICMP_IR 16     /* information reply */enum icmp_dur_type {	ICMP_DUR_NET = 0,    /* net unreachable */	ICMP_DUR_HOST = 1,   /* host unreachable */	ICMP_DUR_PROTO = 2,  /* protocol unreachable */	ICMP_DUR_PORT = 3,   /* port unreachable */	ICMP_DUR_FRAG = 4,   /* fragmentation needed and DF set */	ICMP_DUR_SR = 5      /* source route failed */};enum icmp_te_type {	ICMP_TE_TTL = 0,     /* time to live exceeded in transit */	ICMP_TE_FRAG = 1     /* fragment reassembly time exceeded */};STRUCT_BEGINtypedef struct _icmp_echo_header{	u16_t _type_code;	u16_t chksum;	u16_t id;	u16_t seqno;}icmp_echo_header_t;typedef struct _icmp_dur_header{	u16_t _type_code;	u16_t chksum;	u32_t unused;	}icmp_dur_header_t;typedef struct _icmp_te_header{	u16_t _type_code;	u16_t chksum;	u32_t unused;}icmp_te_header_t;STRUCT_ENDextern int icmp_input(znetif_t *pnetif, zbuffer_t *pbuffer);extern void icmp_dest_unreach(znetif_t *pnetif, zbuffer_t *pbuffer, enum icmp_dur_type t);#define ICMPH_TYPE(hdr) (NTOHS((hdr)->_type_code) >> 8)#define ICMPH_CODE(hdr) (NTOHS((hdr)->_type_code) & 0xff)#define ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = HTONS(ICMPH_CODE(hdr) | ((type) << 8)))#define ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = HTONS((code) | (ICMPH_TYPE(hdr) << 8)))#endif

⌨️ 快捷键说明

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