root/netinet/pim.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


    1 /*      $OpenBSD: pim.h,v 1.2 2006/04/27 02:19:32 tedu Exp $    */
    2 /*      $NetBSD: pim.h,v 1.1 2004/09/04 23:32:29 manu Exp $     */
    3 
    4 /*
    5  * Copyright (c) 1996-2000
    6  * University of Southern California/Information Sciences Institute.
    7  * All rights reserved.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 3. Neither the name of the project nor the names of its contributors
   18  *    may be used to endorse or promote products derived from this software
   19  *    without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
   25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  * $FreeBSD: /repoman/r/ncvs/src/sys/netinet/pim.h,v 1.2 2004/03/08 07:45:32 hsu Exp $
   34  */
   35 
   36 #ifndef _NETINET_PIM_H_
   37 #define _NETINET_PIM_H_
   38 
   39 /*
   40  * Protocol Independent Multicast (PIM) definitions.
   41  * RFC 2362, June 1998.
   42  *
   43  * Written by Ahmed Helmy, USC/SGI, July 1996.
   44  * Modified by George Edmond Eddy (Rusty), ISI, February 1998.
   45  * Modified by Pavlin Radoslavov, USC/ISI, May 1998, October 2000.
   46  */
   47 
   48 #include <sys/types.h>
   49 
   50 #ifndef _PIM_VT
   51 #ifndef _BYTE_ORDER
   52 # error _BYTE_ORDER is not defined!
   53 #endif
   54 #if (_BYTE_ORDER != _BIG_ENDIAN) && (_BYTE_ORDER != _LITTLE_ENDIAN)
   55 # error _BYTE_ORDER must be defined to either _BIG_ENDIAN or _LITTLE_ENDIAN
   56 #endif
   57 #endif /* ! _PIM_VT */
   58 
   59 /*
   60  * PIM packet header
   61  */
   62 struct pim {
   63 #ifdef _PIM_VT
   64         uint8_t         pim_vt;         /* PIM version and message type */
   65 #else /* ! _PIM_VT   */
   66 #if _BYTE_ORDER == _BIG_ENDIAN
   67         u_int           pim_vers:4,     /* PIM protocol version         */
   68                         pim_type:4;     /* PIM message type             */
   69 #endif
   70 #if _BYTE_ORDER == _LITTLE_ENDIAN
   71         u_int           pim_type:4,     /* PIM message type             */
   72                         pim_vers:4;     /* PIM protocol version         */
   73 #endif
   74 #endif /* ! _PIM_VT  */
   75         uint8_t         pim_reserved;   /* Reserved                     */
   76         uint16_t        pim_cksum;      /* IP-style checksum            */
   77 };
   78 /* KAME-related name backward compatibility */
   79 #define pim_ver pim_vers
   80 #define pim_rsv pim_reserved
   81 
   82 #ifdef _PIM_VT
   83 #define PIM_MAKE_VT(v, t)       (0xff & (((v) << 4) | (0x0f & (t))))
   84 #define PIM_VT_V(x)             (((x) >> 4) & 0x0f)
   85 #define PIM_VT_T(x)             ((x) & 0x0f)
   86 #endif /* _PIM_VT */
   87 
   88 #define PIM_VERSION             2
   89 #define PIM_MINLEN              8       /* PIM message min. length      */
   90 #define PIM_REG_MINLEN  (PIM_MINLEN+20) /* PIM Register hdr + inner IPv4 hdr */
   91 #define PIM6_REG_MINLEN (PIM_MINLEN+40) /* PIM Register hdr + inner IPv6 hdr */
   92 
   93 /*
   94  * PIM message types
   95  */
   96 #define PIM_HELLO               0x0     /* PIM-SM and PIM-DM            */
   97 #define PIM_REGISTER            0x1     /* PIM-SM only                  */
   98 #define PIM_REGISTER_STOP       0x2     /* PIM-SM only                  */
   99 #define PIM_JOIN_PRUNE          0x3     /* PIM-SM and PIM-DM            */
  100 #define PIM_BOOTSTRAP           0x4     /* PIM-SM only                  */
  101 #define PIM_ASSERT              0x5     /* PIM-SM and PIM-DM            */
  102 #define PIM_GRAFT               0x6     /* PIM-DM only                  */
  103 #define PIM_GRAFT_ACK           0x7     /* PIM-DM only                  */
  104 #define PIM_CAND_RP_ADV         0x8     /* PIM-SM only                  */
  105 #define PIM_ALL_DF_ELECTION     0xa     /* Bidir-PIM-SM only            */
  106 
  107 /*
  108  * PIM-Register message flags
  109  */
  110 #define PIM_BORDER_REGISTER 0x80000000U /* The Border bit (host-order)  */
  111 #define PIM_NULL_REGISTER   0x40000000U /* The Null-Register bit (host-order)*/
  112 
  113 /*
  114  * All-PIM-Routers IPv4 and IPv6 multicast addresses
  115  */
  116 #define INADDR_ALLPIM_ROUTERS_GROUP     (uint32_t)0xe000000dU  /* 224.0.0.13 */
  117 #define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS        "ff02::d"
  118 #define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS_INIT                           \
  119         {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,             \
  120             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d }}}
  121 
  122 #endif /* _NETINET_PIM_H_ */

/* [<][>][^][v][top][bottom][index][help] */