From ea3b8f52d555fa6297c367d833418f5e9224df81 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 28 Jan 2010 18:27:26 +0000 Subject: [PATCH] renamed netif pointer in struct igmp from 'interface' to 'netif' to not use keywords (or at least my editor highlights it as one...); minor layout change --- src/core/ipv4/igmp.c | 20 ++++++++++---------- src/include/ipv4/lwip/igmp.h | 25 ++++--------------------- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/core/ipv4/igmp.c b/src/core/ipv4/igmp.c index 14b0e2bc..3358a633 100644 --- a/src/core/ipv4/igmp.c +++ b/src/core/ipv4/igmp.c @@ -128,7 +128,7 @@ igmp_dump_group_list() while (group != NULL) { LWIP_DEBUGF(IGMP_DEBUG, ("igmp_dump_group_list: [%"U32_F"] ", (u32_t)(group->group_state))); ip_addr_debug_print(IGMP_DEBUG, &group->group_address); - LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->interface)); + LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->netif)); group = group->next; } LWIP_DEBUGF(IGMP_DEBUG, ("\n")); @@ -185,7 +185,7 @@ igmp_stop(struct netif *netif) while (group != NULL) { next = group->next; /* is it a group joined on this interface? */ - if (group->interface == netif) { + if (group->netif == netif) { /* is it the first group of the list? */ if (group == igmp_group_list) { igmp_group_list = next; @@ -226,7 +226,7 @@ igmp_report_groups( struct netif *netif) LWIP_DEBUGF(IGMP_DEBUG, ("igmp_report_groups: sending IGMP reports on if %p\n", netif)); while (group != NULL) { - if (group->interface == netif) { + if (group->netif == netif) { igmp_delaying_member( group, IGMP_JOIN_DELAYING_MEMBER_TMR); } group = group->next; @@ -247,7 +247,7 @@ igmp_lookfor_group(struct netif *ifp, struct ip_addr *addr) struct igmp_group *group = igmp_group_list; while (group != NULL) { - if ((group->interface == ifp) && (ip_addr_cmp(&(group->group_address), addr))) { + if ((group->netif == ifp) && (ip_addr_cmp(&(group->group_address), addr))) { return group; } group = group->next; @@ -282,7 +282,7 @@ igmp_lookup_group(struct netif *ifp, struct ip_addr *addr) /* Group doesn't exist yet, create a new one */ group = memp_malloc(MEMP_IGMP_GROUP); if (group != NULL) { - group->interface = ifp; + group->netif = ifp; ip_addr_set(&(group->group_address), addr); group->timer = 0; /* Not running */ group->group_state = IGMP_GROUP_NON_MEMBER; @@ -400,7 +400,7 @@ igmp_input(struct pbuf *p, struct netif *inp, struct ip_addr *dest) groupref = igmp_group_list; while (groupref) { /* Do not send messages on the all systems group address! */ - if ((groupref->interface == inp) && (!(ip_addr_cmp(&(groupref->group_address), &allsystems)))) { + if ((groupref->netif == inp) && (!(ip_addr_cmp(&(groupref->group_address), &allsystems)))) { igmp_delaying_member( groupref, igmp->igmp_maxresp); } groupref = groupref->next; @@ -440,7 +440,7 @@ igmp_input(struct pbuf *p, struct netif *inp, struct ip_addr *dest) } default: { LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n", - igmp->igmp_msgtype, group->group_state, &group, group->interface)); + igmp->igmp_msgtype, group->group_state, &group, group->netif)); break; } } @@ -625,7 +625,7 @@ igmp_timeout(struct igmp_group *group) if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) { LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address ")); ip_addr_debug_print(IGMP_DEBUG, &(group->group_address)); - LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->interface)); + LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->netif)); igmp_send(group, IGMP_V2_MEMB_REPORT); } @@ -722,7 +722,7 @@ igmp_send(struct igmp_group *group, u8_t type) igmp = p->payload; LWIP_ASSERT("igmp_send: check that first pbuf can hold struct igmp_msg", (p->len >= sizeof(struct igmp_msg))); - ip_addr_set(&src, &((group->interface)->ip_addr)); + ip_addr_set(&src, &((group->netif)->ip_addr)); if (type == IGMP_V2_MEMB_REPORT) { dest = &(group->group_address); @@ -742,7 +742,7 @@ igmp_send(struct igmp_group *group, u8_t type) igmp->igmp_checksum = 0; igmp->igmp_checksum = inet_chksum( igmp, IGMP_MINLEN); - igmp_ip_output_if(p, &src, dest, IGMP_TTL, IP_PROTO_IGMP, group->interface); + igmp_ip_output_if(p, &src, dest, IGMP_TTL, IP_PROTO_IGMP, group->netif); } pbuf_free(p); diff --git a/src/include/ipv4/lwip/igmp.h b/src/include/ipv4/lwip/igmp.h index 59c933f3..c25ec8f4 100644 --- a/src/include/ipv4/lwip/igmp.h +++ b/src/include/ipv4/lwip/igmp.h @@ -77,7 +77,7 @@ extern "C" { #define IGMP_GROUP_DELAYING_MEMBER 1 #define IGMP_GROUP_IDLE_MEMBER 2 -/* +/** * IGMP packet format. */ #ifdef PACK_STRUCT_USE_INCLUDES @@ -95,8 +95,8 @@ PACK_STRUCT_END # include "arch/epstruct.h" #endif -/* - * now a group structure - there is +/** + * igmp group structure - there is * a list of groups for each interface * these should really be linked from the interface, but * if we keep them separate we will not affect the lwip original code @@ -106,10 +106,9 @@ PACK_STRUCT_END * will not run the state machine as it is used to kick off reports * from all the other groups */ - struct igmp_group { struct igmp_group *next; - struct netif *interface; + struct netif *netif; struct ip_addr group_address; u8_t last_reporter_flag; /* signifies we were the last person to report */ u8_t group_state; @@ -120,37 +119,21 @@ struct igmp_group { /* Prototypes */ void igmp_init(void); - err_t igmp_start( struct netif *netif); - err_t igmp_stop( struct netif *netif); - void igmp_report_groups( struct netif *netif); - struct igmp_group *igmp_lookfor_group( struct netif *ifp, struct ip_addr *addr); - struct igmp_group *igmp_lookup_group( struct netif *ifp, struct ip_addr *addr); - err_t igmp_remove_group( struct igmp_group *group); - void igmp_input( struct pbuf *p, struct netif *inp, struct ip_addr *dest); - err_t igmp_joingroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr); - err_t igmp_leavegroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr); - void igmp_tmr(void); - void igmp_timeout( struct igmp_group *group); - void igmp_start_timer( struct igmp_group *group, u8_t max_time); - void igmp_stop_timer( struct igmp_group *group); - void igmp_delaying_member( struct igmp_group *group, u8_t maxresp); - err_t igmp_ip_output_if( struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t proto, struct netif *netif); - void igmp_send( struct igmp_group *group, u8_t type); #ifdef __cplusplus