LCOV - code coverage report
Current view: top level - vnet/mfib - mfib_entry_src.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 25 29 86.2 %
Date: 2023-10-26 01:39:38 Functions: 8 10 80.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2018 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             : 
      17             : #include <vnet/mfib/mfib_entry_src.h>
      18             : 
      19             : static mfib_entry_src_vft mfib_entry_src_vfts[MFIB_N_SOURCES];
      20             : 
      21             : static void
      22        4029 : mfib_entry_src_default_deactiviate (mfib_entry_t *mfib_entry,
      23             :                                     mfib_entry_src_t *msrc)
      24             : {
      25        4029 : }
      26             : 
      27             : static void
      28        8738 : mfib_entry_src_default_activiate (mfib_entry_t *mfib_entry,
      29             :                                   mfib_entry_src_t *msrc)
      30             : {
      31        8738 : }
      32             : 
      33             : static mfib_src_res_t
      34           0 : mfib_entry_src_default_cover_change (mfib_entry_t *mfib_entry,
      35             :                                      mfib_entry_src_t *msrc)
      36             : {
      37           0 :     return (MFIB_SRC_OK);
      38             : }
      39             : 
      40             : static mfib_src_res_t
      41           0 : mfib_entry_src_default_cover_update (mfib_entry_t *mfib_entry,
      42             :                                      mfib_entry_src_t *msrc)
      43             : {
      44           0 :     return (MFIB_SRC_OK);
      45             : }
      46             : 
      47             : void
      48        9775 : mfib_entry_src_register (mfib_source_t source,
      49             :                          const mfib_entry_src_vft *mvft)
      50             : {
      51        9775 :     mfib_entry_src_vfts[source] = *mvft;
      52        9775 : }
      53             : 
      54             : void
      55       16801 : mfib_entry_src_deactivate (mfib_entry_t *mfib_entry,
      56             :                            mfib_entry_src_t *msrc)
      57             : {
      58       16801 :     if (NULL != msrc)
      59        4035 :         mfib_entry_src_vfts[msrc->mfes_src].mev_deactivate(mfib_entry, msrc);
      60       16801 : }
      61             : 
      62             : void
      63        8742 : mfib_entry_src_activate (mfib_entry_t *mfib_entry,
      64             :                          mfib_entry_src_t *msrc)
      65             : {
      66        8742 :     if (NULL != msrc)
      67        8742 :         mfib_entry_src_vfts[msrc->mfes_src].mev_activate(mfib_entry, msrc);
      68        8742 : }
      69             : 
      70             : mfib_src_res_t
      71           4 : mfib_entry_src_cover_change (mfib_entry_t *mfib_entry,
      72             :                              mfib_entry_src_t *msrc)
      73             : {
      74           4 :     return (mfib_entry_src_vfts[msrc->mfes_src].mev_cover_change(mfib_entry, msrc));
      75             : }
      76             : 
      77             : mfib_src_res_t
      78          18 : mfib_entry_src_cover_update (mfib_entry_t *mfib_entry,
      79             :                              mfib_entry_src_t *msrc)
      80             : {
      81          18 :     return (mfib_entry_src_vfts[msrc->mfes_src].mev_cover_update(mfib_entry, msrc));
      82             : }
      83             : 
      84             : void
      85         575 : mfib_entry_src_module_init (void)
      86             : {
      87         575 :     mfib_entry_src_vft mvft = {
      88             :         .mev_activate = mfib_entry_src_default_activiate,
      89             :         .mev_deactivate = mfib_entry_src_default_deactiviate,
      90             :         .mev_cover_change = mfib_entry_src_default_cover_change,
      91             :         .mev_cover_update = mfib_entry_src_default_cover_update,
      92             :     };
      93             :     mfib_source_t source;
      94             : 
      95        9775 :     FOREACH_MFIB_SOURCE(source)
      96             :     {
      97        9200 :         mfib_entry_src_register(source, &mvft);
      98             :     }
      99             : 
     100         575 :     mfib_entry_src_rr_module_init();
     101         575 : }

Generated by: LCOV version 1.14