aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_types.api
blob: c0e467f6fd60385e416741e2538d460abd88bb98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

option version = "2.0.1";
import "vnet/ip/ip_types.api";

/** \brief MPLS label
*/
typedef fib_mpls_label
{
  u8 is_uniform;
  u32 label;
  u8 ttl;
  u8 exp;
};

/** brief A path's nexthop protocol
 */
enum fib_path_nh_proto
{
  FIB_API_PATH_NH_PROTO_IP4 = 0,
  FIB_API_PATH_NH_PROTO_IP6,
  FIB_API_PATH_NH_PROTO_MPLS,
  FIB_API_PATH_NH_PROTO_ETHERNET,
  FIB_API_PATH_NH_PROTO_BIER,
};

/** \brief Flags for the path
 */
enum fib_path_flags
{
  FIB_API_PATH_FLAG_NONE = 0,
  /* the path must resolve via an attached route */
  FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED = 1,
  /* the path must resolve via a host route */
  FIB_API_PATH_FLAG_RESOLVE_VIA_HOST = 2,
  /* pop a Pseudo Wire Control Word as well */
  FIB_API_PATH_FLAG_POP_PW_CW = 4,
};

/* \brief A description of the 'next-hop' for a path
 *  this can be something that needs resolving like an IP address
 *  (into an adjacency or another FIB entry) or the index of another
 *  VPP object that was previously created (i.e. a UDP encap object)
 */
typedef fib_path_nh
{
  /* proto = IP[46] */
  vl_api_address_union_t address;
  /* proto = MPLS */
  u32 via_label;
  /* proto = ANY, determined by path type */
  u32 obj_id;
  /* path-type = CLASSIFY */
  u32 classify_table_index;
};

enum fib_path_type
{
  /* Normal Paths */
  FIB_API_PATH_TYPE_NORMAL = 0,
  /* local/for-us/receive = packet sent to VPP's L4 stack */
  FIB_API_PATH_TYPE_LOCAL,
  /* packet is dropped */
  FIB_API_PATH_TYPE_DROP,
  /* Packet is UDP encapped  - set obj_id in fib_path_nh_id */
  FIB_API_PATH_TYPE_UDP_ENCAP,
  /* Packet is BIER encapped  - set obj_id in fib_path_nh_id */
  FIB_API_PATH_TYPE_BIER_IMP,
  /* packet will generated ICMP unreach to sender */
  FIB_API_PATH_TYPE_ICMP_UNREACH,
  /* packet will generated ICMP prohibt to sender */
  FIB_API_PATH_TYPE_ICMP_PROHIBIT,
  /* perform a lookup based on the packet's source address */
  FIB_API_PATH_TYPE_SOURCE_LOOKUP,
  /* Distributed Virtual router, packet is forwarded with the original
     L2 header unchanged */
  FIB_API_PATH_TYPE_DVR,
  /* packet's RX interface is changed */
  FIB_API_PATH_TYPE_INTERFACE_RX,
  /* packet will be sent to a classify table */
  FIB_API_PATH_TYPE_CLASSIFY,
};

/** \brief FIB path
    @param sw_if_index - index of the interface
    @param table_id - The table ID in which to find the next-hop address
                      (for recursive routes, i.e. when the interface is
		       not given)
    @param weight - The weight, for UCMP
    @param preference - The preference of the path. lowest preference
                        is preferred
    @param rpf-id - For paths that pop to multicast, this the the
                    RPF ID the packet will be given (0 and ~0 => unset)
    @param type - the path type
    @param flags - path flags
    @param proto - protocol that describes the next-hop address
    @param nh - the next-hop/net resolving object
    @param n_labels - the number of labels present in the stack
    @param label_stack - a stack of MPLS labels
*/
typedef fib_path
{
  u32 sw_if_index;
  u32 table_id;
  u32 rpf_id;
  u8 weight;
  u8 preference;

  vl_api_fib_path_type_t type;
  vl_api_fib_path_flags_t flags;
  vl_api_fib_path_nh_proto_t proto;
  vl_api_fib_path_nh_t nh;
  u8 n_labels;
  vl_api_fib_mpls_label_t label_stack[16];
};