b1075cdda57253edd289b2cefbf1ba63c5332aa2
[vpp.git] / src / vnet / mpls / mpls_types.h
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __MPLS_TYPES_H__
16 #define __MPLS_TYPES_H__
17
18 #define MPLS_IETF_MIN_LABEL                  0x00000
19 #define MPLS_IETF_MAX_LABEL                  0xfffff
20
21 #define MPLS_IETF_MIN_RESERVED_LABEL         0x00000
22 #define MPLS_IETF_MAX_RESERVED_LABEL         0x0000f
23
24 #define MPLS_IETF_MIN_UNRES_LABEL            0x00010
25 #define MPLS_IETF_MAX_UNRES_LABEL            0xfffff
26
27 #define MPLS_IETF_IPV4_EXPLICIT_NULL_LABEL   0x00000
28 #define MPLS_IETF_ROUTER_ALERT_LABEL         0x00001
29 #define MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL   0x00002
30 #define MPLS_IETF_IMPLICIT_NULL_LABEL        0x00003
31 #define MPLS_IETF_ELI_LABEL                  0x00007
32 #define MPLS_IETF_GAL_LABEL                  0x0000D
33
34 #define MPLS_IETF_IPV4_EXPLICIT_NULL_STRING          "ip4-explicit-null"
35 #define MPLS_IETF_IPV4_EXPLICIT_NULL_BRIEF_STRING    "e-nul"
36 #define MPLS_IETF_IMPLICIT_NULL_STRING               "implicit-null"
37 #define MPLS_IETF_IMPLICIT_NULL_BRIEF_STRING         "i-nul"
38 #define MPLS_IETF_ROUTER_ALERT_STRING                "router-alert"
39 #define MPLS_IETF_ROUTER_ALERT_BRIEF_STRING          "r-alt"
40 #define MPLS_IETF_IPV6_EXPLICIT_NULL_STRING          "ipv6-explicit-null"
41 #define MPLS_IETF_IPV6_EXPLICIT_NULL_BRIEF_STRING    "v6enl"
42 #define MPLS_IETF_ELI_STRING                         "entropy-label-indicator"
43 #define MPLS_IETF_ELI_BRIEF_STRING                   "eli"
44 #define MPLS_IETF_GAL_STRING                         "gal"
45 #define MPLS_IETF_GAL_BRIEF_STRING                   "gal"
46
47 #define MPLS_LABEL_INVALID (MPLS_IETF_MAX_LABEL+1)
48
49 #define MPLS_LABEL_IS_REAL(_lbl) \
50     (((_lbl) > MPLS_IETF_MIN_UNRES_LABEL) &&    \
51      ((_lbl) <= MPLS_IETF_MAX_UNRES_LABEL))
52
53 /**
54  * The top bit of the index, which is the result of the MPLS lookup
55  * is used to determine if the DPO is a load-balance or a replicate
56  */
57 #define MPLS_IS_REPLICATE 0x80000000
58
59 #endif