Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
igmp.h
00001 /* 00002 * Copyright (c) 2002 CITEL Technologies Ltd. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors 00014 * may be used to endorse or promote products derived from this software 00015 * without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS'' 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE 00021 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00023 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00024 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00025 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00026 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00027 * SUCH DAMAGE. 00028 * 00029 * This file is a contribution to the lwIP TCP/IP stack. 00030 * The Swedish Institute of Computer Science and Adam Dunkels 00031 * are specifically granted permission to redistribute this 00032 * source code. 00033 */ 00034 00035 #ifndef __LWIP_IGMP_H__ 00036 #define __LWIP_IGMP_H__ 00037 00038 #include "lwip/opt.h" 00039 #include "lwip/ip_addr.h" 00040 #include "lwip/netif.h" 00041 #include "lwip/pbuf.h" 00042 00043 #if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */ 00044 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00049 /* 00050 * IGMP constants 00051 */ 00052 #define IP_PROTO_IGMP 2 00053 #define IGMP_TTL 1 00054 #define IGMP_MINLEN 8 00055 #define ROUTER_ALERT 0x9404 00056 #define ROUTER_ALERTLEN 4 00057 00058 /* 00059 * IGMP message types, including version number. 00060 */ 00061 #define IGMP_MEMB_QUERY 0x11 /* Membership query */ 00062 #define IGMP_V1_MEMB_REPORT 0x12 /* Ver. 1 membership report */ 00063 #define IGMP_V2_MEMB_REPORT 0x16 /* Ver. 2 membership report */ 00064 #define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */ 00065 00066 /* IGMP timer */ 00067 #define IGMP_TMR_INTERVAL 100 /* Milliseconds */ 00068 #define IGMP_V1_DELAYING_MEMBER_TMR (1000/IGMP_TMR_INTERVAL) 00069 #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL) 00070 00071 /* MAC Filter Actions */ 00072 #define IGMP_DEL_MAC_FILTER 0 00073 #define IGMP_ADD_MAC_FILTER 1 00074 00075 /* Group membership states */ 00076 #define IGMP_GROUP_NON_MEMBER 0 00077 #define IGMP_GROUP_DELAYING_MEMBER 1 00078 #define IGMP_GROUP_IDLE_MEMBER 2 00079 00080 /* 00081 * IGMP packet format. 00082 */ 00083 #ifdef PACK_STRUCT_USE_INCLUDES 00084 # include "arch/bpstruct.h" 00085 #endif 00086 PACK_STRUCT_BEGIN 00087 struct igmp_msg { 00088 PACK_STRUCT_FIELD(u8_t igmp_msgtype); 00089 PACK_STRUCT_FIELD(u8_t igmp_maxresp); 00090 PACK_STRUCT_FIELD(u16_t igmp_checksum); 00091 PACK_STRUCT_FIELD(struct ip_addr igmp_group_address); 00092 } PACK_STRUCT_STRUCT; 00093 PACK_STRUCT_END 00094 #ifdef PACK_STRUCT_USE_INCLUDES 00095 # include "arch/epstruct.h" 00096 #endif 00097 00098 /* 00099 * now a group structure - there is 00100 * a list of groups for each interface 00101 * these should really be linked from the interface, but 00102 * if we keep them separate we will not affect the lwip original code 00103 * too much 00104 * 00105 * There will be a group for the all systems group address but this 00106 * will not run the state machine as it is used to kick off reports 00107 * from all the other groups 00108 */ 00109 00110 struct igmp_group { 00111 struct igmp_group *next; 00112 struct netif *interface; 00113 struct ip_addr group_address; 00114 u8_t last_reporter_flag; /* signifies we were the last person to report */ 00115 u8_t group_state; 00116 u16_t timer; 00117 u8_t use; /* counter of simultaneous uses */ 00118 }; 00119 00120 00121 /* Prototypes */ 00122 void igmp_init(void); 00123 00124 err_t igmp_start( struct netif *netif); 00125 00126 err_t igmp_stop( struct netif *netif); 00127 00128 void igmp_report_groups( struct netif *netif); 00129 00130 struct igmp_group *igmp_lookfor_group( struct netif *ifp, struct ip_addr *addr); 00131 00132 struct igmp_group *igmp_lookup_group( struct netif *ifp, struct ip_addr *addr); 00133 00134 err_t igmp_remove_group( struct igmp_group *group); 00135 00136 void igmp_input( struct pbuf *p, struct netif *inp, struct ip_addr *dest); 00137 00138 err_t igmp_joingroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr); 00139 00140 err_t igmp_leavegroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr); 00141 00142 void igmp_tmr(void); 00143 00144 void igmp_timeout( struct igmp_group *group); 00145 00146 void igmp_start_timer( struct igmp_group *group, u8_t max_time); 00147 00148 void igmp_stop_timer( struct igmp_group *group); 00149 00150 void igmp_delaying_member( struct igmp_group *group, u8_t maxresp); 00151 00152 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); 00153 00154 void igmp_send( struct igmp_group *group, u8_t type); 00155 00156 #ifdef __cplusplus 00157 } 00158 #endif 00159 00160 #endif /* LWIP_IGMP */ 00161 00162 #endif /* __LWIP_IGMP_H__ */
Generated on Tue Jul 12 2022 20:39:37 by
1.7.2