FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
mfib_entry_src.c
Go to the documentation of this file.
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 
18 
19 static mfib_entry_src_vft mfib_entry_src_vfts[MFIB_N_SOURCES];
20 
21 static void
23  mfib_entry_src_t *msrc)
24 {
25 }
26 
27 static void
29  mfib_entry_src_t *msrc)
30 {
31 }
32 
33 static mfib_src_res_t
35  mfib_entry_src_t *msrc)
36 {
37  return (MFIB_SRC_OK);
38 }
39 
40 static mfib_src_res_t
42  mfib_entry_src_t *msrc)
43 {
44  return (MFIB_SRC_OK);
45 }
46 
47 void
49  const mfib_entry_src_vft *mvft)
50 {
51  mfib_entry_src_vfts[source] = *mvft;
52 }
53 
54 void
56  mfib_entry_src_t *msrc)
57 {
58  if (NULL != msrc)
59  mfib_entry_src_vfts[msrc->mfes_src].mev_deactivate(mfib_entry, msrc);
60 }
61 
62 void
64  mfib_entry_src_t *msrc)
65 {
66  if (NULL != msrc)
67  mfib_entry_src_vfts[msrc->mfes_src].mev_activate(mfib_entry, msrc);
68 }
69 
72  mfib_entry_src_t *msrc)
73 {
74  return (mfib_entry_src_vfts[msrc->mfes_src].mev_cover_change(mfib_entry, msrc));
75 }
76 
79  mfib_entry_src_t *msrc)
80 {
81  return (mfib_entry_src_vfts[msrc->mfes_src].mev_cover_update(mfib_entry, msrc));
82 }
83 
84 void
86 {
87  mfib_entry_src_vft mvft = {
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  FOREACH_MFIB_SOURCE(source)
96  {
97  mfib_entry_src_register(source, &mvft);
98  }
99 
101 }
mfib_entry_src_cover_change_t mev_cover_change
mfib_entry_src_cover_update_t mev_cover_update
void mfib_entry_src_register(mfib_source_t source, const mfib_entry_src_vft *mvft)
#define NULL
Definition: clib.h:58
An entry in a FIB table.
Definition: mfib_entry.h:32
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
The source of an MFIB entry.
mfib_source_t mfes_src
Which source this is.
#define FOREACH_MFIB_SOURCE(_ms)
Definition: mfib_types.h:196
void mfib_entry_src_deactivate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
static void mfib_entry_src_default_deactiviate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
#define MFIB_N_SOURCES
Definition: mfib_types.h:201
void mfib_entry_src_rr_module_init(void)
static void mfib_entry_src_default_activiate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
mfib_entry_src_activiate_t mev_activate
enum mfib_src_res_t_ mfib_src_res_t
signals from the sources to the caller
mfib_src_res_t mfib_entry_src_cover_update(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
mfib_entry_src_deactiviate_t mev_deactivate
mfib_src_res_t mfib_entry_src_cover_change(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
Virtual function table provided by each_source.
void mfib_entry_src_activate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
static mfib_src_res_t mfib_entry_src_default_cover_change(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
void mfib_entry_src_module_init(void)
static mfib_src_res_t mfib_entry_src_default_cover_update(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)