Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [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 | /** |
| 17 | * @brief Mcast Adjacency |
| 18 | * |
| 19 | * The multicast adjacency forwards IP traffic on an interface toward a multicast |
| 20 | * group address. This is a different type of adjacency to a unicast adjacency |
| 21 | * since the application of the MAC header is different, and so the VLIB node |
| 22 | * visited is also different. DPO types have different VLIB nodes. |
| 23 | */ |
| 24 | |
| 25 | #ifndef __ADJ_MCAST_H__ |
| 26 | #define __ADJ_MCAST_H__ |
| 27 | |
| 28 | #include <vnet/adj/adj_types.h> |
| 29 | |
| 30 | /** |
| 31 | * @brief |
| 32 | * Add (and lock) a new or lock an existing mcast adjacency |
| 33 | * |
| 34 | * @param proto |
| 35 | * The protocol for the neighbours that we wish to mcast |
| 36 | * |
| 37 | * @param link_type |
| 38 | * A description of the protocol of the packets that will forward |
| 39 | * through this adj. On an ethernet interface this is the MAC header's |
| 40 | * ether-type |
| 41 | * |
| 42 | * @param sw_if_index |
| 43 | * The interface on which to mcast |
| 44 | */ |
| 45 | extern adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, |
| 46 | vnet_link_t link_type, |
| 47 | u32 sw_if_index); |
| 48 | |
| 49 | /** |
| 50 | * @brief |
| 51 | * Update the rewrite string for an existing adjacecny. |
| 52 | * |
| 53 | * @param |
| 54 | * The index of the adj to update |
| 55 | * |
| 56 | * @param |
| 57 | * The new rewrite |
Neale Ranns | 2e7fbcc | 2017-03-15 04:22:25 -0700 | [diff] [blame] | 58 | * |
| 59 | * @param |
| 60 | * The offset in the rewrite a which to write in packet's |
| 61 | * IP Address |
| 62 | * |
| 63 | * @param |
| 64 | * The mask to apply to the packet berfore the rewrite. |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 65 | */ |
| 66 | extern void adj_mcast_update_rewrite(adj_index_t adj_index, |
Neale Ranns | 2e7fbcc | 2017-03-15 04:22:25 -0700 | [diff] [blame] | 67 | u8 *rewrite, |
| 68 | u8 offset, |
| 69 | u32 mask); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * @brief Format/display a mcast adjacency. |
| 73 | */ |
| 74 | extern u8* format_adj_mcast(u8* s, va_list *ap); |
| 75 | |
| 76 | /** |
| 77 | * @brief Get the sze of the mcast adj DB. Test purposes only. |
| 78 | */ |
| 79 | extern u32 adj_mcast_db_size(void); |
| 80 | |
| 81 | /** |
| 82 | * @brief |
| 83 | * Module initialisation |
| 84 | */ |
| 85 | extern void adj_mcast_module_init(void); |
| 86 | |
| 87 | #endif |