netif的linkoutput和output
来源:互联网 发布:js图片展示特效 编辑:程序博客网 时间:2024/05/12 08:39
LwIP的注释说的很清楚:
/** This function is called by the network device driver * to pass a packet up the TCP/IP stack. */ netif_input_fn input; /** 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. */ netif_output_fn output; /** This function is called by the ARP module when it wants * to send a packet on the interface. This function outputs * the pbuf as-is on the link medium. */ netif_linkoutput_fn linkoutput;
对于以太网接口的网卡来说:
linkoutput实际指向low_level_output,由ARP层调用,参数是:netif,ETH包
output实际指向etharp_output,由IP层调用,参数是:netif,IP包,目的IP地址
它们功能上的区别是:linkoutput是发送ETH包,output是发送IP包。
linkoutput是在已知目的MAC地址时调用,而output则相反。
output底层也是调用了linkoutput来发送组装好的ETH包的
对于SLIP(Serial Line Internet Protocol,串行线路网际协议)的网卡,它的output是slipif_output。
对于PPPoE(Point to Point Protocol over Ethernet)的网卡,它的output是pppifOutput。
这两种网络接口都用不到IP地址,不需要ARP,不需要linkoutput,直接在output内发送数据包
/** * Add a network interface to the list of lwIP netifs. * * @param netif a pre-allocated netif structure * @param ipaddr IP address for the new netif * @param netmask network mask for the new netif * @param gw default gateway IP address for the new netif * @param state opaque data passed to the new netif * @param init callback function that initializes the interface * @param input callback function that is called to pass * ingress packets up in the protocol layer stack. * * @return netif, or NULL if failed. */struct netif *netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
netif_add函数有input,但是没有output和linkoutput,为什么呢?
因为linkoutput不是必须的,像SLIP和PPPoE就没有,所以它们是在init函数中被赋的值。
0 0
- netif的linkoutput和output
- LwIP的netif和底层的一些初始化工作
- output和return的区别
- IAR Linker output 和extra output的区别
- JAVA基础的output和Sort
- autocomplete列表和output的使用:
- 【webpack】entry 和output的详细介绍
- webpack配置的entry和output new
- Angular2的input和output(原先的properties和events)
- Java之数据流DataInput(Output)Stream 和 字节数组流 ByteArrayInput(Output) Stream的嵌套
- 怎样在任意层访问下层的信息(包括 netif,mac,ifq,ll 等)
- lwip网络接口netif
- lwip之接口netif
- lwip网络接口netif
- output元素的追加和表单的验证
- Input和Output
- Input和Output
- 关于input和output
- 算法面试题
- Python中的logging模块
- 上传iOS项目到GitHub上
- RecyclerView 的使用 (跨列的GridView)
- HTML5快速上手之8:与有序列表有关的基本指令
- netif的linkoutput和output
- 如何编写移动Web页面
- Midway-ModelProxy — 轻量级的接口配置建模框架
- An internal error occurred during: "Building workspace". GC overhead limit exceeded
- 3.4 “继承”与Data Member
- Apt资料
- 两个数的交换
- spring 4.3.3下载地址
- 2.第一章