[c-sharp] view plaincopy
- /**
- * This function should be called when a packet is ready to be read
- * from the interface. It uses the function low_level_input() that
- * should handle the actual reception of bytes from the network
- * interface. Then the type of the received packet is determined and
- * the appropriate input function is called.
- * 当一个数据包已经从接口处读取时,调用本函数.它使用 low_level_input()函
- 数处理从网络接口接收的实际字节.然后根据接收的数据包确定并调用适当的input函数.
- * @param netif the lwip network interface structure for this ethernetif
- */
- int
- stellarisif_input(struct netif *netif)
- {
- struct ethernetif *ethernetif;
- struct pbuf *p;
- int count = 0;
- ethernetif = netif->state;
- /* move received packet into a new pbuf */
- //从一个pbuf数据包队列中弹出一个pbuf数据包
- while((p = dequeue_packet(ðernetif->rxq)) != NULL) {
- count++;
- /* process the packet.处理数据包 */
- if (ethernet_input(p, netif)!=ERR_OK) {
- LWIP_DEBUGF(NETIF_DEBUG, ("stellarisif_input: input error/n"));
- pbuf_free(p);
- p = NULL;
- }
- }
- return(count);
- }
|