xorp

ip_mroute.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/mrt/include/ip_mroute.h,v 1.21 2008/10/02 21:57:46 bms Exp $
00024  */
00025 
00026 #ifndef __MRT_INCLUDE_IP_MROUTE_H__
00027 #define __MRT_INCLUDE_IP_MROUTE_H__
00028 
00029 #include "libxorp/xorp.h"
00030 
00031 #ifdef HAVE_NET_ROUTE_H
00032 #include <net/route.h>
00033 #endif
00034 
00035 /*
00036  * FreeBSD (all versions)
00037  */
00038 #if defined(HOST_OS_FREEBSD)
00039 # include <netinet/ip_mroute.h>
00040 #endif
00041 
00042 /*
00043  * NetBSD (all versions)
00044  * OpenBSD (all versions)
00045  *
00046  * Prologue.
00047  *
00048  * XXX: On these platforms the definition of 'struct igmpmsg'
00049  * and IGMPMSG_* is wrapped inside #ifdef _KERNEL hence we need
00050  * to define _KERNEL before including <netinet/ip_mroute.h>.
00051  */
00052 #if defined(HOST_OS_NETBSD) || defined(HOST_OS_OPENBSD)
00053 #define _KERNEL
00054 #endif
00055 
00056 /*
00057  * Non-Linux platforms with the <netinet/ip_mroute.h>
00058  * header available.
00059  */
00060 #if defined(HAVE_NETINET_IP_MROUTE_H) && !defined(HOST_OS_LINUX)
00061 # include <netinet/ip_mroute.h>
00062 #endif
00063 
00064 /*
00065  * NetBSD (all versions)
00066  * OpenBSD (all versions)
00067  *
00068  * Epilogue.
00069  */
00070 #if defined(HOST_OS_NETBSD) || defined(HOST_OS_OPENBSD)
00071 #undef _KERNEL
00072 #endif
00073 
00074 /*
00075  * DragonFlyBSD
00076  *
00077  * DragonFlyBSD (as per version 1.4) has moved <netinet/ip_mroute.h> to
00078  * <net/ip_mroute/ip_mroute.h>. Hopefully, in the future it will be back
00079  * to its appropriate location.
00080  */
00081 #ifdef HAVE_NET_IP_MROUTE_IP_MROUTE_H
00082 # include <net/ip_mroute/ip_mroute.h>
00083 #endif
00084 
00085 /*
00086  * Linux hacks because of broken Linux header files
00087  */
00088 #if defined(HOST_OS_LINUX)
00089 #  include <linux/types.h>
00090 #  ifndef _LINUX_IN_H
00091 #    define _LINUX_IN_H     /*  XXX: a hack to exclude <linux/in.h> */
00092 #    define EXCLUDE_LINUX_IN_H
00093 #  endif
00094 #  ifndef __LINUX_PIM_H
00095 #    define __LINUX_PIM_H   /*  XXX: a hack to exclude <linux/pim.h> */
00096 #    define EXCLUDE_LINUX_PIM_H
00097 #  endif
00098 #    include <linux/mroute.h>
00099 #  ifdef EXCLUDE_LINUX_IN_H
00100 #    undef _LINUX_IN_H
00101 #    undef EXCLUDE_LINUX_IN_H
00102 #  endif
00103 #  ifdef EXCLUDE_LINUX_PIM_H
00104 #    undef __LINUX_PIM_H
00105 #    undef EXCLUDE_LINUX_PIM_H
00106 #  endif
00107 /*
00108  * XXX: Conditionally add missing definitions from the <linux/mroute.h>
00109  * header file.
00110  */
00111 #  ifndef IGMPMSG_NOCACHE
00112 #    define IGMPMSG_NOCACHE 1
00113 #   endif
00114 #  ifndef IGMPMSG_WRONGVIF
00115 #    define IGMPMSG_WRONGVIF 2
00116 #  endif
00117 #  ifndef IGMPMSG_WHOLEPKT
00118 #    define IGMPMSG_WHOLEPKT 3
00119 #  endif
00120 #endif /* HOST_OS_LINUX */
00121 
00122 #ifdef HAVE_LINUX_MROUTE6_H
00123 #include <linux/mroute6.h>
00124 #endif
00125 
00126 
00127 /*
00128  * FreeBSD 4.3
00129  *
00130  * On this platform, attempting to include both the ip_mroute.h
00131  * and ip6_mroute.h headers results in undefined behavior.
00132  * Therefore we implement a preprocessor workaround here.
00133  */
00134 #ifdef HAVE_IPV6
00135 
00136 /* Save GET_TIME. */
00137 #  ifdef GET_TIME
00138 #    define _SAVE_GET_TIME GET_TIME
00139 #    undef GET_TIME
00140 #  endif
00141 
00142 #  ifdef HAVE_NETINET6_IP6_MROUTE_H
00143 #    include <netinet6/ip6_mroute.h>
00144 #  endif
00145 
00146 /* Restore GET_TIME. */
00147 #  if defined(_SAVE_GET_TIME) && !defined(GET_TIME)
00148 #    define GET_TIME _SAVE_GET_TIME
00149 #    undef _SAVE_GET_TIME
00150 #  endif
00151 
00152 #endif /* HAVE_IPV6 */
00153 
00154 #endif /* __MRT_INCLUDE_IP_MROUTE_H__ */
 All Classes Namespaces Functions Variables Typedefs Enumerations