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:
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.
17 #include <vnet/mfib/mfib_entry_src.h>
19 static mfib_entry_src_vft mfib_entry_src_vfts[MFIB_N_SOURCES];
22 mfib_entry_src_default_deactiviate (mfib_entry_t *mfib_entry,
23 mfib_entry_src_t *msrc)
28 mfib_entry_src_default_activiate (mfib_entry_t *mfib_entry,
29 mfib_entry_src_t *msrc)
34 mfib_entry_src_default_cover_change (mfib_entry_t *mfib_entry,
35 mfib_entry_src_t *msrc)
41 mfib_entry_src_default_cover_update (mfib_entry_t *mfib_entry,
42 mfib_entry_src_t *msrc)
48 mfib_entry_src_register (mfib_source_t source,
49 const mfib_entry_src_vft *mvft)
51 mfib_entry_src_vfts[source] = *mvft;
55 mfib_entry_src_deactivate (mfib_entry_t *mfib_entry,
56 mfib_entry_src_t *msrc)
59 mfib_entry_src_vfts[msrc->mfes_src].mev_deactivate(mfib_entry, msrc);
63 mfib_entry_src_activate (mfib_entry_t *mfib_entry,
64 mfib_entry_src_t *msrc)
67 mfib_entry_src_vfts[msrc->mfes_src].mev_activate(mfib_entry, msrc);
71 mfib_entry_src_cover_change (mfib_entry_t *mfib_entry,
72 mfib_entry_src_t *msrc)
74 return (mfib_entry_src_vfts[msrc->mfes_src].mev_cover_change(mfib_entry, msrc));
78 mfib_entry_src_cover_update (mfib_entry_t *mfib_entry,
79 mfib_entry_src_t *msrc)
81 return (mfib_entry_src_vfts[msrc->mfes_src].mev_cover_update(mfib_entry, msrc));
85 mfib_entry_src_module_init (void)
87 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,
95 FOREACH_MFIB_SOURCE(source)
97 mfib_entry_src_register(source, &mvft);
100 mfib_entry_src_rr_module_init();