source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/ipv4/lwip/igmp.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

File size: 5.4 KB
Line 
1/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
2
3/*
4 * Copyright (c) 2002 CITEL Technologies Ltd.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
16 *    may be used to endorse or promote products derived from this software
17 *    without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED.  IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * This file is a contribution to the lwIP TCP/IP stack.
32 * The Swedish Institute of Computer Science and Adam Dunkels
33 * are specifically granted permission to redistribute this
34 * source code.
35*/
36
37#ifndef __LWIP_IGMP_H__
38#define __LWIP_IGMP_H__
39
40#include "lwip/opt.h"
41#include "lwip/ip_addr.h"
42#include "lwip/netif.h"
43#include "lwip/pbuf.h"
44
45#if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/*
52 * IGMP constants
53 */
54#define IP_PROTO_IGMP                  2
55#define IGMP_TTL                       1
56#define IGMP_MINLEN                    8
57#define ROUTER_ALERT                   0x9404
58#define ROUTER_ALERTLEN                4
59
60/*
61 * IGMP message types, including version number.
62 */
63#define IGMP_MEMB_QUERY                0x11 /* Membership query         */
64#define IGMP_V1_MEMB_REPORT            0x12 /* Ver. 1 membership report */
65#define IGMP_V2_MEMB_REPORT            0x16 /* Ver. 2 membership report */
66#define IGMP_LEAVE_GROUP               0x17 /* Leave-group message      */
67
68/* IGMP timer */
69#define IGMP_TMR_INTERVAL              100 /* Milliseconds */
70#define IGMP_V1_DELAYING_MEMBER_TMR   (1000/IGMP_TMR_INTERVAL)
71#define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
72
73/* MAC Filter Actions */
74#define IGMP_DEL_MAC_FILTER            0
75#define IGMP_ADD_MAC_FILTER            1
76
77/* Group  membership states */
78#define IGMP_GROUP_NON_MEMBER          0
79#define IGMP_GROUP_DELAYING_MEMBER     1
80#define IGMP_GROUP_IDLE_MEMBER         2
81
82/*
83 * IGMP packet format.
84 */
85#ifdef PACK_STRUCT_USE_INCLUDES
86#  include "arch/bpstruct.h"
87#endif
88PACK_STRUCT_BEGIN
89struct igmp_msg {
90 PACK_STRUCT_FIELD(u8_t           igmp_msgtype);
91 PACK_STRUCT_FIELD(u8_t           igmp_maxresp);
92 PACK_STRUCT_FIELD(u16_t          igmp_checksum);
93 PACK_STRUCT_FIELD(struct ip_addr igmp_group_address);
94} PACK_STRUCT_STRUCT;
95PACK_STRUCT_END
96#ifdef PACK_STRUCT_USE_INCLUDES
97#  include "arch/epstruct.h"
98#endif
99
100/*
101 * now a group structure - there is
102 * a list of groups for each interface
103 * these should really be linked from the interface, but
104 * if we keep them separate we will not affect the lwip original code
105 * too much
106 *
107 * There will be a group for the all systems group address but this
108 * will not run the state machine as it is used to kick off reports
109 * from all the other groups
110 */
111
112struct igmp_group {
113  struct igmp_group *next;
114  struct netif      *interface;
115  struct ip_addr     group_address;
116  u8_t               last_reporter_flag; /* signifies we were the last person to report */
117  u8_t               group_state;
118  u16_t              timer;
119  u8_t               use; /* counter of simultaneous uses */
120};
121
122
123/*  Prototypes */
124void   igmp_init(void);
125
126err_t  igmp_start( struct netif *netif);
127
128err_t  igmp_stop( struct netif *netif);
129
130void   igmp_report_groups( struct netif *netif);
131
132struct igmp_group *igmp_lookfor_group( struct netif *ifp, struct ip_addr *addr);
133
134struct igmp_group *igmp_lookup_group( struct netif *ifp, struct ip_addr *addr);
135
136err_t  igmp_remove_group( struct igmp_group *group);
137
138void   igmp_input( struct pbuf *p, struct netif *inp, struct ip_addr *dest);
139
140err_t  igmp_joingroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr);
141
142err_t  igmp_leavegroup( struct ip_addr *ifaddr, struct ip_addr *groupaddr);
143
144void   igmp_tmr(void);
145
146void   igmp_timeout( struct igmp_group *group);
147
148void   igmp_start_timer( struct igmp_group *group, u8_t max_time);
149
150void   igmp_stop_timer( struct igmp_group *group);
151
152void   igmp_delaying_member( struct igmp_group *group, u8_t maxresp);
153
154err_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);
155
156void   igmp_send( struct igmp_group *group, u8_t type);
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* LWIP_IGMP */
163
164#endif /* __LWIP_IGMP_H__ */
Note: See TracBrowser for help on using the repository browser.