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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #include "fib_entry.h"
17 #include "fib_entry_src.h"
18 #include "fib_path_list.h"
21 * Source initialisation Function
24 fib_entry_src_lisp_init (fib_entry_src_t *src)
29 * Source deinitialisation Function
32 fib_entry_src_lisp_deinit (fib_entry_src_t *src)
37 fib_entry_src_lisp_path_swap (fib_entry_src_t *src,
38 const fib_entry_t *entry,
39 fib_path_list_flags_t pl_flags,
40 const fib_route_path_t *paths)
42 src->fes_pl = fib_path_list_create((FIB_PATH_LIST_FLAG_SHARED | pl_flags),
47 fib_entry_src_lisp_path_add (fib_entry_src_t *src,
48 const fib_entry_t *entry,
49 fib_path_list_flags_t pl_flags,
50 const fib_route_path_t *paths)
52 if (FIB_NODE_INDEX_INVALID == src->fes_pl)
55 fib_path_list_create((FIB_PATH_LIST_FLAG_SHARED | pl_flags), paths);
60 fib_path_list_copy_and_path_add(src->fes_pl,
61 (FIB_PATH_LIST_FLAG_SHARED | pl_flags),
67 fib_entry_src_lisp_path_remove (fib_entry_src_t *src,
68 fib_path_list_flags_t pl_flags,
69 const fib_route_path_t *paths)
71 if (FIB_NODE_INDEX_INVALID != src->fes_pl)
74 fib_path_list_copy_and_path_remove(src->fes_pl,
75 (FIB_PATH_LIST_FLAG_SHARED | pl_flags),
81 fib_entry_src_lisp_add (fib_entry_src_t *src,
82 const fib_entry_t *entry,
83 fib_entry_flag_t flags,
87 if (FIB_ENTRY_FLAG_NONE != flags)
89 src->fes_pl = fib_path_list_create_special(
91 fib_entry_src_flags_2_path_list_flags(flags),
97 fib_entry_src_lisp_remove (fib_entry_src_t *src)
99 src->fes_pl = FIB_NODE_INDEX_INVALID;
103 fib_entry_src_lisp_set_data (fib_entry_src_t *src,
104 const fib_entry_t *entry,
107 src->u.lisp.fesl_fib_index = *(u32*)data;
111 fib_entry_src_lisp_get_data (fib_entry_src_t *src,
112 const fib_entry_t *entry)
114 return (&(src->u.lisp.fesl_fib_index));
117 const static fib_entry_src_vft_t lisp_src_vft = {
118 .fesv_init = fib_entry_src_lisp_init,
119 .fesv_deinit = fib_entry_src_lisp_deinit,
120 .fesv_add = fib_entry_src_lisp_add,
121 .fesv_remove = fib_entry_src_lisp_remove,
122 .fesv_path_add = fib_entry_src_lisp_path_add,
123 .fesv_path_swap = fib_entry_src_lisp_path_swap,
124 .fesv_path_remove = fib_entry_src_lisp_path_remove,
125 .fesv_set_data = fib_entry_src_lisp_set_data,
126 .fesv_get_data = fib_entry_src_lisp_get_data,
130 fib_entry_src_lisp_register (void)
132 fib_entry_src_behaviour_register(FIB_SOURCE_BH_LISP,