LCOV - code coverage report
Current view: top level - vnet/fib - fib_entry_src_simple.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 18 18 100.0 %
Date: 2023-07-05 22:20:52 Functions: 6 6 100.0 %

          Line data    Source code
       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             : 
      19             : /**
      20             :  * Source initialisation Function
      21             :  */
      22             : static void
      23        5501 : fib_entry_src_simple_init (fib_entry_src_t *src)
      24             : {
      25        5501 :     src->fes_flags = FIB_ENTRY_SRC_FLAG_NONE;
      26        5501 : }
      27             : 
      28             : /**
      29             :  * Source deinitialisation Function
      30             :  */
      31             : static void
      32        3573 : fib_entry_src_simple_deinit (fib_entry_src_t *src)
      33             : {
      34        3573 : }
      35             : 
      36             : static void
      37        3573 : fib_entry_src_simple_remove (fib_entry_src_t *src)
      38             : {
      39        3573 :     src->fes_pl = FIB_NODE_INDEX_INVALID;
      40        3573 : }
      41             : 
      42             : static void
      43        5502 : fib_entry_src_simple_add (fib_entry_src_t *src,
      44             :                           const fib_entry_t *entry,
      45             :                           fib_entry_flag_t flags,
      46             :                           dpo_proto_t proto,
      47             :                           const dpo_id_t *dpo)
      48             : {
      49        5502 :     src->fes_pl =
      50        5502 :         fib_path_list_create_special(proto,
      51             :                                      fib_entry_src_flags_2_path_list_flags(flags),
      52             :                                      dpo);
      53        5502 : }
      54             : 
      55             : static void
      56        2525 : fib_entry_src_simple_path_swap (fib_entry_src_t *src,
      57             :                                 const fib_entry_t *entry,
      58             :                                 fib_path_list_flags_t pl_flags,
      59             :                                 const fib_route_path_t *rpaths)
      60             : {
      61        2525 :     src->fes_pl = fib_path_list_create((FIB_PATH_LIST_FLAG_SHARED | pl_flags),
      62             :                                        rpaths);
      63        2525 : }
      64             : 
      65             : const static fib_entry_src_vft_t simple_src_vft = {
      66             :     .fesv_init = fib_entry_src_simple_init,
      67             :     .fesv_deinit = fib_entry_src_simple_deinit,
      68             :     .fesv_add = fib_entry_src_simple_add,
      69             :     .fesv_remove = fib_entry_src_simple_remove,
      70             :     .fesv_path_swap = fib_entry_src_simple_path_swap,
      71             : };
      72             : 
      73             : void
      74         559 : fib_entry_src_simple_register (void)
      75             : {
      76         559 :     fib_entry_src_behaviour_register(FIB_SOURCE_BH_SIMPLE, &simple_src_vft);
      77         559 : }

Generated by: LCOV version 1.14