FD.io VPP  v17.04.2-2-ga8f93f8
Vector Packet Processing
fib_entry_src_api.c
Go to the documentation of this file.
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 
16 #include "fib_entry.h"
17 #include "fib_entry_src.h"
18 #include "fib_path_list.h"
19 
20 /**
21  * Source initialisation Function
22  */
23 static void
25 {
26 }
27 
28 /**
29  * Source deinitialisation Function
30  */
31 static void
33 {
34 }
35 
36 static void
38  const fib_entry_t *entry,
39  fib_path_list_flags_t pl_flags,
40  const fib_route_path_t *paths)
41 {
43  paths);
44 }
45 
46 static void
48  const fib_entry_t *entry,
49  fib_path_list_flags_t pl_flags,
50  const fib_route_path_t *paths)
51 {
52  if (FIB_NODE_INDEX_INVALID == src->fes_pl)
53  {
54  src->fes_pl =
56  }
57  else
58  {
59  src->fes_pl =
61  (FIB_PATH_LIST_FLAG_SHARED | pl_flags),
62  paths);
63  }
64 }
65 
66 static void
68  fib_path_list_flags_t pl_flags,
69  const fib_route_path_t *paths)
70 {
71  if (FIB_NODE_INDEX_INVALID != src->fes_pl)
72  {
73  src->fes_pl =
75  (FIB_PATH_LIST_FLAG_SHARED | pl_flags),
76  paths);
77  }
78 }
79 
80 static void
82  const fib_entry_t *entry,
84  fib_protocol_t proto,
85  const dpo_id_t *dpo)
86 {
87  if (FIB_ENTRY_FLAG_NONE != flags)
88  {
90  proto,
92  dpo);
93  }
94 }
95 
96 static void
98 {
100 }
101 
102 const static fib_entry_src_vft_t api_src_vft = {
104  .fesv_deinit = fib_entry_src_api_deinit,
105  .fesv_add = fib_entry_src_api_add,
106  .fesv_remove = fib_entry_src_api_remove,
107  .fesv_path_add = fib_entry_src_api_path_add,
108  .fesv_path_swap = fib_entry_src_api_path_swap,
109  .fesv_path_remove = fib_entry_src_api_path_remove,
110 };
111 
112 void
114 {
116  fib_entry_src_register(FIB_SOURCE_API, &api_src_vft);
117  fib_entry_src_register(FIB_SOURCE_CLI, &api_src_vft);
120  fib_entry_src_register(FIB_SOURCE_SR, &api_src_vft);
121 }
fib_entry_src_init_t fesv_init
An entry in a FIB table.
Definition: fib_entry.h:373
A representation of a path as described by a route producer.
Definition: fib_types.h:308
Virtual function table each FIB entry source will register.
Information related to the source of a FIB entry.
Definition: fib_entry.h:282
From the CLI.
Definition: fib_entry.h:62
static void fib_entry_src_api_deinit(fib_entry_src_t *src)
Source deinitialisation Function.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static void fib_entry_src_api_path_remove(fib_entry_src_t *src, fib_path_list_flags_t pl_flags, const fib_route_path_t *paths)
A high priority source a plugin can use.
Definition: fib_entry.h:54
static void fib_entry_src_api_add(fib_entry_src_t *src, const fib_entry_t *entry, fib_entry_flag_t flags, fib_protocol_t proto, const dpo_id_t *dpo)
Definition: fib_entry.h:227
static void fib_entry_src_api_remove(fib_entry_src_t *src)
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:146
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
static void fib_entry_src_api_path_swap(fib_entry_src_t *src, const fib_entry_t *entry, fib_path_list_flags_t pl_flags, const fib_route_path_t *paths)
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
fib_path_list_flags_t fib_entry_src_flags_2_path_list_flags(fib_entry_flag_t eflags)
enum fib_entry_flag_t_ fib_entry_flag_t
void fib_entry_src_register(fib_source_t source, const fib_entry_src_vft_t *vft)
Definition: fib_entry_src.c:38
From the control plane API.
Definition: fib_entry.h:58
fib_node_index_t fes_pl
The path-list created by the source.
Definition: fib_entry.h:291
SRv6.
Definition: fib_entry.h:70
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:29
static void fib_entry_src_api_path_add(fib_entry_src_t *src, const fib_entry_t *entry, fib_path_list_flags_t pl_flags, const fib_route_path_t *paths)
DHCP.
Definition: fib_entry.h:82
void fib_entry_src_api_register(void)
static void fib_entry_src_api_init(fib_entry_src_t *src)
Source initialisation Function.
enum fib_path_list_flags_t_ fib_path_list_flags_t
u32 flags
Definition: vhost-user.h:78
fib_node_index_t fib_path_list_create_special(fib_protocol_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
IPv6 Proxy ND.
Definition: fib_entry.h:86