Neale Ranns | 0053de6 | 2018-05-22 08:40:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 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 | #ifndef __ARP_H__ |
| 17 | #define __ARP_H__ |
| 18 | |
| 19 | #include <vnet/ethernet/ethernet.h> |
| 20 | #include <vnet/ethernet/arp_packet.h> |
| 21 | #include <vnet/ip/ip.h> |
Neale Ranns | 3702930 | 2018-08-10 05:30:06 -0700 | [diff] [blame] | 22 | #include <vnet/ip/ip_neighbor.h> |
| 23 | |
| 24 | typedef struct |
| 25 | { |
| 26 | u32 sw_if_index; |
| 27 | ip4_address_t ip4_address; |
| 28 | |
| 29 | mac_address_t mac; |
| 30 | |
| 31 | ip_neighbor_flags_t flags; |
| 32 | |
| 33 | f64 time_last_updated; |
| 34 | |
| 35 | /** |
| 36 | * The index of the adj-fib entry created |
| 37 | */ |
| 38 | fib_node_index_t fib_entry_index; |
| 39 | } ethernet_arp_ip4_entry_t; |
| 40 | |
| 41 | extern u8 *format_ethernet_arp_ip4_entry (u8 * s, va_list * va); |
| 42 | |
| 43 | ethernet_arp_ip4_entry_t *ip4_neighbors_pool (void); |
| 44 | ethernet_arp_ip4_entry_t *ip4_neighbor_entries (u32 sw_if_index); |
Neale Ranns | 0053de6 | 2018-05-22 08:40:52 -0700 | [diff] [blame] | 45 | |
| 46 | extern int vnet_proxy_arp_add_del (ip4_address_t * lo_addr, |
| 47 | ip4_address_t * hi_addr, |
| 48 | u32 fib_index, int is_del); |
| 49 | |
Neale Ranns | 57e53bb | 2019-05-29 13:58:43 +0000 | [diff] [blame] | 50 | extern int vnet_proxy_arp_enable_disable (vnet_main_t * vnm, |
| 51 | u32 sw_if_index, u8 enable); |
| 52 | |
Neale Ranns | 0053de6 | 2018-05-22 08:40:52 -0700 | [diff] [blame] | 53 | extern int vnet_arp_set_ip4_over_ethernet (vnet_main_t * vnm, |
| 54 | u32 sw_if_index, |
Neale Ranns | cf7efe0 | 2018-09-24 08:34:11 +0000 | [diff] [blame] | 55 | const |
| 56 | ethernet_arp_ip4_over_ethernet_address_t |
Neale Ranns | 3702930 | 2018-08-10 05:30:06 -0700 | [diff] [blame] | 57 | * a, ip_neighbor_flags_t flags); |
Neale Ranns | 0053de6 | 2018-05-22 08:40:52 -0700 | [diff] [blame] | 58 | |
| 59 | extern int vnet_arp_unset_ip4_over_ethernet (vnet_main_t * vnm, |
Neale Ranns | cf7efe0 | 2018-09-24 08:34:11 +0000 | [diff] [blame] | 60 | u32 sw_if_index, |
| 61 | const |
| 62 | ethernet_arp_ip4_over_ethernet_address_t |
| 63 | * a); |
Neale Ranns | 0053de6 | 2018-05-22 08:40:52 -0700 | [diff] [blame] | 64 | |
| 65 | extern int vnet_proxy_arp_fib_reset (u32 fib_id); |
| 66 | |
Neale Ranns | 3702930 | 2018-08-10 05:30:06 -0700 | [diff] [blame] | 67 | void vnet_register_ip4_arp_resolution_event (vnet_main_t * vnm, |
| 68 | void *address_arg, |
| 69 | uword node_index, |
| 70 | uword type_opaque, uword data); |
| 71 | |
| 72 | typedef int (*arp_change_event_cb_t) (u32 pool_index, |
| 73 | const mac_address_t * mac, |
| 74 | u32 sw_if_index, |
| 75 | const ip4_address_t * address); |
| 76 | |
| 77 | int vnet_add_del_ip4_arp_change_event (vnet_main_t * vnm, |
| 78 | arp_change_event_cb_t data_callback, |
| 79 | u32 pid, |
| 80 | void *address_arg, |
| 81 | uword node_index, |
| 82 | uword type_opaque, |
| 83 | uword data, int is_add); |
| 84 | |
| 85 | void wc_arp_set_publisher_node (uword inode_index, uword event_type); |
| 86 | |
| 87 | void ethernet_arp_change_mac (u32 sw_if_index); |
| 88 | void ethernet_ndp_change_mac (u32 sw_if_index); |
| 89 | |
| 90 | void arp_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai); |
| 91 | |
| 92 | typedef struct |
| 93 | { |
| 94 | u32 sw_if_index; |
| 95 | ip4_address_t ip; |
| 96 | mac_address_t mac; |
| 97 | } wc_arp_report_t; |
| 98 | |
Neale Ranns | 0053de6 | 2018-05-22 08:40:52 -0700 | [diff] [blame] | 99 | /** |
| 100 | * call back function when walking the DB of proxy ARPs |
| 101 | * @return 0 to stop the walk !0 to continue |
| 102 | */ |
| 103 | typedef walk_rc_t (proxy_arp_walk_t) (const ip4_address_t * lo_addr, |
| 104 | const ip4_address_t * hi_addr, |
| 105 | u32 fib_index, void *dat); |
| 106 | |
| 107 | extern void proxy_arp_walk (proxy_arp_walk_t cb, void *data); |
| 108 | |
Neale Ranns | 57e53bb | 2019-05-29 13:58:43 +0000 | [diff] [blame] | 109 | /** |
| 110 | * call back function when walking the DB of proxy ARP interface |
| 111 | * @return 0 to stop the walk !0 to continue |
| 112 | */ |
| 113 | typedef walk_rc_t (proxy_arp_intf_walk_t) (u32 sw_if_index, void *data); |
| 114 | |
| 115 | extern void proxy_arp_intfc_walk (proxy_arp_intf_walk_t cb, void *data); |
| 116 | |
Neale Ranns | 0053de6 | 2018-05-22 08:40:52 -0700 | [diff] [blame] | 117 | #endif |
| 118 | |
| 119 | /* |
| 120 | * fd.io coding-style-patch-verification: ON |
| 121 | * |
| 122 | * Local Variables: |
| 123 | * eval: (c-set-style "gnu") |
| 124 | * End: |
| 125 | */ |