您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ uip_arp_arpin函数代码示例

51自学网 2021-06-03 09:07:53
  C++
这篇教程C++ uip_arp_arpin函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中uip_arp_arpin函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_arp_arpin函数的具体用法?C++ uip_arp_arpin怎么用?C++ uip_arp_arpin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了uip_arp_arpin函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Test_uip_arp_arpin_2

void Test_uip_arp_arpin_2(CuTest *tc) {	u8_t temp_buf[]= "/x11/x22/x33/x44/x55/x66/x77/x88/x99/x00/xAA/xBB/x08/x06""/x00/x01""/x08/x00""/x06""/x04""/x00/x02""/x77/x88/x99/x00/xAA/xBB""/xC0/xA8/x00/x03""/x11/x22/x33/x44/x55/x66""/xC0/xA8/x00/x02""/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00""/x00/x00/x00";u8_t expect_buf[]= "/x77/x88/x99/x00/xAA/xBB/x11/x22/x33/x44/x55/x66/x08/x06""/x00/x01""/x08/x00""/x06""/x04""/x00/x02""/x11/x22/x33/x44/x55/x66""/xC0/xA8/x00/x02""/x77/x88/x99/x00/xAA/xBB""/xC0/xA8/x00/x03";	memcpy(uip_buf,temp_buf,60);	uip_len=42;	uip_arp_arpin();	CuAssertIntEquals_Msg(tc,"arpin_len 2",0,uip_len);	CuAssertTrue_Msg(tc,"tabl check 2",0==memcmp(arp_table,"/xC0/xA8/x00/x03"			"/x77/x88/x99/x00/xAA/xBB/x00",11));}
开发者ID:kevinxusz,项目名称:uip,代码行数:33,


示例2: pollhandler

/*---------------------------------------------------------------------------*/static voidpollhandler(void){  process_poll(&ethernet_process);  uip_len = ethernet_poll();  if(uip_len > 0) {#if UIP_CONF_IPV6    if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {      uip_neighbor_add(&IPBUF->srcipaddr, &BUF->src);      tcpip_input();    } else#endif /* UIP_CONF_IPV6 */    if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {      uip_len -= sizeof(struct uip_eth_hdr);      tcpip_input();    } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {      uip_arp_arpin();      /* If the above function invocation resulted in data that	 should be sent out on the network, the global variable	 uip_len is set to a value > 0. */      if(uip_len > 0) {	ethernet_send();      }    }  }}
开发者ID:Contiki-leoqin,项目名称:contiki,代码行数:28,


示例3: pollhandler

/*---------------------------------------------------------------------------*/static voidpollhandler(void){  uip_len = tapdev_poll();  if(uip_len > 0) {#if UIP_CONF_IPV6    if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {      tcpip_input();    } else#endif /* UIP_CONF_IPV6 */    if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) {      uip_len -= sizeof(struct uip_eth_hdr);      tcpip_input();    } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) {#if !UIP_CONF_IPV6 //math       uip_arp_arpin();       /* If the above function invocation resulted in data that	  should be sent out on the network, the global variable	  uip_len is set to a value > 0. */       if(uip_len > 0) {	  tapdev_send();       }#endif                  } else {      uip_len = 0;    }  }}
开发者ID:200018171,项目名称:contiki,代码行数:30,


示例4: xtcp_process_incoming_packet

void xtcp_process_incoming_packet(chanend mac_tx){	if (BUF->type == htons(UIP_ETHTYPE_IP)) {		uip_arp_ipin();		uip_input();		if (uip_len > 0) {			if (uip_udpconnection()				&& (TCPBUF->proto != UIP_PROTO_ICMP)				&& (TCPBUF->proto != UIP_PROTO_IGMP))				uip_arp_out( uip_udp_conn);			else				uip_arp_out( NULL);			xtcp_tx_buffer(mac_tx);		}	} else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {		uip_arp_arpin();		if (uip_len > 0) {			xtcp_tx_buffer(mac_tx);		}		for (int i = 0; i < UIP_UDP_CONNS; i++) {			uip_udp_arp_event(i);			if (uip_len > 0) {				uip_arp_out(&uip_udp_conns[i]);				xtcp_tx_buffer(mac_tx);			}		}	}}
开发者ID:colinbroad,项目名称:sc_xtcp,代码行数:29,


示例5: ethernet_service

void ethernet_service(void) {	int i;	struct uip_eth_hdr *buf = (struct uip_eth_hdr *)&uip_buf[0];	etimer_request_poll();	process_run();	uip_len = liteethmac_poll();	if(uip_len > 0) {		if(buf->type == uip_htons(UIP_ETHTYPE_IP)) {			uip_arp_ipin();			uip_input();			if(uip_len > 0) {				uip_arp_out();				liteethmac_send();			}		} else if(buf->type == uip_htons(UIP_ETHTYPE_ARP)) {			uip_arp_arpin();			if(uip_len > 0)				liteethmac_send();		}	} else if (elapsed(&uip_periodic_event, uip_periodic_period)) {		for(i = 0; i < UIP_CONNS; i++) {			uip_periodic(i);			if(uip_len > 0) {				uip_arp_out();				liteethmac_send();			}		}	}	if (elapsed(&uip_arp_event, uip_arp_period)) {		uip_arp_timer();	}}
开发者ID:enjoy-digital,项目名称:arty-soc,代码行数:35,


示例6: netif_rx

int netif_rx(u8_t *p, u16_t len){    /*avoid Rx packet length > UIP buffer size  and cause UIP buffer overflow*/    if (len <= UIP_BUFSIZE + 2) {        mt76xx_dev_read(p, len);    } else {        printf_high("netif_rx length error: %d > %d/n", len, UIP_BUFSIZE + 2);        return -1;    }    if (uip_len > 0) {        if (BUF->type == htons(UIP_ETHTYPE_IP)) {            uip_arp_ipin();            uip_input();            /* If the above function invocation resulted in data that            should be sent out on the network, the global variable            uip_len is set to a value > 0. */            if (uip_len > 0) {                uip_arp_out();                mt76xx_dev_send();            }        } else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {            uip_arp_arpin();            /* If the above function invocation resulted in data that            should be sent out on the network, the global variable            uip_len is set to a value > 0. */            if (uip_len > 0) {                mt76xx_dev_send();            }        }    }    return 0;}
开发者ID:Altizon,项目名称:Aliot-SDK-Examples,代码行数:33,


示例7: pollhandler

/*---------------------------------------------------------------------------*/static voidpollhandler(void){#define BUF ((struct uip_eth_hdr *)&uip_buf[0])    /* Poll Ethernet device to see if there is a frame avaliable. */  uip_len = cs8900a_poll();  if(uip_len > 0) {    /* A frame was avaliable (and is now read into the uip_buf), so       we process it. */    if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {      uip_arp_ipin();      uip_len -= sizeof(struct uip_eth_hdr);      tcpip_input();    } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {      uip_arp_arpin();      /* If the above function invocation resulted in data that         should be sent out on the network, the global variable         uip_len is set to a value > 0. */      if(uip_len > 0) {        cs8900a_send();      }    }  }}
开发者ID:EDAyele,项目名称:ptunes,代码行数:27,


示例8: uip_arp_ipin

void Network::handlePacket(void){    if (uip_len > 0) {  /* received packet */        //printf("handlePacket: %d/n", uip_len);        if (BUF->type == htons(UIP_ETHTYPE_IP)) { /* IP packet */            uip_arp_ipin();            uip_input();            /* If the above function invocation resulted in data that                should be sent out on the network, the global variable                uip_len is set to a value > 0. */            if (uip_len > 0) {                uip_arp_out();                network_device_send();            }        } else if (BUF->type == htons(UIP_ETHTYPE_ARP)) { /*ARP packet */            uip_arp_arpin();            /* If the above function invocation resulted in data that                should be sent out on the network, the global variable                uip_len is set to a value > 0. */            if (uip_len > 0) {                tapdev_send(uip_buf, uip_len);  /* ARP ack*/            }        } else {            printf("Unknown ethernet packet type %04X/n", htons(BUF->type));            uip_len = 0;        }    }}
开发者ID:2thetop,项目名称:Smoothieware,代码行数:32,


示例9: deal

void deal(){    int i;    if(uip_len > 0) {        if(BUF_IF->type == htons(UIP_ETHTYPE_IP)) {            uip_arp_ipin();            uip_input();            /* If the above function invocation resulted in data that               should be sent out on the network, the global variable               uip_len is set to a value > 0. */            if(uip_len > 0) {                uip_arp_out();                current_dev->eth_tx(current_dev, uip_buf, uip_len);            }        } else if(BUF_IF->type == htons(UIP_ETHTYPE_ARP)) {            uip_arp_arpin();            /* If the above function invocation resulted in data that               should be sent out on the network, the global variable               uip_len is set to a value > 0. */            if(uip_len > 0) {                current_dev->eth_tx(current_dev, uip_buf, uip_len);            }        }    } else if(timer_expired(&periodic_timer)) {        timer_reset(&periodic_timer);        for(i = 0; i < UIP_CONNS; i++) {            uip_periodic(i);            /* If the above function invocation resulted in data that               should be sent out on the network, the global variable               uip_len is set to a value > 0. */            if(uip_len > 0) {                uip_arp_out();                current_dev->eth_tx(current_dev, uip_buf, uip_len);	            }        }#if UIP_UDP        for(i = 0; i < UIP_UDP_CONNS; i++) {            uip_udp_periodic(i);            /* If the above function invocation resulted in data that               should be sent out on the network, the global variable               uip_len is set to a value > 0. */            if(uip_len > 0) {                uip_arp_out();                current_dev->eth_tx(current_dev, uip_buf, uip_len);	            }        }#endif /* UIP_UDP */        /* Call the ARP timer function every 10 seconds. */        if(timer_expired(&arp_timer)) {            timer_reset(&arp_timer);            uip_arp_timer();        }    }    //rt_exit_critical();    return 0;}
开发者ID:dreamflyforever,项目名称:rt-thread-1.1.0,代码行数:59,


示例10: enc28j60PacketReceive

void NanodeUIP::poll(void) {  int i;  uip_len = enc28j60PacketReceive(UIP_BUFSIZE,uip_buf);  if(uip_len > 0) {    if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {      uip_arp_ipin();      uip_input();      /* If the above function invocation resulted in data that	 should be sent out on the network, the global variable	 uip_len is set to a value > 0. */      if(uip_len > 0) {	uip_arp_out();	enc28j60PacketSend(uip_len,uip_buf);      }    } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {      uip_arp_arpin();      /* If the above function invocation resulted in data that	 should be sent out on the network, the global variable	 uip_len is set to a value > 0. */      if(uip_len > 0) {	enc28j60PacketSend(uip_len,uip_buf);      }    }  } else if(timer_expired(&periodic_timer)) {    timer_reset(&periodic_timer);    for(i = 0; i < UIP_CONNS; i++) {      uip_periodic(i);      /* If the above function invocation resulted in data that	 should be sent out on the network, the global variable	 uip_len is set to a value > 0. */      if(uip_len > 0) {	uip_arp_out();	enc28j60PacketSend(uip_len,uip_buf);      }    }#if UIP_UDP    for(i = 0; i < UIP_UDP_CONNS; i++) {      uip_udp_periodic(i);      /* If the above function invocation resulted in data that	 should be sent out on the network, the global variable	 uip_len is set to a value > 0. */      if(uip_len > 0) {	uip_arp_out();	enc28j60PacketSend(uip_len,uip_buf);      }    }#endif /* UIP_UDP */    /* Call the ARP timer function every 10 seconds. */    if(timer_expired(&arp_timer)) {      timer_reset(&arp_timer);      uip_arp_timer();    }  }}
开发者ID:skydome,项目名称:NanodeUIP,代码行数:57,


示例11: Network_Process

/** * @brief   Process Network * @param   None * @retval  None */void Network_Process(void){	static uint8_t arp_counter = 0;	int i;	for (i = 0; i < UIP_CONNS; i++)	{		uip_periodic(i);		if (uip_len > 0)		{			uip_arp_out();			enc28j60_send_packet((uint8_t *)uip_buf, uip_len);		}	}	#if UIP_UDP		for (i = 0; i < UIP_UDP_CONNS; i++)		{			uip_udp_periodic(i);			if (uip_len > 0)			{				uip_arp_out();				network_send();			}		}	#endif /* UIP_UDP */	if (++arp_counter >= 50)	{		arp_counter = 0;		uip_arp_timer();	}	uip_len = enc28j60_recv_packet((uint8_t *)uip_buf, UIP_BUFSIZE);	if (uip_len > 0)	{		if (((struct uip_eth_hdr *)&uip_buf[0])->type == htons(UIP_ETHTYPE_IP))		{			uip_arp_ipin();			uip_input();			if (uip_len > 0)			{				uip_arp_out();				enc28j60_send_packet((uint8_t *)uip_buf, uip_len);			}		}		else if (((struct uip_eth_hdr *)&uip_buf[0])->type == htons(UIP_ETHTYPE_ARP))		{			uip_arp_arpin();			if (uip_len > 0)			{				enc28j60_send_packet((uint8_t *)uip_buf, uip_len);			}		}	}}
开发者ID:alemoke,项目名称:theLEDStripControl,代码行数:61,


示例12: TcpIpMain

/** ******************************************************************************************* * @fn         void TcpIpMain(void) * @brief      Update the uIP stack. * @return     None * @attention ******************************************************************************************* */void TcpIpMain(void){   uint8_t                                 Index;   uip_len = nic_poll();   if (uip_len == 0)   {         // If timed out, call periodic function for each connection         if (TcpIpUipTimerCounter >= TCP_IP_CNT_TIME)         {            TcpIpUipTimerCounter = 0;            for (Index = 0; Index < UIP_CONNS; Index++)            {               uip_periodic(Index);               if (uip_len > 0)               {                  uip_arp_out();                  nic_send();               }            }            /* Call the ARP timer function every ~10 seconds. */            if (++TcpIpUipArpTimerCounter >= TCP_IP_ARP_CNT_TIME)            {               uip_arp_timer();               TcpIpUipArpTimerCounter = 0;            }         }   }   else                                                                        // packet received   {      // process an IP packet      if (TCP_IP_BUF->type == htons(UIP_ETHTYPE_IP))      {         uip_arp_ipin();         uip_input();         if (uip_len > 0)         {            uip_arp_out();            nic_send();         }      }      // process an ARP packet      else if (TCP_IP_BUF->type == htons(UIP_ETHTYPE_ARP))      {         uip_arp_arpin();         if (uip_len > 0)            nic_send();      }      TcpIpUipTimerCounter = 0;   }}
开发者ID:AndTH,项目名称:GCA,代码行数:61,


示例13: rtos_vnet_recv

void rtos_vnet_recv(struct rgmp_vnet *vnet_dummy, char *data, int len){    // now only support 1 vnet    struct vnet_driver_s *vnet = &g_vnet[0];    do {	/* Check for errors and update statistics */	/* Check if the packet is a valid size for the uIP buffer configuration */	if (len > CONFIG_NET_BUFSIZE || len < 14) {#ifdef CONFIG_DEBUG	    cprintf("VNET: receive invalid packet of size %d/n", len);#endif	    return;	}	// Copy the data data from the hardware to vnet->sk_dev.d_buf.  Set	// amount of data in vnet->sk_dev.d_len	memcpy(vnet->sk_dev.d_buf, data, len);	vnet->sk_dev.d_len = len;	/* We only accept IP packets of the configured type and ARP packets */#ifdef CONFIG_NET_IPv6	if (BUF->type == HTONS(UIP_ETHTYPE_IP6))#else	if (BUF->type == HTONS(UIP_ETHTYPE_IP))#endif	{	    uip_arp_ipin(&vnet->sk_dev);	    uip_input(&vnet->sk_dev);	    // If the above function invocation resulted in data that should be	    // sent out on the network, the field  d_len will set to a value > 0.	    if (vnet->sk_dev.d_len > 0) {		uip_arp_out(&vnet->sk_dev);		vnet_transmit(vnet);	    }	}	else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {	    uip_arp_arpin(&vnet->sk_dev);	    // If the above function invocation resulted in data that should be	    // sent out on the network, the field  d_len will set to a value > 0.	    if (vnet->sk_dev.d_len > 0) {		vnet_transmit(vnet);	    }	}    }    while (0); /* While there are more packets to be processed */}
开发者ID:l--putt,项目名称:nuttx-bb,代码行数:51,


示例14: skel_receive

static void skel_receive(FAR struct skel_driver_s *skel){  do    {      /* Check for errors and update statistics */      /* Check if the packet is a valid size for the uIP buffer configuration */      /* Copy the data data from the hardware to skel->sk_dev.d_buf.  Set       * amount of data in skel->sk_dev.d_len       */      /* We only accept IP packets of the configured type and ARP packets */#ifdef CONFIG_NET_IPv6      if (BUF->type == HTONS(UIP_ETHTYPE_IP6))#else      if (BUF->type == HTONS(UIP_ETHTYPE_IP))#endif        {          uip_arp_ipin(&skel->sk_dev);          uip_input(&skel->sk_dev);          /* If the above function invocation resulted in data that should be           * sent out on the network, the field  d_len will set to a value > 0.           */          if (skel->sk_dev.d_len > 0)           {             uip_arp_out(&skel->sk_dev);             skel_transmit(skel);           }        }      else if (BUF->type == htons(UIP_ETHTYPE_ARP))        {          uip_arp_arpin(&skel->sk_dev);          /* If the above function invocation resulted in data that should be           * sent out on the network, the field  d_len will set to a value > 0.           */          if (skel->sk_dev.d_len > 0)            {              skel_transmit(skel);            }        }    }  while (); /* While there are more packets to be processed */}
开发者ID:grissiom,项目名称:muttx-mirror,代码行数:49,


示例15: PROCESS_THREAD

PROCESS_THREAD(network_process, ev, data) {  PROCESS_BEGIN();    while(1) {    PROCESS_PAUSE();    uip_len = enc28j60_read(uip_buf, UIP_BUFSIZE);    if (uip_len > 0) {      HAL_IWDG_Refresh(&hiwdg);            struct uip_eth_hdr *header = ((struct uip_eth_hdr *)&uip_buf[0]);      uint16_t packetType = header->type;      #ifdef ENC28J60_DEBUG	printf("?receivePacket: len: %d, dest: %02x:%02x:%02x:%02x:%02x:%02x, src: %02x:%02x:%02x:%02x:%02x:%02x, type: %d/n",	      uip_len,	      header->dest.addr[0], header->dest.addr[1], header->dest.addr[2], header->dest.addr[3], header->dest.addr[4], header->dest.addr[5],	      header->src.addr[0], header->src.addr[1], header->src.addr[2], header->src.addr[3], header->src.addr[4], header->src.addr[5],	      packetType	      );	for (int i = 0; i < uip_len; i++) {	  printf("%02x ", uip_buf[i]);	}	printf("/n");      #endif      if (packetType == UIP_HTONS(UIP_ETHTYPE_IP)) {	#ifdef ENC28J60_DEBUG	  printf("?readPacket type IP/n");	#endif	uip_arp_ipin();	uip_input();	if (uip_len > 0) {	  uip_arp_out();	  enc28j60_send(uip_buf, uip_len + sizeof(struct uip_eth_hdr));	}      } else if (packetType == UIP_HTONS(UIP_ETHTYPE_ARP)) {	#ifdef ENC28J60_DEBUG	  printf("?readPacket type ARP/n");	#endif	uip_arp_arpin();	if (uip_len > 0) {	  enc28j60_send(uip_buf, uip_len + sizeof(struct uip_eth_hdr));	}      }    }  }    PROCESS_END();}
开发者ID:glocklueng,项目名称:stm32-network-rs232,代码行数:49,


示例16: enc_receive_packet

/** * Receive a single packet. * The contents will be placed in uip_buf, and uIP is called * as appropriate. */void enc_receive_packet(void) {	/* Receive a single packet */	uint8_t header[6];	uint8_t *status = header + 2;	WRITE_REG(ENC_ERDPTL, enc_next_packet & 0xFF);	WRITE_REG(ENC_ERDPTH, (enc_next_packet >> 8) & 0xFF);	enc_rbm(header, 6);	/* Update next packet pointer */	enc_next_packet = header[0] | (header[1] << 8);	uint16_t data_count = status[0] | (status[1] << 8);	if (status[2] & (1 << 7)) {	  uip_len = data_count;	  enc_rbm(uip_buf, data_count);	  if( BUF->type == htons(UIP_ETHTYPE_IP) ) {	    uip_arp_ipin();	    uip_input();	    if( uip_len > 0 ) {	      uip_arp_out();	      enc_send_packet(uip_buf, uip_len);	      uip_len = 0;	    }	  } else if( BUF->type == htons(UIP_ETHTYPE_ARP) ) {	    uip_arp_arpin();	    if( uip_len > 0 ) {	      //uip_arp_out();	      enc_send_packet(uip_buf, uip_len);	      uip_len = 0;	    }	  }	}	uint16_t erxst = READ_REG(ENC_ERXSTL) | (READ_REG(ENC_ERXSTH) << 8);	/* Mark packet as read */	if (enc_next_packet == erxst) {		WRITE_REG(ENC_ERXRDPTL, READ_REG(ENC_ERXNDL));		WRITE_REG(ENC_ERXRDPTH, READ_REG(ENC_ERXNDH));	} else {		WRITE_REG(ENC_ERXRDPTL, (enc_next_packet-1) & 0xFF);		WRITE_REG(ENC_ERXRDPTH, ((enc_next_packet-1) >> 8) & 0xFF);	}	SET_REG_BITS(ENC_ECON2, ENC_ECON2_PKTDEC);}
开发者ID:mota37,项目名称:Modbus,代码行数:53,


示例17: uIPManagement_ProcessIncomingPacket

/** Processes Incoming packets to the server from the connected RNDIS device, creating responses as needed. */static void uIPManagement_ProcessIncomingPacket(void){	/* If no packet received, exit processing routine */	if (!(RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface)))	  return;	LEDs_SetAllLEDs(LEDMASK_USB_BUSY);	/* Read the Incoming packet straight into the UIP packet buffer */	RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, uip_buf, &uip_len);	/* If the packet contains an Ethernet frame, process it */	if (uip_len > 0)	{		switch (((struct uip_eth_hdr*)uip_buf)->type)		{			case HTONS(UIP_ETHTYPE_IP):				/* Filter packet by MAC destination */				uip_arp_ipin();				/* Process Incoming packet */				uip_input();				/* If a response was generated, send it */				if (uip_len > 0)				{					/* Add destination MAC to outgoing packet */					uip_arp_out();					uip_split_output();				}				break;			case HTONS(UIP_ETHTYPE_ARP):				/* Process ARP packet */				uip_arp_arpin();				/* If a response was generated, send it */				if (uip_len > 0)				  uip_split_output();				break;		}	}	LEDs_SetAllLEDs(LEDMASK_USB_READY | ((HaveIPConfiguration) ? LEDMASK_UIP_READY_CONFIG : LEDMASK_UIP_READY_NOCONFIG));}
开发者ID:AdjacentReality,项目名称:lufa-lib,代码行数:48,


示例18: _kernel_net_uip_recv

int _kernel_net_uip_recv(desc_t desc_r,desc_t desc_w){   if(desc_r<0 || desc_w<0)      return -1;   uip_len = g_pf_net_recv_ip_packet(desc_r,uip_buf, sizeof(uip_buf));   if(uip_len > 0) {   #if defined(USE_IF_ETHERNET)      if(__eth_hdr->type == htons(UIP_ETHTYPE_IP)) {         uip_arp_ipin();         uip_process(UIP_DATA);         /* If the above function invocation resulted in data that         should be sent out on the network, the global variable         uip_len is set to a value > 0. */         if(uip_len > 0) {            uip_arp_out();            g_pf_net_send_ip_packet(desc_w,uip_buf,uip_len);            uip_len=0;         }      } else if(__eth_hdr->type == htons(UIP_ETHTYPE_ARP)) {         uip_arp_arpin();         /* If the above function invocation resulted in data that            should be sent out on the network, the global variable            uip_len is set to a value > 0. */         if(uip_len > 0) {            g_pf_net_send_ip_packet(desc_w,uip_buf,uip_len);            uip_len=0;         }      }   #elif defined(USE_IF_SLIP)      uip_process(UIP_DATA);      /* If the above function invocation resulted in data that      should be sent out on the network, the global variable      uip_len is set to a value > 0. */      if(uip_len > 0) {         g_pf_net_send_ip_packet(desc_w,uip_buf,uip_len);         uip_len=0;      }   #endif   }   return 0;}
开发者ID:lepton-distribution,项目名称:lepton-root.scions,代码行数:44,


示例19: ethernet_process

void ethernet_process(void) {	if(linkstate == 0) {		Dm9161       *pDm = &gDm9161;		if( DM9161_GetLinkSpeed(pDm, 1) != 0 ) {			TRACE_INFO("P: Link detected/n/r");			linkstate=1;			LED2_ON();			// Auto Negotiate			if (!DM9161_AutoNegotiate(pDm)) {				TRACE_INFO("P: Auto Negotiate ERROR!/n/r");				return;			}		}	} else {		uip_len = network_read();		if(uip_len > 0) {			if(BUF->type == htons(UIP_ETHTYPE_IP)){				uip_arp_ipin();				uip_input();				if(uip_len > 0) {					uip_arp_out();					network_send();				}			} else if(BUF->type == htons(UIP_ETHTYPE_ARP)){				uip_arp_arpin();				if(uip_len > 0){					network_send();				}			}		}	}}
开发者ID:Diggen85,项目名称:a-culfw,代码行数:43,


示例20: FrameReceivedHandler

/* * Ethernet frame received. */static void FrameReceivedHandler(eventid_t id) {  (void)id;  while ((uip_len = network_device_read()) > 0) {    if (BUF->type == HTONS(UIP_ETHTYPE_IP)) {      uip_arp_ipin();      uip_input();      if (uip_len > 0) {        uip_arp_out();        network_device_send();      }    }    else if (BUF->type == HTONS(UIP_ETHTYPE_ARP)) {      uip_arp_arpin();      if (uip_len > 0)        network_device_send();    }  }}
开发者ID:ColonelPanic42,项目名称:ChibiOS-RPi,代码行数:22,


示例21: rtl8019_drv_idle

/*-----------------------------------------------------------------------------------*/static voidrtl8019_drv_idle(void){  /* Poll Ethernet device to see if there is a frame avaliable. */  uip_len = rtl8019as_poll();  if(uip_len > 0) {    /* A frame was avaliable (and is now read into the uip_buf), so       we process it. */     if(BUF->type == htons(UIP_ETHTYPE_IP)) {      /*      debug_print16(uip_len);*/      uip_arp_ipin();      uip_len -= sizeof(struct uip_eth_hdr);      uip_input();      /* If the above function invocation resulted in data that	 should be sent out on the network, the global variable	 uip_len is set to a value > 0. */      if(uip_len > 0) {	/*	debug_print(PSTR("Sending packet/n"));*/	uip_arp_out();	rtl8019as_send();      }    } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {      uip_arp_arpin();      /* If the above function invocation resulted in data that	 should be sent out on the network, the global variable	 uip_len is set to a value > 0. */	      if(uip_len > 0) {	rtl8019as_send();      }    }  }  /* Check the clock so see if we should call the periodic uIP     processing. */  current = ek_clock();  if((current - start) >= CLK_TCK/2 ||     (current - start) < 0) {    timer();    start = current;  }    }
开发者ID:EDAyele,项目名称:ptunes,代码行数:42,


示例22: nethandler_rx

void nethandler_rx(){	uip_len = network_read();	if (uip_len > 0) {		switch (ntohs(BUF->type)) {		case UIP_ETHTYPE_IP:			uip_arp_ipin();			uip_input();			if (uip_len > 0) {				uip_arp_out();				network_send();			}		break;		case UIP_ETHTYPE_ARP:			uip_arp_arpin();			if (uip_len > 0)				network_send();		break;		}	}}
开发者ID:atalax,项目名称:avr-mqtt-board,代码行数:22,


示例23: eth_poll

/** * /brief	Ethernet IO function. * /param	void There are no parameters needed. * /return	No return values. */static voideth_poll(void){	/*Get Buffer*/	uip_len = (u16_t)EthernetPacketGet(ETH_BASE, uip_buf, UIP_BUFSIZE);	if(uip_len > 0) {		if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {			uip_arp_ipin();			uip_input();			if(uip_len > 0) {				uip_arp_out();				EthernetPacketPut(ETH_BASE, uip_buf, uip_len);			}		} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {			uip_arp_arpin();			if(uip_len > 0) {				EthernetPacketPut(ETH_BASE, uip_buf, uip_len);			}		}	}	EthernetIntEnable(ETH_BASE, ETH_INT_RX);}
开发者ID:kincki,项目名称:contiki,代码行数:29,


示例24: vuIP_Task

void vuIP_Task( void *pvParameters ){    portBASE_TYPE i;    unsigned long ulNewEvent = 0UL;    unsigned long ulUIP_Events = 0UL;    ( void ) pvParameters;    /* Initialise the uIP stack. */    prvInitialise_uIP();    /* Initialise the MAC. */    vInitEmac();    while( lEMACWaitForLink() != pdPASS )    {        vTaskDelay( uipINIT_WAIT );    }    for( ;; )    {        if( ( ulUIP_Events & uipETHERNET_RX_EVENT ) != 0UL )        {            /* Is there received data ready to be processed? */            uip_len = ( unsigned short ) ulEMACRead();            if( ( uip_len > 0 ) && ( uip_buf != NULL ) )            {                /* Standard uIP loop taken from the uIP manual. */                if( xHeader->type == htons( UIP_ETHTYPE_IP ) )                {                    uip_arp_ipin();                    uip_input();                    /* If the above function invocation resulted in data that                    should be sent out on the network, the global variable                    uip_len is set to a value > 0. */                    if( uip_len > 0 )                    {                        uip_arp_out();                        vEMACWrite();                    }                }                else if( xHeader->type == htons( UIP_ETHTYPE_ARP ) )                {                    uip_arp_arpin();                    /* If the above function invocation resulted in data that                    should be sent out on the network, the global variable                    uip_len is set to a value > 0. */                    if( uip_len > 0 )                    {                        vEMACWrite();                    }                }            }            else            {                ulUIP_Events &= ~uipETHERNET_RX_EVENT;            }        }        if( ( ulUIP_Events & uipPERIODIC_TIMER_EVENT ) != 0UL )        {            ulUIP_Events &= ~uipPERIODIC_TIMER_EVENT;            for( i = 0; i < UIP_CONNS; i++ )            {                uip_periodic( i );                /* If the above function invocation resulted in data that                should be sent out on the network, the global variable                uip_len is set to a value > 0. */                if( uip_len > 0 )                {                    uip_arp_out();                    vEMACWrite();                }            }        }        /* Call the ARP timer function every 10 seconds. */        if( ( ulUIP_Events & uipARP_TIMER_EVENT ) != 0 )        {            ulUIP_Events &= ~uipARP_TIMER_EVENT;            uip_arp_timer();        }        if( ulUIP_Events == pdFALSE )        {            xQueueReceive( xEMACEventQueue, &ulNewEvent, portMAX_DELAY );            ulUIP_Events |= ulNewEvent;        }    }}
开发者ID:BuiChien,项目名称:FreeRTOS-TM4C123GXL,代码行数:95,


示例25: vuIP_Task

void vuIP_Task( void *pvParameters ){portBASE_TYPE i;uip_ipaddr_t xIPAddr;struct timer periodic_timer, arp_timer;extern void ( vEMAC_ISR_Wrapper )( void );	/* Create the semaphore used by the ISR to wake this task. */	vSemaphoreCreateBinary( xEMACSemaphore );		/* Initialise the uIP stack. */	timer_set( &periodic_timer, configTICK_RATE_HZ / 2 );	timer_set( &arp_timer, configTICK_RATE_HZ * 10 );	uip_init();	uip_ipaddr( xIPAddr, uipIP_ADDR0, uipIP_ADDR1, uipIP_ADDR2, uipIP_ADDR3 );	uip_sethostaddr( xIPAddr );	httpd_init();	/* Initialise the MAC. */	while( Init_EMAC() != pdPASS )    {        vTaskDelay( uipINIT_WAIT );    }	portENTER_CRITICAL();	{		MAC_INTENABLE = INT_RX_DONE;        VICIntEnable |= 0x00200000;        VICVectAddr21 = ( portLONG ) vEMAC_ISR_Wrapper;		prvSetMACAddress();	}	portEXIT_CRITICAL();		for( ;; )	{		/* Is there received data ready to be processed? */		uip_len = uiGetEMACRxData( uip_buf );				if( uip_len > 0 )		{			/* Standard uIP loop taken from the uIP manual. */			if( xHeader->type == htons( UIP_ETHTYPE_IP ) )			{				uip_arp_ipin();				uip_input();				/* If the above function invocation resulted in data that 				should be sent out on the network, the global variable 				uip_len is set to a value > 0. */				if( uip_len > 0 )				{					uip_arp_out();					prvENET_Send();				}			}			else if( xHeader->type == htons( UIP_ETHTYPE_ARP ) )			{				uip_arp_arpin();				/* If the above function invocation resulted in data that 				should be sent out on the network, the global variable 				uip_len is set to a value > 0. */				if( uip_len > 0 )				{					prvENET_Send();				}			}		}		else		{			if( timer_expired( &periodic_timer ) )			{				timer_reset( &periodic_timer );				for( i = 0; i < UIP_CONNS; i++ )				{					uip_periodic( i );						/* If the above function invocation resulted in data that 					should be sent out on the network, the global variable 					uip_len is set to a value > 0. */					if( uip_len > 0 )					{						uip_arp_out();						prvENET_Send();					}				}						/* Call the ARP timer function every 10 seconds. */				if( timer_expired( &arp_timer ) )				{					timer_reset( &arp_timer );					uip_arp_timer();				}			}			else			{							/* We did not receive a packet, and there was no periodic				processing to perform.  Block for a fixed period.  If a packet				is received during this period we will be woken by the ISR//.........这里部分代码省略.........
开发者ID:Dzenik,项目名称:FreeRTOS_TEST,代码行数:101,


示例26: e1000_receive

static void e1000_receive(struct e1000_dev *e1000){    int head = e1000->rx_ring.head;    unsigned char *cp = (unsigned char *)		(e1000->rx_ring.buf + head * CONFIG_E1000_BUFF_SIZE);    int cnt;    while (e1000->rx_ring.desc[head].desc_status) {		/* Check for errors and update statistics */			// Here we do not handle packets that exceed packet-buffer size		if ((e1000->rx_ring.desc[head].desc_status & 3) == 1) {			cprintf("NIC READ: Oversized packet/n");			goto next;		}			/* Check if the packet is a valid size for the uIP buffer configuration */			// get the number of actual data-bytes in this packet		cnt = e1000->rx_ring.desc[head].packet_length;			if (cnt > CONFIG_NET_BUFSIZE || cnt < 14) {			cprintf("NIC READ: invalid package size/n");			goto next;		}    		/* Copy the data data from the hardware to e1000->uip_dev.d_buf.  Set		 * amount of data in e1000->uip_dev.d_len		 */    		// now we try to copy these data-bytes to the UIP buffer		memcpy(e1000->uip_dev.d_buf, cp, cnt);		e1000->uip_dev.d_len = cnt;		/* We only accept IP packets of the configured type and ARP packets */#ifdef CONFIG_NET_IPv6		if (BUF->type == HTONS(UIP_ETHTYPE_IP6))#else			if (BUF->type == HTONS(UIP_ETHTYPE_IP))#endif			{				uip_arp_ipin(&e1000->uip_dev);				uip_input(&e1000->uip_dev);				/* If the above function invocation resulted in data that should be				 * sent out on the network, the field  d_len will set to a value > 0.				 */				if (e1000->uip_dev.d_len > 0) {					uip_arp_out(&e1000->uip_dev);					e1000_transmit(e1000);				}			}			else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {				uip_arp_arpin(&e1000->uip_dev);				/* If the above function invocation resulted in data that should be				 * sent out on the network, the field  d_len will set to a value > 0.				 */				if (e1000->uip_dev.d_len > 0) {					e1000_transmit(e1000);				}			}    next:		e1000->rx_ring.desc[head].desc_status = 0;		e1000->rx_ring.head = (head + 1) % CONFIG_E1000_N_RX_DESC;		e1000->rx_ring.free++;		head = e1000->rx_ring.head;		cp = (unsigned char *)(e1000->rx_ring.buf + head * CONFIG_E1000_BUFF_SIZE);    }}
开发者ID:1015472,项目名称:PX4NuttX,代码行数:75,


示例27: uip_task

void uip_task(void *p){	int i;  	struct timer periodic_timer, arp_timer;  	enc28j60_open();	  	timer_set(&periodic_timer, CLOCK_SECOND / 2);  	timer_set(&arp_timer, CLOCK_SECOND * 10);    	  	  	while(1)   	{  		socket_process_pending_lists_();  		    	uip_len = enc28j60_read();    	    	if(uip_len > 0)     	{      		if(BUF->type == htons(UIP_ETHTYPE_IP))       		{        		uip_input();        		/* If the above function invocation resulted in data that           		should be sent out on the network, the global variable           		uip_len is set to a value > 0. */        		if(uip_len > 0)         		{          			uip_arp_out();          			enc28j60_write();        		}      		}       		else if(BUF->type == htons(UIP_ETHTYPE_ARP))       		{        		uip_arp_arpin();        		/* If the above function invocation resulted in data that           		should be sent out on the network, the global variable           		uip_len is set to a value > 0. */        		if(uip_len > 0)         		{          			enc28j60_write();        		}      		}		} 				if(timer_expired(&periodic_timer)) 		{      		timer_reset(&periodic_timer);      		for(i = 0; i < UIP_CONNS; i++)       		{        		uip_periodic(i);        		/* If the above function invocation resulted in data that           		should be sent out on the network, the global variable           		uip_len is set to a value > 0. */        		if(uip_len > 0)         		{          			uip_arp_out();          			enc28j60_write();        		}      		}#if UIP_UDP      		for(i = 0; i < UIP_UDP_CONNS; i++)       		{        		uip_udp_periodic(i);        		/* If the above function invocation resulted in data that           		should be sent out on the network, the global variable           		uip_len is set to a value > 0. */        		if(uip_len > 0)         		{          			uip_arp_out();          			enc28j60_write();        		}        	}#endif /* UIP_UDP */                 		/* Call the ARP timer function every 10 seconds. */      		if(timer_expired(&arp_timer))       		{      			timer_reset(&arp_timer);      			uip_arp_timer();      		}    	}    	    	//yield so that other tasks can do something    	sys_msleep(UIP_TASK_YIELD_TIME_MS);	}  	}
开发者ID:jayaraj-poroor,项目名称:freertos-uip-kernel,代码行数:88,


示例28: main

int main(int argc, char *argv[]) {  uip_ipaddr_t ipaddr;  int i;  struct timer periodic_timer, arp_timer;	if(connect_pci() < 0) return 1;	printf("Starting up stack!/n");	uip_init();  uip_ipaddr(ipaddr, 192,168,1,8);  uip_sethostaddr(ipaddr);  uip_ipaddr(ipaddr, 192,168,1,1);  uip_setdraddr(ipaddr);  uip_ipaddr(ipaddr, 255,255,255,0);  uip_setnetmask(ipaddr);	uip_setethaddr(rtl8139_mac);	resolv_init();	dhcpc_init(rtl8139_mac, 6);//	httpd_init();	resolv_query("grindars.org.ru");  printf("Stack started/n");  while(1) {    uip_len = rtl8139_poll();    if(uip_len > 0) {      if(BUF->type == htons(UIP_ETHTYPE_IP)) {	uip_arp_ipin();	uip_input();	/* If the above function invocation resulted in data that	   should be sent out on the network, the global variable	   uip_len is set to a value > 0. */	if(uip_len > 0) {	  uip_arp_out();	  rtl8139_transmit();	}      } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {	uip_arp_arpin();	/* If the above function invocation resulted in data that	   should be sent out on the network, the global variable	   uip_len is set to a value > 0. */	if(uip_len > 0) {	  rtl8139_transmit();	}      }    } else if(timer_expired(&periodic_timer)) {      timer_reset(&periodic_timer);      for(i = 0; i < UIP_CONNS; i++) {	uip_periodic(i);	/* If the above function invocation resulted in data that	   should be sent out on the network, the global variable	   uip_len is set to a value > 0. */	if(uip_len > 0) {	  uip_arp_out();	  rtl8139_transmit();	}      }//#if UIP_UDP      for(i = 0; i < UIP_UDP_CONNS; i++) {	uip_udp_periodic(i);	/* If the above function invocation resulted in data that	   should be sent out on the network, the global variable	   uip_len is set to a value > 0. */	if(uip_len > 0) {	  uip_arp_out();	  rtl8139_transmit();	}      }//#endif /* UIP_UDP */            /* Call the ARP timer function every 10 seconds. */      if(timer_expired(&arp_timer)) {	timer_reset(&arp_timer);	uip_arp_timer();      }    }  }	return 0;}
开发者ID:orlv,项目名称:fos,代码行数:79,


示例29: main

int main(void) {    struct timer periodic_timer, arp_timer;              // Flash the status LED two times to indicate that the AVR controller is living    STATUS_LED_on();    _delay_ms(20);    STATUS_LED_off();    _delay_ms(100);    STATUS_LED_on();    _delay_ms(20);    STATUS_LED_off();    // Initialize direction and level of I/O pins    init_io_pins();     #if ADC_CHANNELS > 0        // initialize ADC converter        initADC();    #endif        // enable io functions    isBusy=0;      // Initialize system clock timers.    clock_init();    timer_set(&periodic_timer, CLOCK_SECOND);     timer_set(&arp_timer, CLOCK_SECOND*10);    // check if the config reset jumper is connected.    check_for_reset_jumper();        #ifdef SERIAL    // start the serial port server    seriald_init();#endif // SERIAL        // initialize ethernet controller    // loop until link comes up    while (init_CP2200()==0) {       _delay_ms(200);    }        // replace config by hardcoded defaults if the flash is unprogrammed (all bits 1)    if (uip_ipaddr_cmp(config.ipaddr, all_ones_addr) &&        uip_ipaddr_cmp(config.netmask, all_ones_addr) &&        uip_ipaddr_cmp(config.gateway, all_ones_addr)) {        set_defaults();    }    // initialize uIP protocol    uip_arp_init();    uip_init();        // Configure the IP-Adrdess    IP_config();     #ifdef EMAIL_APP    // Initialize the email application    email_app_init();#endif // EMAIL_APP    // Initialize the inetd    inetd_init();    // main loop, dispatches network and timer events    while (1) {        uip_len = network_device_read();        if (uip_len > 0) {            if (BUF->type == htons(UIP_ETHTYPE_IP)) {                uip_arp_ipin();                uip_input();                // If the above function invocation resulted in data that                // should be sent out on the network, the global variable                // uip_len is set to a value > 0.                 if (uip_len > 0) {                    uip_arp_out();                    network_device_send();                }            } else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {                uip_arp_arpin();                // If the above function invocation resulted in data that                // should be sent out on the network, the global variable                // uip_len is set to a value > 0.                 if (uip_len > 0) {                    network_device_send();                }            }        }        else if (timer_expired(&periodic_timer)) {            timer_reset(&periodic_timer);            for (int i = 0; i < UIP_CONNS; i++) {                uip_periodic(i);                // If the above function invocation resulted in data that                // should be sent out on the network, the global variable                // uip_len is set to a value > 0.                 if (uip_len > 0) {                    uip_arp_out();                    network_device_send();                }//.........这里部分代码省略.........
开发者ID:housecream,项目名称:restmcu,代码行数:101,



注:本文中的uip_arp_arpin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ uip_arp_ipin函数代码示例
C++ uip_acked函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。