OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [ethernet/] [lwIP_130/] [src/] [include/] [ipv4/] [lwip/] [igmp.h] - Blame information for rev 606

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.