示例#1
0
/* functions for sending */
static void _send_unicast(kernel_pid_t iface, uint8_t *dst_l2addr,
                          uint16_t dst_l2addr_len, gnrc_pktsnip_t *pkt)
{
    gnrc_pktsnip_t *netif;

    if (pkt->type == GNRC_NETTYPE_NETIF) {
        /* great: someone already added a netif_hdr_t we assume it's wrong
         * to keep it simple
         * XXX: alternative would be to check if gnrc_netif_hdr_t::dst_l2addr_len
         * is long enough and only then to throw away the header. This causes
         * to much overhead IMHO */
        DEBUG("ipv6: removed old interface header\n");
        pkt = gnrc_pktbuf_remove_snip(pkt, pkt);
    }

    DEBUG("ipv6: add interface header to packet\n");
    netif = gnrc_netif_hdr_build(NULL, 0, dst_l2addr, dst_l2addr_len);

    if (netif == NULL) {
        DEBUG("ipv6: error on interface header allocation, dropping packet\n");
        gnrc_pktbuf_release(pkt);
        return;
    }

    /* add netif to front of the pkt list */
    LL_PREPEND(pkt, netif);

    DEBUG("ipv6: send unicast over interface %" PRIkernel_pid "\n", iface);
    /* and send to interface */
#ifdef MODULE_NETSTATS_IPV6
    gnrc_ipv6_netif_get_stats(iface)->tx_unicast_count++;
#endif
    _send_to_iface(iface, pkt);
}
示例#2
0
文件: gnrc_ipv6.c 项目: Teresa-P/RIOT
static inline void _send_multicast_over_iface(kernel_pid_t iface, gnrc_pktsnip_t *pkt)
{
    DEBUG("ipv6: send multicast over interface %" PRIkernel_pid "\n", iface);
    /* mark as multicast */
    ((gnrc_netif_hdr_t *)pkt->data)->flags |= GNRC_NETIF_HDR_FLAGS_MULTICAST;
    /* and send to interface */
    _send_to_iface(iface, pkt);
}
示例#3
0
static inline void _send_multicast_over_iface(kernel_pid_t iface, gnrc_pktsnip_t *pkt)
{
    DEBUG("ipv6: send multicast over interface %" PRIkernel_pid "\n", iface);
    /* mark as multicast */
    ((gnrc_netif_hdr_t *)pkt->data)->flags |= GNRC_NETIF_HDR_FLAGS_MULTICAST;
#ifdef MODULE_NETSTATS_IPV6
    gnrc_ipv6_netif_get_stats(iface)->tx_mcast_count++;
#endif
    /* and send to interface */
    _send_to_iface(iface, pkt);
}