[configure] Allow for large-file support, e.g. for log files >2GB
[jleu-quagga.git] / ospfd / ospf_te.h
blobe8511cdfbf83bd2b329e7ce4ce08f39e923323e5
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/
6 * This file is part of GNU Zebra.
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.
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.
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.
24 #ifndef _ZEBRA_OSPF_MPLS_TE_H
25 #define _ZEBRA_OSPF_MPLS_TE_H
28 * Opaque LSA's link state ID for Traffic Engineering is
29 * structured as follows.
31 * 24 16 8 0
32 * +--------+--------+--------+--------+
33 * | 1 | MBZ |........|........|
34 * +--------+--------+--------+--------+
35 * |<-Type->|<Resv'd>|<-- Instance --->|
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.
44 #define LEGAL_TE_INSTANCE_RANGE(i) (0 <= (i) && (i) <= 0xffff)
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 * +--------+--------+--------+--------+ ---
66 * Following section defines TLV (tag, length, value) structures,
67 * used for Traffic Engineering.
69 struct te_tlv_header
71 u_int16_t type; /* TE_TLV_XXX (see below) */
72 u_int16_t length; /* Value portion only, in octets */
75 #define TLV_HDR_SIZE \
76 (sizeof (struct te_tlv_header))
78 #define TLV_BODY_SIZE(tlvh) \
79 (ROUNDUP (ntohs ((tlvh)->length), sizeof (u_int32_t)))
81 #define TLV_SIZE(tlvh) \
82 (TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh))
84 #define TLV_HDR_TOP(lsah) \
85 (struct te_tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE)
87 #define TLV_HDR_NEXT(tlvh) \
88 (struct te_tlv_header *)((char *)(tlvh) + TLV_SIZE(tlvh))
91 * Following section defines TLV body parts.
93 /* Router Address TLV *//* Mandatory */
94 #define TE_TLV_ROUTER_ADDR 1
95 struct te_tlv_router_addr
97 struct te_tlv_header header; /* Value length is 4 octets. */
98 struct in_addr value;
101 /* Link TLV */
102 #define TE_TLV_LINK 2
103 struct te_tlv_link
105 struct te_tlv_header header;
106 /* A set of link-sub-TLVs will follow. */
109 /* Link Type Sub-TLV *//* Mandatory */
110 #define TE_LINK_SUBTLV_LINK_TYPE 1
111 struct te_link_subtlv_link_type
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;
122 /* Link Sub-TLV: Link ID *//* Mandatory */
123 #define TE_LINK_SUBTLV_LINK_ID 2
124 struct te_link_subtlv_link_id
126 struct te_tlv_header header; /* Value length is 4 octets. */
127 struct in_addr value; /* Same as router-lsa's link-id. */
130 /* Link Sub-TLV: Local Interface IP Address *//* Optional */
131 #define TE_LINK_SUBTLV_LCLIF_IPADDR 3
132 struct te_link_subtlv_lclif_ipaddr
134 struct te_tlv_header header; /* Value length is 4 x N octets. */
135 struct in_addr value[1]; /* Local IP address(es). */
138 /* Link Sub-TLV: Remote Interface IP Address *//* Optional */
139 #define TE_LINK_SUBTLV_RMTIF_IPADDR 4
140 struct te_link_subtlv_rmtif_ipaddr
142 struct te_tlv_header header; /* Value length is 4 x N octets. */
143 struct in_addr value[1]; /* Neighbor's IP address(es). */
146 /* Link Sub-TLV: Traffic Engineering Metric *//* Optional */
147 #define TE_LINK_SUBTLV_TE_METRIC 5
148 struct te_link_subtlv_te_metric
150 struct te_tlv_header header; /* Value length is 4 octets. */
151 u_int32_t value; /* Link metric for TE purpose. */
154 /* Link Sub-TLV: Maximum Bandwidth *//* Optional */
155 #define TE_LINK_SUBTLV_MAX_BW 6
156 struct te_link_subtlv_max_bw
158 struct te_tlv_header header; /* Value length is 4 octets. */
159 float value; /* bytes/sec */
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
166 struct te_tlv_header header; /* Value length is 4 octets. */
167 float value; /* bytes/sec */
170 /* Link Sub-TLV: Unreserved Bandwidth *//* Optional */
171 #define TE_LINK_SUBTLV_UNRSV_BW 8
172 struct te_link_subtlv_unrsv_bw
174 struct te_tlv_header header; /* Value length is 32 octets. */
175 float value[8]; /* One for each priority level. */
178 /* Link Sub-TLV: Resource Class/Color *//* Optional */
179 #define TE_LINK_SUBTLV_RSC_CLSCLR 9
180 struct te_link_subtlv_rsc_clsclr
182 struct te_tlv_header header; /* Value length is 4 octets. */
183 u_int32_t value; /* Admin. group membership. */
186 /* Here are "non-official" architechtual constants. */
187 #define MPLS_TE_MINIMUM_BANDWIDTH 1.0 /* Reasonable? *//* XXX */
189 /* Prototypes. */
190 extern int ospf_mpls_te_init (void);
191 extern void ospf_mpls_te_term (void);
193 #endif /* _ZEBRA_OSPF_MPLS_TE_H */