Lines Matching refs:group
52 A query for a specific group address (as opposed to ALLHOSTS)
112 #define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */
139 static err_t igmp_remove_group(struct igmp_group *group);
140 static void igmp_timeout( struct igmp_group *group);
141 static void igmp_start_timer(struct igmp_group *group, u8_t max_time);
142 static void igmp_delaying_member(struct igmp_group *group, u8_t maxresp);
144 static void igmp_send(struct igmp_group *group, u8_t type);
171 struct igmp_group *group = igmp_group_list;
173 while (group != NULL) {
174 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_dump_group_list: [%"U32_F"] ", (u32_t)(group->group_state)));
175 ip_addr_debug_print(IGMP_DEBUG, &group->group_address);
176 LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->netif));
177 group = group->next;
193 struct igmp_group* group;
197 group = igmp_lookup_group(netif, &allsystems);
199 if (group != NULL) {
200 group->group_state = IGMP_GROUP_IDLE_MEMBER;
201 group->use++;
225 struct igmp_group *group = igmp_group_list;
230 while (group != NULL) {
231 next = group->next;
232 /* is it a group joined on this interface? */
233 if (group->netif == netif) {
234 /* is it the first group of the list? */
235 if (group == igmp_group_list) {
238 /* is there a "previous" group defined? */
242 /* disable the group at the MAC level */
245 ip_addr_debug_print(IGMP_DEBUG, &group->group_address);
247 netif->igmp_mac_filter(netif, &(group->group_address), IGMP_DEL_MAC_FILTER);
249 /* free group */
250 memp_free(MEMP_IGMP_GROUP, group);
253 prev = group;
256 group = next;
269 struct igmp_group *group = igmp_group_list;
273 while (group != NULL) {
274 if (group->netif == netif) {
275 igmp_delaying_member(group, IGMP_JOIN_DELAYING_MEMBER_TMR);
277 group = group->next;
282 * Search for a group in the global igmp_group_list
285 * @param addr the group ip address to search for
286 * @return a struct igmp_group* if the group has been found,
287 * NULL if the group wasn't found.
292 struct igmp_group *group = igmp_group_list;
294 while (group != NULL) {
295 if ((group->netif == ifp) && (ip_addr_cmp(&(group->group_address), addr))) {
296 return group;
298 group = group->next;
302 * 'group' (which is also NULL at this point).
308 * Search for a specific igmp group and create a new one if not found-
311 * @param addr the group ip address to search
318 struct igmp_group *group = igmp_group_list;
320 /* Search if the group already exists */
321 group = igmp_lookfor_group(ifp, addr);
322 if (group != NULL) {
324 return group;
328 group = (struct igmp_group *)memp_malloc(MEMP_IGMP_GROUP);
329 if (group != NULL) {
330 group->netif = ifp;
331 ip_addr_set(&(group->group_address), addr);
332 group->timer = 0; /* Not running */
333 group->group_state = IGMP_GROUP_NON_MEMBER;
334 group->last_reporter_flag = 0;
335 group->use = 0;
336 group->next = igmp_group_list;
338 igmp_group_list = group;
341 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_lookup_group: %sallocated a new group with address ", (group?"":"impossible to ")));
345 return group;
349 * Remove a group in the global igmp_group_list
351 * @param group the group to remove from the global igmp_group_list
352 * @return ERR_OK if group was removed from the list, an err_t otherwise
355 igmp_remove_group(struct igmp_group *group)
359 /* Is it the first group? */
360 if (igmp_group_list == group) {
361 igmp_group_list = group->next;
363 /* look for group further down the list */
366 if (tmpGroup->next == group) {
367 tmpGroup->next = group->next;
375 /* free group */
376 memp_free(MEMP_IGMP_GROUP, group);
393 struct igmp_group* group;
422 /* Packet is ok so find an existing group */
423 group = igmp_lookfor_group(inp, dest); /* use the destination IP address of incoming packet */
425 /* If group can be found or create... */
426 if (!group) {
451 /* Do not send messages on the all systems group address! */
458 /* IGMP_MEMB_QUERY to a specific group ? */
460 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_MEMB_QUERY to a specific group "));
465 /* we first need to re-look for the group since we used dest last time */
467 group = igmp_lookfor_group(inp, &groupaddr);
469 LWIP_DEBUGF(IGMP_DEBUG, (" with the group address as destination [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp)));
472 if (group != NULL) {
474 igmp_delaying_member(group, igmp->igmp_maxresp);
487 if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) {
488 /* This is on a specific group we have already looked up */
489 group->timer = 0; /* stopped */
490 group->group_state = IGMP_GROUP_IDLE_MEMBER;
491 group->last_reporter_flag = 0;
496 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n",
497 igmp->igmp_msgtype, group->group_state, &group, group->netif));
508 * Join a group on one network interface.
510 * @param ifaddr ip address of the network interface which should join a new group
511 * @param groupaddr the ip address of the group which to join
512 * @return ERR_OK if group was joined on the netif(s), an err_t otherwise
518 struct igmp_group *group;
530 /* find group or create a new one if not found */
531 group = igmp_lookup_group(netif, groupaddr);
533 if (group != NULL) {
534 /* This should create a new group, check the state to make sure */
535 if (group->group_state != IGMP_GROUP_NON_MEMBER) {
536 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: join to group not in state IGMP_GROUP_NON_MEMBER\n"));
538 /* OK - it was new group */
539 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: join to new group: "));
543 /* If first use of the group, allow the group at the MAC level */
544 if ((group->use==0) && (netif->igmp_mac_filter != NULL)) {
552 igmp_send(group, IGMP_V2_MEMB_REPORT);
554 igmp_start_timer(group, IGMP_JOIN_DELAYING_MEMBER_TMR);
557 group->group_state = IGMP_GROUP_DELAYING_MEMBER;
559 /* Increment group use */
560 group->use++;
566 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: Not enought memory to join to group\n"));
578 * Leave a group on one network interface.
580 * @param ifaddr ip address of the network interface which should leave a group
581 * @param groupaddr the ip address of the group which to leave
582 * @return ERR_OK if group was left on the netif(s), an err_t otherwise
588 struct igmp_group *group;
600 /* find group */
601 group = igmp_lookfor_group(netif, groupaddr);
603 if (group != NULL) {
605 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: Leaving group: "));
609 /* If there is no other use of the group */
610 if (group->use <= 1) {
611 /* If we are the last reporter for this group */
612 if (group->last_reporter_flag) {
613 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: sending leaving group\n"));
615 igmp_send(group, IGMP_LEAVE_GROUP);
618 /* Disable the group at the MAC level */
626 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: remove group: "));
630 /* Free the group */
631 igmp_remove_group(group);
633 /* Decrement group use */
634 group->use--;
640 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: not member of group\n"));
657 struct igmp_group *group = igmp_group_list;
659 while (group != NULL) {
660 if (group->timer > 0) {
661 group->timer--;
662 if (group->timer == 0) {
663 igmp_timeout(group);
666 group = group->next;
671 * Called if a timeout for one group is reached.
672 * Sends a report for this group.
674 * @param group an igmp_group for which a timeout is reached
677 igmp_timeout(struct igmp_group *group)
679 /* If the state is IGMP_GROUP_DELAYING_MEMBER then we send a report for this group */
680 if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) {
681 LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address "));
682 ip_addr_debug_print(IGMP_DEBUG, &(group->group_address));
683 LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->netif));
686 igmp_send(group, IGMP_V2_MEMB_REPORT);
691 * Start a timer for an igmp group
693 * @param group the igmp_group for which to start a timer
698 igmp_start_timer(struct igmp_group *group, u8_t max_time)
705 group->timer = (LWIP_RAND() % (max_time - 1)) + 1;
709 * Delaying membership report for a group if necessary
711 * @param group the igmp_group for which "delaying" membership report
715 igmp_delaying_member(struct igmp_group *group, u8_t maxresp)
717 if ((group->group_state == IGMP_GROUP_IDLE_MEMBER) ||
718 ((group->group_state == IGMP_GROUP_DELAYING_MEMBER) &&
719 ((group->timer == 0) || (maxresp < group->timer)))) {
720 igmp_start_timer(group, maxresp);
721 group->group_state = IGMP_GROUP_DELAYING_MEMBER;
756 * Send an igmp packet to a specific group.
758 * @param group the group to which to send the packet
762 igmp_send(struct igmp_group *group, u8_t type)
776 ip_addr_copy(src, group->netif->ip_addr);
779 dest = &(group->group_address);
780 ip_addr_copy(igmp->igmp_group_address, group->group_address);
781 group->last_reporter_flag = 1; /* Remember we were the last to report */
785 ip_addr_copy(igmp->igmp_group_address, group->group_address);
795 igmp_ip_output_if(p, &src, dest, group->netif);