igmp.h

Go to the documentation of this file.
00001 #ifndef _NETINET_IGMP_H_
00002 #define _NETINET_IGMP_H_
00003 
00004 /*
00005  * Copyright (C) 2007 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00024  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  *
00035  * -
00036  * Copyright (c) 1988 Stephen Deering.
00037  * Copyright (c) 1992, 1993
00038  *  The Regents of the University of California.  All rights reserved.
00039  *
00040  * Redistribution and use in source and binary forms, with or without
00041  * modification, are permitted provided that the following conditions
00042  * are met:
00043  * 1. Redistributions of source code must retain the above copyright
00044  *    notice, this list of conditions and the following disclaimer.
00045  * 2. Redistributions in binary form must reproduce the above copyright
00046  *    notice, this list of conditions and the following disclaimer in the
00047  *    documentation and/or other materials provided with the distribution.
00048  * 3. Neither the name of the University nor the names of its contributors
00049  *    may be used to endorse or promote products derived from this software
00050  *    without specific prior written permission.
00051  *
00052  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00053  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00054  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00055  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00056  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00057  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00058  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00059  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00060  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00061  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00062  * SUCH DAMAGE.
00063  */
00064 
00065 /*
00066  * $Log: igmp.h,v $
00067  * Revision 1.2  2007/08/29 07:43:54  haraldkipp
00068  * Documentation updated and corrected.
00069  *
00070  * Revision 1.1  2007/05/02 11:18:32  haraldkipp
00071  * IGMP support added. Incomplete.
00072  *
00073  */
00074 
00075 #include <sys/types.h>
00076 #include <dev/netbuf.h>
00077 #include <net/if_var.h>
00078 
00088 
00093 typedef struct __attribute__ ((packed))
00094 igmp IGMP;
00095 
00100 struct __attribute__ ((packed)) igmp
00101 {
00102     u_char igmp_type;           
00103     u_char igmp_code;           
00104     u_short igmp_cksum;         
00105     u_long igmp_group;          
00106 };
00107 
00111 struct __attribute__ ((packed)) igmpv3 {
00112     u_char igmp_type;           
00113     u_char igmp_code;           
00114     u_short igmp_cksum;         
00115     u_long igmp_group;          
00116     u_char igmp_misc;           
00117     u_char igmp_qqi;            
00118     u_short igmp_numsrc;        
00119     u_long igmp_sources[1];     
00120 };
00121 
00125 struct __attribute__ ((packed)) igmp_grouprec {
00126     u_char ig_type;             
00127     u_char ig_datalen;          
00128     u_short ig_numsrc;          
00129     u_long ig_group;            
00130     u_long ig_sources[1];       
00131 };
00132 
00136 struct __attribute__ ((packed)) igmp_report {
00137     u_char ir_type;             
00138     u_char ir_rsv1;             
00139     u_short ir_cksum;           
00140     u_short ir_rsv2;            
00141     u_short ir_numgrps;         
00142     struct igmp_grouprec ir_groups[1];  
00143 };
00144 
00148 #define IGMP_MINLEN          8
00149 
00150 #define IGMP_MEMBERSHIP_QUERY       0x11        
00151 #define IGMP_V1_MEMBERSHIP_REPORT   0x12        
00152 #define IGMP_V2_MEMBERSHIP_REPORT   0x16        
00153 #define IGMP_V3_MEMBERSHIP_REPORT   0x22        
00154 #define IGMP_V2_LEAVE_GROUP         0x17        
00159 #define IGMP_MAX_HOST_REPORT_DELAY  10
00160 
00164 #define IGMP_TIMER_SCALE            10
00165 
00170 #define IGMP_REPORT_MODE_IN 1       
00171 #define IGMP_REPORT_MODE_EX 2       
00172 #define IGMP_REPORT_TO_IN   3       
00173 #define IGMP_REPORT_TO_EX   4       
00174 #define IGMP_REPORT_ALLOW_NEW   5       
00175 #define IGMP_REPORT_BLOCK_OLD   6       
00177 
00178 
00182 #define IGMP_MASK_CUR_STATE 0x01    
00183 #define IGMP_MASK_ALLOW_NEW 0x02    
00184 #define IGMP_MASK_BLOCK_OLD 0x04    
00185 #define IGMP_MASK_TO_IN     0x08    
00186 #define IGMP_MASK_TO_EX     0x10    
00187 #define IGMP_MASK_STATE_T1  0x20    
00188 #define IGMP_MASK_STATE_T2  0x40    
00189 #define IGMP_MASK_IF_STATE  0x80    
00191 #define IGMP_MASK_STATE_TX  (IGMP_MASK_STATE_T1 | IGMP_MASK_STATE_T2)
00192 #define IGMP_MASK_PENDING   (IGMP_MASK_CUR_STATE | IGMP_MASK_ALLOW_NEW | IGMP_MASK_BLOCK_OLD)
00193 
00198 #define IGMP_EXCLUDE_LIST   1       /* Exclude list used to tag report. */
00199 #define IGMP_INCLUDE_LIST   2       /* Include list used to tag report. */
00200 #define IGMP_RECORDED_LIST  3       /* Recorded list used to tag report. */
00201 
00202 
00203 __BEGIN_DECLS
00204 /* Function prototypes */
00205 extern void NutIgmpInput(NUTDEVICE * dev, NETBUF * nb);
00206 extern int NutIgmpOutput(u_char type, u_long dest, NETBUF * nb);
00207 
00208 __END_DECLS
00209 /* End of prototypes */
00211 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/