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 |
Neale Ranns | 3bab8f9 | 2019-12-04 06:11:00 +0000 | [diff] [blame] | 23 | fib_entry_src_drop_init (fib_entry_src_t *src) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 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 | static void |
Neale Ranns | 3bab8f9 | 2019-12-04 06:11:00 +0000 | [diff] [blame] | 29 | fib_entry_src_drop_remove (fib_entry_src_t *src) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 30 | { |
| 31 | src->fes_pl = FIB_NODE_INDEX_INVALID; |
| 32 | } |
| 33 | |
| 34 | static void |
Neale Ranns | 3bab8f9 | 2019-12-04 06:11:00 +0000 | [diff] [blame] | 35 | fib_entry_src_drop_add (fib_entry_src_t *src, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 36 | const fib_entry_t *entry, |
| 37 | fib_entry_flag_t flags, |
Neale Ranns | da78f95 | 2017-05-24 09:15:43 -0700 | [diff] [blame] | 38 | dpo_proto_t proto, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 39 | const dpo_id_t *dpo) |
| 40 | { |
| 41 | src->fes_pl = fib_path_list_create_special(proto, |
| 42 | FIB_PATH_LIST_FLAG_DROP, |
| 43 | dpo); |
| 44 | } |
| 45 | |
Neale Ranns | 3bab8f9 | 2019-12-04 06:11:00 +0000 | [diff] [blame] | 46 | const static fib_entry_src_vft_t drop_src_vft = { |
| 47 | .fesv_init = fib_entry_src_drop_init, |
| 48 | .fesv_add = fib_entry_src_drop_add, |
| 49 | .fesv_remove = fib_entry_src_drop_remove, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | void |
Neale Ranns | 3bab8f9 | 2019-12-04 06:11:00 +0000 | [diff] [blame] | 53 | fib_entry_src_drop_register (void) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 54 | { |
Neale Ranns | 3bab8f9 | 2019-12-04 06:11:00 +0000 | [diff] [blame] | 55 | fib_entry_src_behaviour_register(FIB_SOURCE_BH_DROP, |
| 56 | &drop_src_vft); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | |