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

This commit is contained in:
goldsimon 2010-01-28 18:27:26 +00:00
parent 95445fc328
commit ea3b8f52d5
2 changed files with 14 additions and 31 deletions

View File

@ -128,7 +128,7 @@ igmp_dump_group_list()
while (group != NULL) { while (group != NULL) {
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_dump_group_list: [%"U32_F"] ", (u32_t)(group->group_state))); LWIP_DEBUGF(IGMP_DEBUG, ("igmp_dump_group_list: [%"U32_F"] ", (u32_t)(group->group_state)));
ip_addr_debug_print(IGMP_DEBUG, &group->group_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));
group = group->next; group = group->next;
} }
LWIP_DEBUGF(IGMP_DEBUG, ("\n")); LWIP_DEBUGF(IGMP_DEBUG, ("\n"));
@ -185,7 +185,7 @@ igmp_stop(struct netif *netif)
while (group != NULL) { while (group != NULL) {
next = group->next; next = group->next;
/* is it a group joined on this interface? */ /* is it a group joined on this interface? */
if (group->interface == netif) { if (group->netif == netif) {
/* is it the first group of the list? */ /* is it the first group of the list? */
if (group == igmp_group_list) { if (group == igmp_group_list) {
igmp_group_list = next; 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)); LWIP_DEBUGF(IGMP_DEBUG, ("igmp_report_groups: sending IGMP reports on if %p\n", netif));
while (group != NULL) { while (group != NULL) {
if (group->interface == netif) { if (group->netif == netif) {
igmp_delaying_member( group, IGMP_JOIN_DELAYING_MEMBER_TMR); igmp_delaying_member( group, IGMP_JOIN_DELAYING_MEMBER_TMR);
} }
group = group->next; group = group->next;
@ -247,7 +247,7 @@ igmp_lookfor_group(struct netif *ifp, struct ip_addr *addr)
struct igmp_group *group = igmp_group_list; struct igmp_group *group = igmp_group_list;
while (group != NULL) { 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; return group;
} }
group = group->next; 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 doesn't exist yet, create a new one */
group = memp_malloc(MEMP_IGMP_GROUP); group = memp_malloc(MEMP_IGMP_GROUP);
if (group != NULL) { if (group != NULL) {
group->interface = ifp; group->netif = ifp;
ip_addr_set(&(group->group_address), addr); ip_addr_set(&(group->group_address), addr);
group->timer = 0; /* Not running */ group->timer = 0; /* Not running */
group->group_state = IGMP_GROUP_NON_MEMBER; 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; groupref = igmp_group_list;
while (groupref) { while (groupref) {
/* Do not send messages on the all systems group address! */ /* 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); igmp_delaying_member( groupref, igmp->igmp_maxresp);
} }
groupref = groupref->next; groupref = groupref->next;
@ -440,7 +440,7 @@ igmp_input(struct pbuf *p, struct netif *inp, struct ip_addr *dest)
} }
default: { default: {
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n", 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; break;
} }
} }
@ -625,7 +625,7 @@ igmp_timeout(struct igmp_group *group)
if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) { if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) {
LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address ")); LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address "));
ip_addr_debug_print(IGMP_DEBUG, &(group->group_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); igmp_send(group, IGMP_V2_MEMB_REPORT);
} }
@ -722,7 +722,7 @@ igmp_send(struct igmp_group *group, u8_t type)
igmp = p->payload; igmp = p->payload;
LWIP_ASSERT("igmp_send: check that first pbuf can hold struct igmp_msg", LWIP_ASSERT("igmp_send: check that first pbuf can hold struct igmp_msg",
(p->len >= sizeof(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) { if (type == IGMP_V2_MEMB_REPORT) {
dest = &(group->group_address); dest = &(group->group_address);
@ -742,7 +742,7 @@ igmp_send(struct igmp_group *group, u8_t type)
igmp->igmp_checksum = 0; igmp->igmp_checksum = 0;
igmp->igmp_checksum = inet_chksum( igmp, IGMP_MINLEN); 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); pbuf_free(p);

View File

@ -77,7 +77,7 @@ extern "C" {
#define IGMP_GROUP_DELAYING_MEMBER 1 #define IGMP_GROUP_DELAYING_MEMBER 1
#define IGMP_GROUP_IDLE_MEMBER 2 #define IGMP_GROUP_IDLE_MEMBER 2
/* /**
* IGMP packet format. * IGMP packet format.
*/ */
#ifdef PACK_STRUCT_USE_INCLUDES #ifdef PACK_STRUCT_USE_INCLUDES
@ -95,8 +95,8 @@ PACK_STRUCT_END
# include "arch/epstruct.h" # include "arch/epstruct.h"
#endif #endif
/* /**
* now a group structure - there is * igmp group structure - there is
* a list of groups for each interface * a list of groups for each interface
* these should really be linked from the interface, but * these should really be linked from the interface, but
* if we keep them separate we will not affect the lwip original code * 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 * will not run the state machine as it is used to kick off reports
* from all the other groups * from all the other groups
*/ */
struct igmp_group { struct igmp_group {
struct igmp_group *next; struct igmp_group *next;
struct netif *interface; struct netif *netif;
struct ip_addr group_address; struct ip_addr group_address;
u8_t last_reporter_flag; /* signifies we were the last person to report */ u8_t last_reporter_flag; /* signifies we were the last person to report */
u8_t group_state; u8_t group_state;
@ -120,37 +119,21 @@ struct igmp_group {
/* Prototypes */ /* Prototypes */
void igmp_init(void); void igmp_init(void);
err_t igmp_start( struct netif *netif); err_t igmp_start( struct netif *netif);
err_t igmp_stop( struct netif *netif); err_t igmp_stop( struct netif *netif);
void igmp_report_groups( 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_lookfor_group( struct netif *ifp, struct ip_addr *addr);
struct igmp_group *igmp_lookup_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); err_t igmp_remove_group( struct igmp_group *group);
void igmp_input( struct pbuf *p, struct netif *inp, struct ip_addr *dest); 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_joingroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr);
err_t igmp_leavegroup( 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_tmr(void);
void igmp_timeout( struct igmp_group *group); void igmp_timeout( struct igmp_group *group);
void igmp_start_timer( struct igmp_group *group, u8_t max_time); void igmp_start_timer( struct igmp_group *group, u8_t max_time);
void igmp_stop_timer( struct igmp_group *group); void igmp_stop_timer( struct igmp_group *group);
void igmp_delaying_member( struct igmp_group *group, u8_t maxresp); 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); 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); void igmp_send( struct igmp_group *group, u8_t type);
#ifdef __cplusplus #ifdef __cplusplus