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

📄 ip.h

📁 LWIP1.1.1在UCOS-II2.61上的移植
💻 H
字号:
#ifndef __LWIP_IP_H__#define __LWIP_IP_H__#include "lwip/arch.h"#include "lwip/def.h"#include "lwip/pbuf.h"#include "lwip/ip_addr.h"#include "lwip/err.h"void ip_init(void);struct netif *ip_route(struct ip_addr *dest);err_t ip_input(struct pbuf *p, struct netif *inp);err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,		u8_t ttl, u8_t tos, u8_t proto);err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,		   u8_t ttl, u8_t tos, u8_t proto,       struct netif *netif);#define IP_HLEN 20#define IP_PROTO_ICMP 1#define IP_PROTO_UDP 17#define IP_PROTO_UDPLITE 170#define IP_PROTO_TCP 6/* This is passed as the destination address to ip_output_if (not   to ip_output), meaning that an IP header already is constructed   in the pbuf. This is used when TCP retransmits. */#ifdef IP_HDRINCL#undef IP_HDRINCL#endif /* IP_HDRINCL */#define IP_HDRINCL  NULL/* This is the common part of all PCB types. It needs to be at the   beginning of a PCB type definition. It is located here so that   changes to this common part are made in one location instead of   having to change all PCB structs. */#define IP_PCB struct ip_addr local_ip; \  struct ip_addr remote_ip; \   /* Socket options */  \  u16_t so_options;      \   /* Type Of Service */ \  u8_t tos;              \  /* Time To Live */     \  u8_t ttl/* * Option flags per-socket. These are the same like SO_XXX. */#define	SOF_DEBUG	    (u16_t)0x0001U		/* turn on debugging info recording */#define	SOF_ACCEPTCONN	(u16_t)0x0002U		/* socket has had listen() */#define	SOF_REUSEADDR	(u16_t)0x0004U		/* allow local address reuse */#define	SOF_KEEPALIVE	(u16_t)0x0008U		/* keep connections alive */#define	SOF_DONTROUTE	(u16_t)0x0010U		/* just use interface addresses */#define	SOF_BROADCAST	(u16_t)0x0020U		/* permit sending of broadcast msgs */#define	SOF_USELOOPBACK	(u16_t)0x0040U		/* bypass hardware when possible */#define	SOF_LINGER	    (u16_t)0x0080U		/* linger on close if data present */#define	SOF_OOBINLINE	(u16_t)0x0100U		/* leave received OOB data in line */#define	SOF_REUSEPORT	(u16_t)0x0200U		/* allow local address & port reuse */#ifdef PACK_STRUCT_USE_INCLUDES#  include "arch/bpstruct.h"#endifPACK_STRUCT_BEGINstruct ip_hdr{  /* version / header length / type of service */  PACK_STRUCT_FIELD(u16_t _v_hl_tos);  /* total length */  PACK_STRUCT_FIELD(u16_t _len);  /* identification */  PACK_STRUCT_FIELD(u16_t _id);  /* fragment offset field */  PACK_STRUCT_FIELD(u16_t _offset);#define IP_RF 0x8000        /* reserved fragment flag */#define IP_DF 0x4000        /* dont fragment flag */#define IP_MF 0x2000        /* more fragments flag */#define IP_OFFMASK 0x1fff   /* mask for fragmenting bits */  /* time to live / protocol*/  PACK_STRUCT_FIELD(u16_t _ttl_proto);  /* checksum */  PACK_STRUCT_FIELD(u16_t _chksum);  /* source and destination IP addresses */  PACK_STRUCT_FIELD(struct ip_addr src);  PACK_STRUCT_FIELD(struct ip_addr dest); } PACK_STRUCT_STRUCT;PACK_STRUCT_END#ifdef PACK_STRUCT_USE_INCLUDES#  include "arch/epstruct.h"#endif#define IPH_V(hdr)  (ntohs((hdr)->_v_hl_tos) >> 12)#define IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f)#define IPH_TOS(hdr) (ntohs((hdr)->_v_hl_tos) & 0xff)#define IPH_LEN(hdr) ((hdr)->_len)#define IPH_ID(hdr) ((hdr)->_id)#define IPH_OFFSET(hdr) ((hdr)->_offset)#define IPH_TTL(hdr) (ntohs((hdr)->_ttl_proto) >> 8)#define IPH_PROTO(hdr) (ntohs((hdr)->_ttl_proto) & 0xff)#define IPH_CHKSUM(hdr) ((hdr)->_chksum)#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos)))#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)#define IPH_ID_SET(hdr, id) (hdr)->_id = (id)#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (htons(IPH_PROTO(hdr) | ((ttl) << 8)))#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (htons((proto) | (IPH_TTL(hdr) << 8)))#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)#if IP_DEBUGvoid ip_debug_print(struct pbuf *p);#else#define ip_debug_print(p)#endif /* IP_DEBUG */#endif /* __LWIP_IP_H__ */

⌨️ 快捷键说明

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