Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 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 | fib_entry_src_special_init (fib_entry_src_t *src) |
| 24 | { |
Neale Ranns | 450cd30 | 2016-11-09 17:49:42 +0000 | [diff] [blame] | 25 | src->fes_flags = FIB_ENTRY_SRC_FLAG_NONE; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Source deinitialisation Function |
| 30 | */ |
| 31 | static void |
| 32 | fib_entry_src_special_deinit (fib_entry_src_t *src) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | static void |
| 37 | fib_entry_src_special_remove (fib_entry_src_t *src) |
| 38 | { |
| 39 | src->fes_pl = FIB_NODE_INDEX_INVALID; |
| 40 | } |
| 41 | |
| 42 | static void |
| 43 | fib_entry_src_special_add (fib_entry_src_t *src, |
| 44 | const fib_entry_t *entry, |
| 45 | fib_entry_flag_t flags, |
| 46 | fib_protocol_t proto, |
| 47 | const dpo_id_t *dpo) |
| 48 | { |
| 49 | src->fes_pl = |
| 50 | fib_path_list_create_special(proto, |
| 51 | fib_entry_src_flags_2_path_list_flags(flags), |
| 52 | dpo); |
| 53 | } |
| 54 | |
| 55 | const static fib_entry_src_vft_t special_src_vft = { |
| 56 | .fesv_init = fib_entry_src_special_init, |
| 57 | .fesv_deinit = fib_entry_src_special_deinit, |
| 58 | .fesv_add = fib_entry_src_special_add, |
| 59 | .fesv_remove = fib_entry_src_special_remove, |
| 60 | }; |
| 61 | |
| 62 | void |
| 63 | fib_entry_src_special_register (void) |
| 64 | { |
| 65 | fib_entry_src_register(FIB_SOURCE_SPECIAL, &special_src_vft); |
| 66 | fib_entry_src_register(FIB_SOURCE_MAP, &special_src_vft); |
| 67 | fib_entry_src_register(FIB_SOURCE_SIXRD, &special_src_vft); |
| 68 | fib_entry_src_register(FIB_SOURCE_CLASSIFY, &special_src_vft); |
| 69 | fib_entry_src_register(FIB_SOURCE_SR, &special_src_vft); |
| 70 | fib_entry_src_register(FIB_SOURCE_AE, &special_src_vft); |
| 71 | } |