00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048
00049
00050
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
00060
00061 #define IGMP_MEMB_QUERY 0x11
00062 #define IGMP_V1_MEMB_REPORT 0x12
00063 #define IGMP_V2_MEMB_REPORT 0x16
00064 #define IGMP_LEAVE_GROUP 0x17
00065
00066
00067 #define IGMP_TMR_INTERVAL 100
00068 #define IGMP_V1_DELAYING_MEMBER_TMR (1000/IGMP_TMR_INTERVAL)
00069 #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
00070
00071
00072 #define IGMP_DEL_MAC_FILTER 0
00073 #define IGMP_ADD_MAC_FILTER 1
00074
00075
00076 #define IGMP_GROUP_NON_MEMBER 0
00077 #define IGMP_GROUP_DELAYING_MEMBER 1
00078 #define IGMP_GROUP_IDLE_MEMBER 2
00079
00080
00081
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
00100
00101
00102
00103
00104
00105
00106
00107
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;
00115 u8_t group_state;
00116 u16_t timer;
00117 u8_t use;
00118 };
00119
00120
00121
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
00161
00162 #endif