Annotation of embedaddon/quagga/ospfd/ospf_te.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * This is an implementation of draft-katz-yeung-ospf-traffic-06.txt
        !             3:  * Copyright (C) 2001 KDD R&D Laboratories, Inc.
        !             4:  * http://www.kddlabs.co.jp/
        !             5:  *
        !             6:  * This file is part of GNU Zebra.
        !             7:  *
        !             8:  * GNU Zebra is free software; you can redistribute it and/or modify it
        !             9:  * under the terms of the GNU General Public License as published by the
        !            10:  * Free Software Foundation; either version 2, or (at your option) any
        !            11:  * later version.
        !            12:  * 
        !            13:  * GNU Zebra is distributed in the hope that it will be useful, but
        !            14:  * WITHOUT ANY WARRANTY; without even the implied warranty of
        !            15:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        !            16:  * General Public License for more details.
        !            17:  *
        !            18:  * You should have received a copy of the GNU General Public License
        !            19:  * along with GNU Zebra; see the file COPYING.  If not, write to the Free
        !            20:  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
        !            21:  * 02111-1307, USA.
        !            22:  */
        !            23: 
        !            24: #ifndef _ZEBRA_OSPF_MPLS_TE_H
        !            25: #define _ZEBRA_OSPF_MPLS_TE_H
        !            26: 
        !            27: /*
        !            28:  * Opaque LSA's link state ID for Traffic Engineering is
        !            29:  * structured as follows.
        !            30:  *
        !            31:  *        24       16        8        0
        !            32:  * +--------+--------+--------+--------+
        !            33:  * |    1   |  MBZ   |........|........|
        !            34:  * +--------+--------+--------+--------+
        !            35:  * |<-Type->|<Resv'd>|<-- Instance --->|
        !            36:  *
        !            37:  *
        !            38:  * Type:      IANA has assigned '1' for Traffic Engineering.
        !            39:  * MBZ:       Reserved, must be set to zero.
        !            40:  * Instance:  User may select an arbitrary 16-bit value.
        !            41:  *
        !            42:  */
        !            43: 
        !            44: #define        LEGAL_TE_INSTANCE_RANGE(i)      (0 <= (i) && (i) <= 0xffff)
        !            45: 
        !            46: /*
        !            47:  *        24       16        8        0
        !            48:  * +--------+--------+--------+--------+ ---
        !            49:  * |   LS age        |Options |   10   |  A
        !            50:  * +--------+--------+--------+--------+  |
        !            51:  * |    1   |   0    |    Instance     |  |
        !            52:  * +--------+--------+--------+--------+  |
        !            53:  * |        Advertising router         |  |  Standard (Opaque) LSA header;
        !            54:  * +--------+--------+--------+--------+  |  Only type-10 is used.
        !            55:  * |        LS sequence number         |  |
        !            56:  * +--------+--------+--------+--------+  |
        !            57:  * |   LS checksum   |     Length      |  V
        !            58:  * +--------+--------+--------+--------+ ---
        !            59:  * |      Type       |     Length      |  A
        !            60:  * +--------+--------+--------+--------+  |  TLV part for TE; Values might be
        !            61:  * |              Values ...           |  V  structured as a set of sub-TLVs.
        !            62:  * +--------+--------+--------+--------+ ---
        !            63:  */
        !            64: 
        !            65: /*
        !            66:  * Following section defines TLV (tag, length, value) structures,
        !            67:  * used for Traffic Engineering.
        !            68:  */
        !            69: struct te_tlv_header
        !            70: {
        !            71:   u_int16_t    type;                   /* TE_TLV_XXX (see below) */
        !            72:   u_int16_t    length;                 /* Value portion only, in octets */
        !            73: };
        !            74: 
        !            75: #define TLV_HDR_SIZE \
        !            76:        (sizeof (struct te_tlv_header))
        !            77: 
        !            78: #define TLV_BODY_SIZE(tlvh) \
        !            79:        (ROUNDUP (ntohs ((tlvh)->length), sizeof (u_int32_t)))
        !            80: 
        !            81: #define TLV_SIZE(tlvh) \
        !            82:        (TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh))
        !            83: 
        !            84: #define TLV_HDR_TOP(lsah) \
        !            85:        (struct te_tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE)
        !            86: 
        !            87: #define TLV_HDR_NEXT(tlvh) \
        !            88:        (struct te_tlv_header *)((char *)(tlvh) + TLV_SIZE(tlvh))
        !            89: 
        !            90: /*
        !            91:  * Following section defines TLV body parts.
        !            92:  */
        !            93: /* Router Address TLV *//* Mandatory */
        !            94: #define        TE_TLV_ROUTER_ADDR              1
        !            95: struct te_tlv_router_addr
        !            96: {
        !            97:   struct te_tlv_header header;         /* Value length is 4 octets. */
        !            98:   struct in_addr       value;
        !            99: };
        !           100: 
        !           101: /* Link TLV */
        !           102: #define        TE_TLV_LINK                     2
        !           103: struct te_tlv_link
        !           104: {
        !           105:   struct te_tlv_header header;
        !           106:   /* A set of link-sub-TLVs will follow. */
        !           107: };
        !           108: 
        !           109: /* Link Type Sub-TLV *//* Mandatory */
        !           110: #define        TE_LINK_SUBTLV_LINK_TYPE                1
        !           111: struct te_link_subtlv_link_type
        !           112: {
        !           113:   struct te_tlv_header header;         /* Value length is 1 octet. */
        !           114:   struct {
        !           115: #define        LINK_TYPE_SUBTLV_VALUE_PTP      1
        !           116: #define        LINK_TYPE_SUBTLV_VALUE_MA       2
        !           117:       u_char   value;
        !           118:       u_char   padding[3];
        !           119:   } link_type;
        !           120: };
        !           121: 
        !           122: /* Link Sub-TLV: Link ID *//* Mandatory */
        !           123: #define        TE_LINK_SUBTLV_LINK_ID                  2
        !           124: struct te_link_subtlv_link_id
        !           125: {
        !           126:   struct te_tlv_header header;         /* Value length is 4 octets. */
        !           127:   struct in_addr       value;          /* Same as router-lsa's link-id. */
        !           128: };
        !           129: 
        !           130: /* Link Sub-TLV: Local Interface IP Address *//* Optional */
        !           131: #define        TE_LINK_SUBTLV_LCLIF_IPADDR             3
        !           132: struct te_link_subtlv_lclif_ipaddr
        !           133: {
        !           134:   struct te_tlv_header header;         /* Value length is 4 x N octets. */
        !           135:   struct in_addr       value[1];       /* Local IP address(es). */
        !           136: };
        !           137: 
        !           138: /* Link Sub-TLV: Remote Interface IP Address *//* Optional */
        !           139: #define        TE_LINK_SUBTLV_RMTIF_IPADDR             4
        !           140: struct te_link_subtlv_rmtif_ipaddr
        !           141: {
        !           142:   struct te_tlv_header header;         /* Value length is 4 x N octets. */
        !           143:   struct in_addr       value[1];       /* Neighbor's IP address(es). */
        !           144: };
        !           145: 
        !           146: /* Link Sub-TLV: Traffic Engineering Metric *//* Optional */
        !           147: #define        TE_LINK_SUBTLV_TE_METRIC                5
        !           148: struct te_link_subtlv_te_metric
        !           149: {
        !           150:   struct te_tlv_header header;         /* Value length is 4 octets. */
        !           151:   u_int32_t            value;          /* Link metric for TE purpose. */
        !           152: };
        !           153: 
        !           154: /* Link Sub-TLV: Maximum Bandwidth *//* Optional */
        !           155: #define        TE_LINK_SUBTLV_MAX_BW                   6
        !           156: struct te_link_subtlv_max_bw
        !           157: {
        !           158:   struct te_tlv_header header;         /* Value length is 4 octets. */
        !           159:   float                        value;          /* bytes/sec */
        !           160: };
        !           161: 
        !           162: /* Link Sub-TLV: Maximum Reservable Bandwidth *//* Optional */
        !           163: #define        TE_LINK_SUBTLV_MAX_RSV_BW               7
        !           164: struct te_link_subtlv_max_rsv_bw
        !           165: {
        !           166:   struct te_tlv_header header;         /* Value length is 4 octets. */
        !           167:   float                        value;          /* bytes/sec */
        !           168: };
        !           169: 
        !           170: /* Link Sub-TLV: Unreserved Bandwidth *//* Optional */
        !           171: #define        TE_LINK_SUBTLV_UNRSV_BW                 8
        !           172: struct te_link_subtlv_unrsv_bw
        !           173: {
        !           174:   struct te_tlv_header header;         /* Value length is 32 octets. */
        !           175:   float                        value[8];       /* One for each priority level. */
        !           176: };
        !           177: 
        !           178: /* Link Sub-TLV: Resource Class/Color *//* Optional */
        !           179: #define        TE_LINK_SUBTLV_RSC_CLSCLR               9
        !           180: struct te_link_subtlv_rsc_clsclr
        !           181: {
        !           182:   struct te_tlv_header header;         /* Value length is 4 octets. */
        !           183:   u_int32_t            value;          /* Admin. group membership. */
        !           184: };
        !           185: 
        !           186: /* Here are "non-official" architechtual constants. */
        !           187: #define MPLS_TE_MINIMUM_BANDWIDTH      1.0     /* Reasonable? *//* XXX */
        !           188: 
        !           189: /* Prototypes. */
        !           190: extern int ospf_mpls_te_init (void);
        !           191: extern void ospf_mpls_te_term (void);
        !           192: 
        !           193: #endif /* _ZEBRA_OSPF_MPLS_TE_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>