]> git.proxmox.com Git - mirror_frr.git/blame - ospfd/ospf_ri.h
Merge pull request #1329 from opensourcerouting/debian9-pkg
[mirror_frr.git] / ospfd / ospf_ri.h
CommitLineData
0ef4bcdc
OD
1/*
2 * This is an implementation of RFC4970 Router Information
3 * with support of RFC5088 PCE Capabilites announcement
4 *
5 * Module name: Router Information
6 * Version: 0.99.22
7 * Created: 2012-02-01 by Olivier Dugeon
8 * Copyright (C) 2012 Orange Labs http://www.orange.com/
9 *
10 * This file is part of GNU Zebra.
11 *
12 * GNU Zebra is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2, or (at your option) any
15 * later version.
16 *
17 * GNU Zebra is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with GNU Zebra; see the file COPYING. If not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 * 02111-1307, USA.
26 */
27
28#ifndef _ZEBRA_OSPF_ROUTER_INFO_H
29#define _ZEBRA_OSPF_ROUTER_INFO_H
30
31/*
32 * Opaque LSA's link state ID for Router Information is
33 * structured as follows.
34 *
35 * 24 16 8 0
36 * +--------+--------+--------+--------+
37 * | 1 | MBZ |........|........|
38 * +--------+--------+--------+--------+
39 * |<-Type->|<Resv'd>|<-- Instance --->|
40 *
41 *
42 * Type: IANA has assigned '4' for Router Information.
43 * MBZ: Reserved, must be set to zero.
44 * Instance: User may select an arbitrary 16-bit value.
45 *
46 */
47
48/*
49 * 24 16 8 0
50 * +--------+--------+--------+--------+ ---
51 * | LS age |Options | 9,10,11| A
52 * +--------+--------+--------+--------+ |
53 * | 4 | 0 | Instance | |
54 * +--------+--------+--------+--------+ |
55 * | Advertising router | | Standard (Opaque) LSA header;
56 * +--------+--------+--------+--------+ | Type 9,10 or 11 are used.
57 * | LS sequence number | |
58 * +--------+--------+--------+--------+ |
59 * | LS checksum | Length | V
60 * +--------+--------+--------+--------+ ---
61 * | Type | Length | A
ac4d0be5 62 * +--------+--------+--------+--------+ | TLV part for Router Information;
63 * Values might be
0ef4bcdc
OD
64 * | Values ... | V structured as a set of sub-TLVs.
65 * +--------+--------+--------+--------+ ---
66 */
67
68/*
69 * Following section defines TLV (tag, length, value) structures,
70 * used for Router Information.
71 */
ac4d0be5 72struct ri_tlv_header {
73 u_int16_t type; /* RI_TLV_XXX (see below) */
74 u_int16_t length; /* Value portion only, in byte */
0ef4bcdc
OD
75};
76
77#define RI_TLV_HDR_SIZE (sizeof (struct ri_tlv_header))
78#define RI_TLV_BODY_SIZE(tlvh) (ROUNDUP (ntohs ((tlvh)->length), sizeof (u_int32_t)))
79#define RI_TLV_SIZE(tlvh) (RI_TLV_HDR_SIZE + RI_TLV_BODY_SIZE(tlvh))
80#define RI_TLV_HDR_TOP(lsah) (struct ri_tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE)
81#define RI_TLV_HDR_NEXT(tlvh) (struct ri_tlv_header *)((char *)(tlvh) + RI_TLV_SIZE(tlvh))
82
83/*
84 * Following section defines TLV body parts.
85 */
86
87/* Up to now, 8 code point have been assigned to Router Information */
88/* Only type 1 Router Capabilities and 6 PCE are supported with this code */
89#define RI_IANA_MAX_TYPE 8
90
91/* RFC4970: Router Information Capabilities TLV */ /* Mandatory */
92#define RI_TLV_CAPABILITIES 1
93
ac4d0be5 94struct ri_tlv_router_cap {
95 struct ri_tlv_header header; /* Value length is 4 bytes. */
96 u_int32_t value;
0ef4bcdc
OD
97};
98
99#define RI_GRACE_RESTART 0x01
100#define RI_GRACE_HELPER 0x02
101#define RI_STUB_SUPPORT 0x04
102#define RI_TE_SUPPORT 0x08
103#define RI_P2P_OVER_LAN 0x10
104#define RI_TE_EXPERIMENTAL 0x20
105
106#define RI_TLV_LENGTH 4
107
108/* RFC5088: PCE Capabilities TLV */ /* Optional */
109/* RI PCE TLV */
110#define RI_TLV_PCE 6
111
ac4d0be5 112struct ri_tlv_pce {
113 struct ri_tlv_header header;
114 /* A set of PCE-sub-TLVs will follow. */
0ef4bcdc
OD
115};
116
117/* PCE Address Sub-TLV */ /* Mandatory */
118#define RI_PCE_SUBTLV_ADDRESS 1
ac4d0be5 119struct ri_pce_subtlv_address {
120 struct ri_tlv_header
121 header; /* Type = 1; Length is 8 (IPv4) or 20 (IPv6) bytes. */
122 /* $FRR indent$ */
123 /* clang-format off */
0ef4bcdc
OD
124#define PCE_ADDRESS_LENGTH_IPV4 8
125#define PCE_ADDRESS_LENGTH_IPV6 20
ac4d0be5 126 struct {
127 u_int16_t type; /* Address type: 1 = IPv4, 2 = IPv6 */
128 /* $FRR indent$ */
129 /* clang-format off */
0ef4bcdc
OD
130#define PCE_ADDRESS_TYPE_IPV4 1
131#define PCE_ADDRESS_TYPE_IPV6 2
ac4d0be5 132 u_int16_t reserved;
133 struct in_addr value; /* PCE address */
134 } address;
0ef4bcdc
OD
135};
136
137/* PCE Path-Scope Sub-TLV */ /* Mandatory */
138#define RI_PCE_SUBTLV_PATH_SCOPE 2
ac4d0be5 139struct ri_pce_subtlv_path_scope {
140 struct ri_tlv_header header; /* Type = 2; Length = 4 bytes. */
141 u_int32_t value; /* L, R, Rd, S, Sd, Y, PrefL, PrefR, PrefS and PrefY
142 bits see RFC5088 page 9 */
0ef4bcdc
OD
143};
144
145/* PCE Domain Sub-TLV */ /* Optional */
146#define RI_PCE_SUBTLV_DOMAIN 3
147
148#define PCE_DOMAIN_TYPE_AREA 1
149#define PCE_DOMAIN_TYPE_AS 2
150
ac4d0be5 151struct ri_pce_subtlv_domain {
152 struct ri_tlv_header header; /* Type = 3; Length = 8 bytes. */
153 u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */
154 u_int16_t reserved;
155 u_int32_t value;
0ef4bcdc
OD
156};
157
158/* PCE Neighbor Sub-TLV */ /* Mandatory if R or S bit is set */
159#define RI_PCE_SUBTLV_NEIGHBOR 4
ac4d0be5 160struct ri_pce_subtlv_neighbor {
161 struct ri_tlv_header header; /* Type = 4; Length = 8 bytes. */
162 u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */
163 u_int16_t reserved;
164 u_int32_t value;
0ef4bcdc
OD
165};
166
167/* PCE Capabilities Flags Sub-TLV */ /* Optional */
168#define RI_PCE_SUBTLV_CAP_FLAG 5
169
170#define PCE_CAP_GMPLS_LINK 0x0001
171#define PCE_CAP_BIDIRECTIONAL 0x0002
172#define PCE_CAP_DIVERSE_PATH 0x0004
173#define PCE_CAP_LOAD_BALANCE 0x0008
174#define PCE_CAP_SYNCHRONIZED 0x0010
175#define PCE_CAP_OBJECTIVES 0x0020
176#define PCE_CAP_ADDITIVE 0x0040
177#define PCE_CAP_PRIORIZATION 0x0080
178#define PCE_CAP_MULTIPLE_REQ 0x0100
179
ac4d0be5 180struct ri_pce_subtlv_cap_flag {
181 struct ri_tlv_header header; /* Type = 5; Length = n x 4 bytes. */
182 u_int32_t value;
0ef4bcdc
OD
183};
184
185/* Prototypes. */
ac4d0be5 186extern int ospf_router_info_init(void);
187extern void ospf_router_info_term(void);
0ef4bcdc
OD
188
189#endif /* _ZEBRA_OSPF_ROUTER_INFO_H */