lwip协议栈架构与设计解析内容摘要:

这个 接口设备就是用上面说的 if 结构体来描述。 所以说 neitif 结构体很重要。 Netif 模块 主要文件为 core/ 和 include/lwip/。 struct if { /** pointer to next in linked list */ struct if *next。 /** IP address configuration in work byte order */ struct ip_addr ip_addr。 struct ip_addr mask。 struct ip_addr gw。 /** This function is called by the work device driver 第 12 页 共 18 页 * to pass a packet up the TCP/IP stack. */ err_t (* input)(struct pbuf *p, struct if *inp)。 /** This function is called by the IP module when it wants * to send a packet on the interface. This function typically * first resolves the hardware address, then sends the packet. */ err_t (* output)(struct if *if, struct pbuf *p, struct ip_addr *ipaddr)。 /** This function is called by the ARP module when it wants * to send a packet on the interface. This function outputs * the pbuf asis on the link medium. */ err_t (* linkoutput)(struct if *if, struct pbuf *p)。 if LWIP_NETIF_STATUS_CALLBACK /** This function is called when the if state is set to up or down */ void (* status_callback)(struct if *if)。 endif /* LWIP_NETIF_STATUS_CALLBACK */ if LWIP_NETIF_LINK_CALLBACK /** This function is called when the if link is set to up or down */ void (* link_callback)(struct if *if)。 endif /* LWIP_NETIF_LINK_CALLBACK */ /** This field can be set by the device driver and could point * to state information for the device. */ void *state。 if LWIP_DHCP /** the DHCP client state information for this if */ struct dhcp *dhcp。 endif /* LWIP_DHCP */ if LWIP_AUTOIP /** the AutoIP client state information for this if */ struct autoip *autoip。 endif if LWIP_NETIF_HOSTNAME /* the hostname for this if, NULL is a valid value */ char* hostname。 endif /* LWIP_NETIF_HOSTNAME */ /** maximum transfer unit (in bytes) */ u16_t mtu。 /** number of bytes used in hwaddr */ u8_t hwaddr_len。 /** link level hardware address of this interface */ u8_t hwaddr[NETIF_MAX_HWADDR_LEN]。 /** flags (see NETIF_FLAG_ above) */ u8_t flags。 第 13 页 共 18 页 /** descriptive abbreviation */ char name[2]。 /** number of this interface */ u8_t num。 if LWIP_SNMP /** link type (from snmp_ifType enum from ) */ u8_t link_type。 /** (estimate) link speed */ u32_t link_speed。 /** timestamp at last change made (up/down) */ u32_t ts。 /** counters */ u32_t ifinoctets。 u32_t ifinucastpkts。 u32_t ifinnucastpkts。 u32_t ifindiscards。 u32_t ifoutoctets。 u32_t ifoutucastpkts。 u32_t ifoutnucastpkts。 u32_t ifoutdiscards。 endif /* LWIP_SNMP */ if LWIP_IGMP /* This function could be called to add or delete a entry in the multicast filter table of the ether MAC.*/ err_t (*igmp_mac_filter)( struct。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。