Example #1
0
void uip_igmpdevinit(struct uip_driver_s *dev)
{
  nvdbg("IGMP initializing dev %p\n", dev);
  DEBUGASSERT(dev->grplist.head == NULL);

  /* Add the all systems address to the group */

  (void)uip_grpalloc(dev, &g_allsystems);

  /* Allow the IGMP messages at the MAC level */

  uip_addmcastmac(dev, &g_allrouters);
  uip_addmcastmac(dev, &g_allsystems);
}
Example #2
0
int igmp_joingroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr)
{
  struct igmp_group_s *group;

  DEBUGASSERT(dev && grpaddr);

  /* Check if a this address is already in the group */
 
  group = uip_grpfind(dev, &grpaddr->s_addr);
  if (!group)
    {
       /* No... allocate a new entry */
 
       nvdbg("Join to new group: %08x\n", grpaddr->s_addr);
       group = uip_grpalloc(dev, &grpaddr->s_addr);
       IGMP_STATINCR(uip_stat.igmp.joins);

       /* Send the Membership Report */
 
       IGMP_STATINCR(uip_stat.igmp.report_sched);
       uip_igmpwaitmsg(group, IGMPv2_MEMBERSHIP_REPORT);

       /* And start the timer at 10*100 msec */

       uip_igmpstarttimer(group, 10);

       /* Add the group (MAC) address to the ether drivers MAC filter list */

       uip_addmcastmac(dev, (FAR uip_ipaddr_t *)&grpaddr->s_addr);
       return OK;
    }

  /* Return EEXIST if the address is already a member of the group */

  return -EEXIST;
}