xorp

mld6_proto.h

00001 /* -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- */
00002 
00003 /*
00004  * Copyright (c) 2001-2009 XORP, Inc.
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License, Version 2, June
00008  * 1991 as published by the Free Software Foundation. Redistribution
00009  * and/or modification of this program under the terms of any other
00010  * version of the GNU General Public License is not permitted.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00015  * see the GNU General Public License, Version 2, a copy of which can be
00016  * found in the XORP LICENSE.gpl file.
00017  * 
00018  * XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00019  * http://xorp.net
00020  */
00021 
00022 /*
00023  * $XORP: xorp/mld6igmp/mld6_proto.h,v 1.23 2008/10/02 21:57:43 bms Exp $
00024  */
00025 
00026 #ifndef __MLD6IGMP_MLD6_PROTO_H__
00027 #define __MLD6IGMP_MLD6_PROTO_H__
00028 
00029 
00030 /*
00031  * Multicast Listener Discovery protocol-specific definitions.
00032  * MLDv1 (RFC 2710), and MLDv2 (RFC 3810).
00033  */
00034 
00035 #ifdef HAVE_NETINET_IN_H
00036 #include <netinet/in.h>
00037 #endif
00038 #ifdef HAVE_NETINET_ICMP6_H
00039 #include <netinet/icmp6.h>
00040 #endif
00041 
00042 
00043 /*
00044  * Constants definitions
00045  */
00046 #ifndef IPPROTO_ICMPV6
00047 #define IPPROTO_ICMPV6              58
00048 #endif
00049 
00050 /* MLD versions definition */
00051 #define MLD_V1                  1
00052 #define MLD_V2                  2
00053 #define MLD_VERSION_MIN             MLD_V1
00054 #define MLD_VERSION_MAX             MLD_V2
00055 #define MLD_VERSION_DEFAULT         MLD_V1
00056 
00057 /*
00058  * Constans for Multicast Listener Discovery protocol for IPv6.
00059  * All intervals are in seconds.
00060  * XXX: Several of these, especially the robustness variable, should be
00061  * variables and not constants.
00062  */
00063 #define MLD_ROBUSTNESS_VARIABLE         2
00064 #define MLD_QUERY_INTERVAL          125
00065 #define MLD_QUERY_RESPONSE_INTERVAL     10
00066 #define MLD_MULTICAST_LISTENER_INTERVAL     (MLD_ROBUSTNESS_VARIABLE      \
00067                         * MLD_QUERY_INTERVAL          \
00068                         + MLD_QUERY_RESPONSE_INTERVAL)
00069 #define MLD_OTHER_QUERIER_PRESENT_INTERVAL  (MLD_ROBUSTNESS_VARIABLE      \
00070                         * MLD_QUERY_INTERVAL          \
00071                     + MLD_QUERY_RESPONSE_INTERVAL / 2)
00072 #define MLD_STARTUP_QUERY_INTERVAL      (MLD_QUERY_INTERVAL / 4)
00073 #define MLD_STARTUP_QUERY_COUNT         MLD_ROBUSTNESS_VARIABLE
00074 #define MLD_LAST_LISTENER_QUERY_INTERVAL    1
00075 #define MLD_LAST_LISTENER_QUERY_COUNT       MLD_ROBUSTNESS_VARIABLE
00076 #define MLD_OLDER_VERSION_HOST_PRESENT_INTERVAL (MLD_ROBUSTNESS_VARIABLE      \
00077                         * MLD_QUERY_INTERVAL          \
00078                         + MLD_QUERY_RESPONSE_INTERVAL)
00079 #ifndef MLD_TIMER_SCALE
00080 /* the MLD max. response delay is in 1000th of seconds */
00081 #define MLD_TIMER_SCALE             1000
00082 #endif
00083 
00084 /*
00085  * MLDv1-related missing definitions
00086  *
00087  * Note that on newer systems all MLD-related definitions use
00088  * mld_xxx and MLD_XXX instead of mld6_xxx and MLD6_XXX.
00089  */
00090 #ifndef MLD_LISTENER_QUERY
00091 #  ifdef MLD6_LISTENER_QUERY
00092 #    define MLD_LISTENER_QUERY      MLD6_LISTENER_QUERY
00093 #  else
00094 #    define MLD_LISTENER_QUERY      130
00095 #  endif
00096 #endif
00097 
00098 #ifndef MLD_LISTENER_REPORT
00099 #  ifdef MLD6_LISTENER_REPORT
00100 #    define MLD_LISTENER_REPORT     MLD6_LISTENER_REPORT
00101 #  else
00102 #    define MLD_LISTENER_REPORT     131
00103 #  endif
00104 #endif
00105 
00106 #ifndef MLD_LISTENER_DONE
00107 #  ifdef MLD6_LISTENER_DONE
00108 #    define MLD_LISTENER_DONE       MLD6_LISTENER_DONE
00109 #  else
00110 #    define MLD_LISTENER_DONE       132
00111 #  endif
00112 #endif
00113 
00114 #ifndef MLD_MTRACE_RESP
00115 #  ifdef MLD6_MTRACE_RESP
00116 #    define MLD_MTRACE_RESP     MLD6_MTRACE_RESP
00117 #  else
00118 #    define MLD_MTRACE_RESP     200
00119 #  endif
00120 #endif
00121 
00122 #ifndef MLD_MTRACE
00123 #  ifdef MLD6_MTRACE
00124 #    define MLD_MTRACE          MLD6_MTRACE
00125 #  else
00126 #    define MLD_MTRACE          201
00127 #  endif
00128 #endif
00129 
00130 #ifndef MLD_MINLEN
00131 #  ifdef HAVE_STRUCT_MLD_HDR
00132 #    define MLD_MINLEN          (sizeof(struct mld_hdr))
00133 #  else
00134 #    define MLD_MINLEN          24
00135 #  endif
00136 #endif
00137 
00138 /*
00139  * MLDv2-related missing definitions
00140  */
00141 #ifndef MLDV2_LISTENER_REPORT
00142 #  ifdef MLD6V2_LISTENER_REPORT
00143 #    define MLDV2_LISTENER_REPORT   MLD6V2_LISTENER_REPORT
00144 #  else
00145 #    define MLDV2_LISTENER_REPORT   143
00146 #  endif
00147 #endif
00148 
00149 #ifndef MLD_MODE_IS_INCLUDE
00150 #  define MLD_MODE_IS_INCLUDE       1
00151 #endif
00152 
00153 #ifndef MLD_MODE_IS_EXCLUDE
00154 #  define MLD_MODE_IS_EXCLUDE       2
00155 #endif
00156 
00157 #ifndef MLD_CHANGE_TO_INCLUDE_MODE
00158 #  define MLD_CHANGE_TO_INCLUDE_MODE    3
00159 #endif
00160 
00161 #ifndef MLD_CHANGE_TO_EXCLUDE_MODE
00162 #  define MLD_CHANGE_TO_EXCLUDE_MODE    4
00163 #endif
00164 
00165 #ifndef MLD_ALLOW_NEW_SOURCES
00166 #  define MLD_ALLOW_NEW_SOURCES     5
00167 #endif
00168 
00169 #ifndef MLD_BLOCK_OLD_SOURCES
00170 #  define MLD_BLOCK_OLD_SOURCES     6
00171 #endif
00172 
00173 #ifndef MLD_V2_QUERY_MINLEN
00174 #  define MLD_V2_QUERY_MINLEN       28
00175 #endif
00176 
00177 #ifndef MLD_HOST_MRC_EXP
00178 #  define MLD_HOST_MRC_EXP(x)       (((x) >> 12) & 0x0007)
00179 #endif
00180 
00181 #ifndef MLD_HOST_MRC_MANT
00182 #  define MLD_HOST_MRC_MANT(x)      ((x) & 0x0fff)
00183 #endif
00184 
00185 #ifndef MLD_QQIC_EXP
00186 #  define MLD_QQIC_EXP(x)       (((x) >> 4) & 0x07)
00187 #endif
00188 
00189 #ifndef MLD_QQIC_MANT
00190 #  define MLD_QQIC_MANT(x)      ((x) & 0x0f)
00191 #endif
00192 
00193 #ifndef MLD_QRESV
00194 #  define MLD_QRESV(x)          (((x) >> 4) & 0x0f)
00195 #endif
00196 
00197 #ifndef MLD_SFLAG
00198 #  define MLD_SFLAG(x)          (((x) >> 3) & 0x01)
00199 #endif
00200 
00201 #ifndef MLD_QRV
00202 #  define MLD_QRV(x)            ((x) & 0x07)
00203 #endif
00204 
00205 /*
00206  * Structures, typedefs and macros
00207  */
00208 /*
00209  * The ASCII names of the MLD protocol control messages
00210  */
00211 #ifdef MLDV2_LISTENER_REPORT
00212 #define MLDV2TYPE2ASCII(t)                      \
00213 (((t) == MLDV2_LISTENER_REPORT) ?                   \
00214     "MLDV2_LISTENER_REPORT"                     \
00215     : "MLD_type_unknown")
00216 #else
00217 #define MLDV2TYPE2ASCII(t)  "MLD_type_unknown"
00218 #endif
00219 
00220 #define MLDTYPE2ASCII(t)                        \
00221 (((t) == MLD_LISTENER_QUERY) ?                      \
00222     "MLD_LISTENER_QUERY"                        \
00223     : ((t) == MLD_LISTENER_REPORT) ?                    \
00224     "MLD_LISTENER_REPORT"                       \
00225     : ((t) == MLD_LISTENER_DONE) ?                  \
00226         "MLD_LISTENER_DONE"                     \
00227         : ((t) == MLD_MTRACE_RESP) ?                \
00228         "MLD_MTRACE_RESP"                   \
00229         : ((t) == MLD_MTRACE) ?                 \
00230             "MLD_MTRACE"                    \
00231             : MLDV2TYPE2ASCII(t))
00232 
00233 /*
00234  * Global variables
00235  */
00236 
00237 /*
00238  * Global functions prototypes
00239  */
00240 __BEGIN_DECLS
00241 
00242 __END_DECLS
00243 
00244 #endif /* __MPD6IGMP_MLD6_PROTO_H__ */
 All Classes Namespaces Functions Variables Typedefs Enumerations