xorp

mfea_osdep.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2011 XORP, Inc and Others-2009 XORP, Inc.
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License, Version 2, June
00007 // 1991 as published by the Free Software Foundation. Redistribution
00008 // and/or modification of this program under the terms of any other
00009 // version of the GNU General Public License is not permitted.
00010 // 
00011 // This program is distributed in the hope that it will be useful, but
00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00014 // see the GNU General Public License, Version 2, a copy of which can be
00015 // found in the XORP LICENSE.gpl file.
00016 // 
00017 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00018 // http://xorp.net
00019 
00020 
00021 #ifndef __FEA_MFEA_OSDEP_HH__
00022 #define __FEA_MFEA_OSDEP_HH__
00023 
00024 
00025 //
00026 // A header file that adds various definitions that may be missing from the OS
00027 //
00028 
00029 
00030 #include "libxorp/xorp.h"
00031 
00032 #ifdef HAVE_SYS_TIME_H
00033 #include <sys/time.h>
00034 #endif
00035 #ifdef HAVE_NETINET_IP6_H
00036 #include <netinet/ip6.h>
00037 #endif
00038 #ifdef HAVE_NETINET_ICMP6_H
00039 #include <netinet/icmp6.h>
00040 #endif
00041 
00042 #include "mrt/include/ip_mroute.h"
00043 
00044 #include "mfea_kernel_messages.hh"
00045 
00046 //
00047 // XXX: misc. (eventually) missing definitions
00048 // TODO: those should go somewhere else
00049 //
00050 #ifndef INADDR_ALLRTRS_GROUP
00051 #define INADDR_ALLRTRS_GROUP    (uint32_t)0xe0000002U   // 224.0.0.2
00052 #endif
00053 #ifndef VIFF_REGISTER
00054 #define VIFF_REGISTER       0x4 // Vif for PIM Register encap/decap
00055 #endif
00056 #ifndef IGMPMSG_WHOLEPKT
00057 #define IGMPMSG_WHOLEPKT    3   // Whole packet sent from the kernel to
00058                     // the user-level process (typically
00059                     // a multicast data packet for PIM
00060                     // register encapsulation).
00061 #endif
00062 #ifndef IPPROTO_PIM
00063 #define IPPROTO_PIM     103 // Protocol Independent Multicast
00064 #endif
00065 
00066 //
00067 // XXX: in *BSD there is only MRT_ASSERT, but in Linux there are both
00068 // MRT_ASSERT and MRT_PIM (with MRT_PIM defined as a superset of MRT_ASSERT).
00069 //
00070 #ifndef MRT_PIM
00071 #define MRT_PIM         MRT_ASSERT
00072 #endif
00073 
00074 #ifndef IP6OPT_RTALERT
00075 #define IP6OPT_RTALERT      0x05
00076 #endif
00077 #ifndef IP6OPT_RTALERT_LEN
00078 #define IP6OPT_RTALERT_LEN  4
00079 #endif
00080 #ifndef IP6OPT_RTALERT_MLD
00081 #define IP6OPT_RTALERT_MLD  0
00082 #endif
00083 
00084 //
00085 // MLD-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 #ifdef HAVE_IPV6_MULTICAST_ROUTING
00091 
00092 #ifndef MLD_LISTENER_QUERY
00093 #  ifdef MLD6_LISTENER_QUERY
00094 #    define MLD_LISTENER_QUERY      MLD6_LISTENER_QUERY
00095 #  else
00096 #    define MLD_LISTENER_QUERY      130
00097 #  endif
00098 #endif
00099 
00100 #ifndef MLD_LISTENER_REPORT
00101 #  ifdef MLD6_LISTENER_REPORT
00102 #    define MLD_LISTENER_REPORT     MLD6_LISTENER_REPORT
00103 #  else
00104 #    define MLD_LISTENER_REPORT     131
00105 #  endif
00106 #endif
00107 
00108 #ifndef MLD_LISTENER_DONE
00109 #  ifdef MLD6_LISTENER_DONE
00110 #    define MLD_LISTENER_DONE       MLD6_LISTENER_DONE
00111 #  else
00112 #    define MLD_LISTENER_DONE       132
00113 #  endif
00114 #endif
00115 
00116 #ifndef MLD_MTRACE_RESP
00117 #  ifdef MLD6_MTRACE_RESP
00118 #    define MLD_MTRACE_RESP     MLD6_MTRACE_RESP
00119 #  else
00120 #    define MLD_MTRACE_RESP     200
00121 #  endif
00122 #endif
00123 
00124 #ifndef MLD_MTRACE
00125 #  ifdef MLD6_MTRACE
00126 #    define MLD_MTRACE          MLD6_MTRACE
00127 #  else
00128 #    define MLD_MTRACE          201
00129 #  endif
00130 #endif
00131 
00132 #ifndef MLDV2_LISTENER_REPORT
00133 #  ifdef MLD6V2_LISTENER_REPORT
00134 #    define MLDV2_LISTENER_REPORT   MLD6V2_LISTENER_REPORT
00135 #  else
00136 #    define MLDV2_LISTENER_REPORT   143
00137 #  endif
00138 #endif
00139 
00140 #ifndef MLD_MINLEN
00141 #  ifdef HAVE_STRUCT_MLD_HDR
00142 #    define MLD_MINLEN          (sizeof(struct mld_hdr))
00143 #  else
00144 #    define MLD_MINLEN          24
00145 #  endif
00146 #endif
00147 
00148 #endif // HAVE_IPV6_MULTICAST_ROUTING
00149 
00150 
00151 //
00152 // Test if the kernel multicast signal message types are consistent
00153 // between IPv4 and IPv6.
00154 // E.g., if (IGMPMSG_NOCACHE == MRT6MSG_NOCACHE)
00155 //          (IGMPMSG_WRONGVIF == MRT6MSG_WRONGMIF)
00156 //          (IGMPMSG_WHOLEPKT == MRT6MSG_WHOLEPKT)
00157 //          (IGMPMSG_BW_UPCALL == MRT6MSG_BW_UPCALL)
00158 // Also, check if MFEA_KERNEL_MESSAGE_NOCACHE/WRONGVIF/WHOLEPKT/BW_UPCALL
00159 // were defined accurately.
00160 // TODO: Yes, I know this is a very, very bad style, but I wanted to have
00161 // abstract kernel signal types, and I didn't want the upper layer
00162 // protocols to use IGMPMSG/MRT6MSG, and to have special cases
00163 // for IPv4 and IPv6. Maybe later this will change...
00164 //
00165 
00166 #ifdef HAVE_IPV6_MULTICAST_ROUTING
00167 
00168 #if IGMPMSG_NOCACHE != MRT6MSG_NOCACHE
00169 #  error "MFEA message handling needs fix, because IGMPMSG_NOCACHE != MRT6MSG_NOCACHE"
00170 #endif
00171 
00172 #if IGMPMSG_WRONGVIF != MRT6MSG_WRONGMIF
00173 #  error "MFEA message handling needs fix, because IGMPMSG_WRONGVIF != MRT6MSG_WRONGMIF"
00174 #endif
00175 
00176 #if IGMPMSG_WHOLEPKT != MRT6MSG_WHOLEPKT
00177 #  error "MFEA message handling needs fix, because IGMPMSG_WHOLEPKT != MRT6MSG_WHOLEPKT"
00178 #endif
00179 
00180 #if defined(IGMPMSG_BW_UPCALL) && defined(MRT6MSG_BW_UPCALL)
00181 #if IGMPMSG_BW_UPCALL != MRT6MSG_BW_UPCALL
00182 #  error "MFEA message handling needs fix, because IGMPMSG_BW_UPCALL != MRT6MSG_BW_UPCALL"
00183 #endif
00184 #endif
00185 
00186 #endif // HAVE_IPV6_MULTICAST_ROUTING
00187 
00188 #ifdef HAVE_IPV4_MULTICAST_ROUTING
00189 
00190 #if IGMPMSG_NOCACHE != MFEA_KERNEL_MESSAGE_NOCACHE
00191 #  error "MFEA message handling needs fix, because IGMPMSG_NOCACHE != MFEA_KERNEL_MESSAGE_NOCACHE"
00192 #endif
00193 
00194 #if IGMPMSG_WRONGVIF != MFEA_KERNEL_MESSAGE_WRONGVIF
00195 #  error "MFEA message handling needs fix, because IGMPMSG_WRONGVIF != MFEA_KERNEL_MESSAGE_WRONGVIF"
00196 #endif
00197 
00198 #if IGMPMSG_WHOLEPKT != MFEA_KERNEL_MESSAGE_WHOLEPKT
00199 #  error "MFEA message handling needs fix, because IGMPMSG_WHOLEPKT != MFEA_KERNEL_MESSAGE_WHOLEPKT"
00200 #endif
00201 
00202 #if defined(IGMPMSG_BW_UPCALL)
00203 #if IGMPMSG_BW_UPCALL != MFEA_KERNEL_MESSAGE_BW_UPCALL
00204 #  error "MFEA message handling needs fix, because IGMPMSG_BW_UPCALL != MFEA_KERNEL_MESSAGE_BW_UPCALL"
00205 #endif
00206 #endif
00207 
00208 #if defined(MRT6MSG_BW_UPCALL)
00209 #if MRT6MSG_BW_UPCALL != MFEA_KERNEL_MESSAGE_BW_UPCALL
00210 #  error "MFEA message handling needs fix, because MRT6MSG_BW_UPCALL != MFEA_KERNEL_MESSAGE_BW_UPCALL"
00211 #endif
00212 #endif
00213 
00214 #endif // HAVE_IPV4_MULTICAST_ROUTING
00215 
00216 //
00217 // Global variables
00218 //
00219 
00220 //
00221 // Global functions prototypes
00222 //
00223 
00224 #endif // __FEA_MFEA_OSDEP_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations