コード例 #1
0
ファイル: tapdev6.c プロジェクト: Asterios/contiki-econotag
u8_t
tapdev_send(void)
{
  struct uip_neighbor_addr *addr;
  /*  uip_arp_out();*/

  addr = uip_neighbor_lookup(&IPBUF->destipaddr);
  if(addr == NULL) {
    printf("tapdev6: tapdev_send: no matching neighbor found\n");
    DEBUG_PRINT6ADDR(&IPBUF->destipaddr);
    printf("\n");
  } else {
    memcpy(&BUF->dest, addr, 6);
    memcpy(&BUF->src, &uip_ethaddr, 6);
    uip_len += sizeof(struct uip_eth_hdr);
    do_send();
  }
  return 0;
}
コード例 #2
0
ファイル: syslog.c プロジェクト: dschanoeh/ethersex
uint8_t
syslog_check_cache(void)
{
  uip_ipaddr_t ipaddr;

#ifdef IPV6_SUPPORT

  if(memcmp(syslog_conn->ripaddr, uip_hostaddr, 8))
    /* Remote address is not on the local network, use router */
    uip_ipaddr_copy(&ipaddr, uip_draddr);
  else
    /* Remote address is on the local network, send directly. */
    uip_ipaddr_copy(&ipaddr, syslog_conn->ripaddr);

  if (uip_ipaddr_cmp(&ipaddr, &all_zeroes_addr))
    return 1;	     /* Cowardly refusing to send IPv6 packet to :: */

  if(uip_neighbor_lookup (ipaddr))
    return 0;

#else  /* IPV4_SUPPORT */

  if(!uip_ipaddr_maskcmp(syslog_conn->ripaddr, uip_hostaddr, uip_netmask))
    /* Remote address is not on the local network, use router */
    uip_ipaddr_copy(&ipaddr, uip_draddr);
  else
    /* Remote address is on the local network, send directly. */
    uip_ipaddr_copy(&ipaddr, syslog_conn->ripaddr);

#ifdef ETHERNET_SUPPORT
  /* uip_arp_lookup returns a pointer if the mac is in the arp cache */
  if(uip_arp_lookup (ipaddr))
#endif
    return 0;

#endif

  return 1;
}