acl: add missing byteswap header for musl
[vpp.git] / src / vnet / fib / fib_types.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 option version = "2.0.1";
18 import "vnet/ip/ip_types.api";
19
20 /** \brief MPLS label
21 */
22 typedef fib_mpls_label
23 {
24   u8 is_uniform;
25   u32 label;
26   u8 ttl;
27   u8 exp;
28 };
29
30 /** brief A path's nexthop protocol
31  */
32 enum fib_path_nh_proto
33 {
34   FIB_API_PATH_NH_PROTO_IP4 = 0,
35   FIB_API_PATH_NH_PROTO_IP6,
36   FIB_API_PATH_NH_PROTO_MPLS,
37   FIB_API_PATH_NH_PROTO_ETHERNET,
38   FIB_API_PATH_NH_PROTO_BIER,
39 };
40
41 /** \brief Flags for the path
42  */
43 enum fib_path_flags
44 {
45   FIB_API_PATH_FLAG_NONE = 0,
46   /* the path must resolve via an attached route */
47   FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED = 1,
48   /* the path must resolve via a host route */
49   FIB_API_PATH_FLAG_RESOLVE_VIA_HOST = 2,
50   /* pop a Pseudo Wire Control Word as well */
51   FIB_API_PATH_FLAG_POP_PW_CW = 4,
52 };
53
54 /* \brief A description of the 'next-hop' for a path
55  *  this can be something that needs resolving like an IP address
56  *  (into an adjacency or another FIB entry) or the index of another
57  *  VPP object that was previously created (i.e. a UDP encap object)
58  */
59 typedef fib_path_nh
60 {
61   /* proto = IP[46] */
62   vl_api_address_union_t address;
63   /* proto = MPLS */
64   u32 via_label;
65   /* proto = ANY, determined by path type */
66   u32 obj_id;
67   /* path-type = CLASSIFY */
68   u32 classify_table_index;
69 };
70
71 enum fib_path_type
72 {
73   /* Normal Paths */
74   FIB_API_PATH_TYPE_NORMAL = 0,
75   /* local/for-us/receive = packet sent to VPP's L4 stack */
76   FIB_API_PATH_TYPE_LOCAL,
77   /* packet is dropped */
78   FIB_API_PATH_TYPE_DROP,
79   /* Packet is UDP encapped  - set obj_id in fib_path_nh_id */
80   FIB_API_PATH_TYPE_UDP_ENCAP,
81   /* Packet is BIER encapped  - set obj_id in fib_path_nh_id */
82   FIB_API_PATH_TYPE_BIER_IMP,
83   /* packet will generated ICMP unreach to sender */
84   FIB_API_PATH_TYPE_ICMP_UNREACH,
85   /* packet will generated ICMP prohibt to sender */
86   FIB_API_PATH_TYPE_ICMP_PROHIBIT,
87   /* perform a lookup based on the packet's source address */
88   FIB_API_PATH_TYPE_SOURCE_LOOKUP,
89   /* Distributed Virtual router, packet is forwarded with the original
90      L2 header unchanged */
91   FIB_API_PATH_TYPE_DVR,
92   /* packet's RX interface is changed */
93   FIB_API_PATH_TYPE_INTERFACE_RX,
94   /* packet will be sent to a classify table */
95   FIB_API_PATH_TYPE_CLASSIFY,
96 };
97
98 /** \brief FIB path
99     @param sw_if_index - index of the interface
100     @param table_id - The table ID in which to find the next-hop address
101                       (for recursive routes, i.e. when the interface is
102                        not given)
103     @param weight - The weight, for UCMP
104     @param preference - The preference of the path. lowest preference
105                         is preferred
106     @param rpf-id - For paths that pop to multicast, this the the
107                     RPF ID the packet will be given (0 and ~0 => unset)
108     @param type - the path type
109     @param flags - path flags
110     @param proto - protocol that describes the next-hop address
111     @param nh - the next-hop/net resolving object
112     @param n_labels - the number of labels present in the stack
113     @param label_stack - a stack of MPLS labels
114 */
115 typedef fib_path
116 {
117   u32 sw_if_index;
118   u32 table_id;
119   u32 rpf_id;
120   u8 weight;
121   u8 preference;
122
123   vl_api_fib_path_type_t type;
124   vl_api_fib_path_flags_t flags;
125   vl_api_fib_path_nh_proto_t proto;
126   vl_api_fib_path_nh_t nh;
127   u8 n_labels;
128   vl_api_fib_mpls_label_t label_stack[16];
129 };