xorp

pim.h

00001 /*  $FreeBSD$   */
00002 
00003 /*
00004  * Copyright (c) 1996-2000
00005  * University of Southern California/Information Sciences Institute.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
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 project nor the names of its contributors
00017  *    may be used to endorse or promote products derived from this software
00018  *    without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
00024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  */
00032 
00033 #ifndef _NETINET_PIM_H_
00034 #define _NETINET_PIM_H_
00035 
00036 /*
00037  * Protocol Independent Multicast (PIM) definitions.
00038  * RFC 2362, June 1998.
00039  *
00040  * Written by Ahmed Helmy, USC/SGI, July 1996.
00041  * Modified by George Edmond Eddy (Rusty), ISI, February 1998.
00042  * Modified by Pavlin Radoslavov, USC/ISI, May 1998, October 2000.
00043  */
00044 
00045 
00046 #ifndef _PIM_VT
00047 #ifndef BYTE_ORDER
00048 # error BYTE_ORDER is not defined!
00049 #endif
00050 #if (BYTE_ORDER != BIG_ENDIAN) && (BYTE_ORDER != LITTLE_ENDIAN)
00051 # error BYTE_ORDER must be defined to either BIG_ENDIAN or LITTLE_ENDIAN
00052 #endif
00053 #endif /* ! _PIM_VT */
00054 
00055 /*
00056  * PIM packet header
00057  */
00058 struct pim {
00059 #ifdef _PIM_VT
00060     uint8_t     pim_vt;     /* PIM version and message type */
00061 #else /* ! _PIM_VT   */
00062 #if BYTE_ORDER == BIG_ENDIAN
00063     u_int       pim_vers:4, /* PIM protocol version     */
00064             pim_type:4; /* PIM message type     */
00065 #endif
00066 #if BYTE_ORDER == LITTLE_ENDIAN
00067     u_int       pim_type:4, /* PIM message type     */
00068             pim_vers:4; /* PIM protocol version     */
00069 #endif
00070 #endif /* ! _PIM_VT  */
00071     uint8_t     pim_reserved;   /* Reserved         */
00072     uint16_t    pim_cksum;  /* IP-style checksum        */
00073 };
00074 /* KAME-related name backward compatibility */
00075 #define pim_ver pim_vers
00076 #define pim_rsv pim_reserved
00077 
00078 #ifdef _PIM_VT
00079 #define PIM_MAKE_VT(v, t)   (0xff & (((v) << 4) | (0x0f & (t))))
00080 #define PIM_VT_V(x)     (((x) >> 4) & 0x0f)
00081 #define PIM_VT_T(x)     ((x) & 0x0f)
00082 #endif /* _PIM_VT */
00083 
00084 #define PIM_VERSION     2
00085 #define PIM_MINLEN      8   /* PIM message min. length  */
00086 #define PIM_REG_MINLEN  (PIM_MINLEN+20) /* PIM Register hdr + inner IPv4 hdr */
00087 #define PIM6_REG_MINLEN (PIM_MINLEN+40) /* PIM Register hdr + inner IPv6 hdr */
00088 
00089 /*
00090  * PIM message types
00091  */
00092 #define PIM_HELLO       0x0 /* PIM-SM and PIM-DM        */
00093 #define PIM_REGISTER        0x1 /* PIM-SM only          */
00094 #define PIM_REGISTER_STOP   0x2 /* PIM-SM only          */
00095 #define PIM_JOIN_PRUNE      0x3 /* PIM-SM and PIM-DM        */
00096 #define PIM_BOOTSTRAP       0x4 /* PIM-SM only          */
00097 #define PIM_ASSERT      0x5 /* PIM-SM and PIM-DM        */
00098 #define PIM_GRAFT       0x6 /* PIM-DM only          */
00099 #define PIM_GRAFT_ACK       0x7 /* PIM-DM only          */
00100 #define PIM_CAND_RP_ADV     0x8 /* PIM-SM only          */
00101 #define PIM_ALL_DF_ELECTION 0xa /* Bidir-PIM-SM only        */
00102 
00103 /*
00104  * PIM-Register message flags
00105  */
00106 #define PIM_BORDER_REGISTER 0x80000000U /* The Border bit (host-order)  */
00107 #define PIM_NULL_REGISTER   0x40000000U /* The Null-Register bit (host-order)*/
00108 
00109 /*
00110  * All-PIM-Routers IPv4 and IPv6 multicast addresses
00111  */
00112 #define INADDR_ALLPIM_ROUTERS_GROUP (uint32_t)0xe000000dU  /* 224.0.0.13 */
00113 #define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS    "ff02::d"
00114 #define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS_INIT               \
00115     {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     \
00116         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d }}}
00117 
00118 #endif /* _NETINET_PIM_H_ */
 All Classes Namespaces Functions Variables Typedefs Enumerations