blob: f051e6b679cc4dddcca0dac269c749542485b441 [file] [log] [blame]
Klement Sekera0e3c0de2016-09-29 14:43:44 +02001/*
2 * Copyright (c) 2011-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 * @file
Klement Sekerab16bfe32017-02-28 11:56:48 +010017 * @brief BFD API declarations
Klement Sekera0e3c0de2016-09-29 14:43:44 +020018 */
19#ifndef __included_bfd_api_h__
20#define __included_bfd_api_h__
21
22#include <vnet/api_errno.h>
23#include <vnet/vnet.h>
Neale Rannscbe25aa2019-09-30 10:53:31 +000024#include <vnet/ip/ip46_address.h>
Klement Sekera0e3c0de2016-09-29 14:43:44 +020025
Klement Sekera239790f2017-02-16 10:53:53 +010026#define foreach_bfd_transport(F) \
27 F (UDP4, "ip4-rewrite") \
28 F (UDP6, "ip6-rewrite")
29
30typedef enum
31{
32#define F(t, n) BFD_TRANSPORT_##t,
33 foreach_bfd_transport (F)
34#undef F
35} bfd_transport_e;
36
Klement Sekerab16bfe32017-02-28 11:56:48 +010037/**
38 * @brief create a new bfd session
39 */
Klement Sekerab17dd962017-01-09 07:43:48 +010040vnet_api_error_t
41bfd_udp_add_session (u32 sw_if_index, const ip46_address_t * local_addr,
Klement Sekeraa57a9702017-02-02 06:58:07 +010042 const ip46_address_t * peer_addr,
43 u32 desired_min_tx_usec, u32 required_min_rx_usec,
44 u8 detect_mult, u8 is_authenticated, u32 conf_key_id,
45 u8 bfd_key_id);
46
Klement Sekerab16bfe32017-02-28 11:56:48 +010047/**
Neale Ranns63f2c7d2022-02-09 13:47:29 +000048 * @brief create a new or modify and existing bfd session
49 */
50vnet_api_error_t
51bfd_udp_upd_session (u32 sw_if_index, const ip46_address_t *local_addr,
52 const ip46_address_t *peer_addr, u32 desired_min_tx_usec,
53 u32 required_min_rx_usec, u8 detect_mult,
54 u8 is_authenticated, u32 conf_key_id, u8 bfd_key_id);
55
56/**
Klement Sekerab16bfe32017-02-28 11:56:48 +010057 * @brief modify existing session
58 */
Klement Sekera239790f2017-02-16 10:53:53 +010059vnet_api_error_t
60bfd_udp_mod_session (u32 sw_if_index, const ip46_address_t * local_addr,
61 const ip46_address_t * peer_addr,
62 u32 desired_min_tx_usec, u32 required_min_rx_usec,
63 u8 detect_mult);
Klement Sekera0e3c0de2016-09-29 14:43:44 +020064
Klement Sekerab16bfe32017-02-28 11:56:48 +010065/**
66 * @brief delete existing session
67 */
Klement Sekera0e3c0de2016-09-29 14:43:44 +020068vnet_api_error_t bfd_udp_del_session (u32 sw_if_index,
69 const ip46_address_t * local_addr,
70 const ip46_address_t * peer_addr);
71
Klement Sekerab16bfe32017-02-28 11:56:48 +010072/**
73 * @brief set session admin down/up
74 */
Klement Sekeraa3167442020-02-10 11:49:52 +000075vnet_api_error_t bfd_udp_session_set_flags (vlib_main_t * vm, u32 sw_if_index,
Klement Sekerab17dd962017-01-09 07:43:48 +010076 const ip46_address_t * local_addr,
77 const ip46_address_t * peer_addr,
78 u8 admin_up_down);
79
Klement Sekerab16bfe32017-02-28 11:56:48 +010080/**
81 * @brief create or modify bfd authentication key
82 */
Klement Sekerab17dd962017-01-09 07:43:48 +010083vnet_api_error_t bfd_auth_set_key (u32 conf_key_id, u8 auth_type, u8 key_len,
84 const u8 * key);
85
Klement Sekerab16bfe32017-02-28 11:56:48 +010086/**
87 * @brief delete existing authentication key
88 */
Klement Sekerab17dd962017-01-09 07:43:48 +010089vnet_api_error_t bfd_auth_del_key (u32 conf_key_id);
90
Klement Sekerab16bfe32017-02-28 11:56:48 +010091/**
92 * @brief activate authentication for existing session
93 */
Klement Sekerab17dd962017-01-09 07:43:48 +010094vnet_api_error_t bfd_udp_auth_activate (u32 sw_if_index,
95 const ip46_address_t * local_addr,
96 const ip46_address_t * peer_addr,
97 u32 conf_key_id, u8 bfd_key_id,
98 u8 is_delayed);
99
Klement Sekerab16bfe32017-02-28 11:56:48 +0100100/**
101 * @brief deactivate authentication for existing session
102 */
Klement Sekerab17dd962017-01-09 07:43:48 +0100103vnet_api_error_t bfd_udp_auth_deactivate (u32 sw_if_index,
104 const ip46_address_t * local_addr,
105 const ip46_address_t * peer_addr,
106 u8 is_delayed);
Klement Sekera0e3c0de2016-09-29 14:43:44 +0200107
Klement Sekerab16bfe32017-02-28 11:56:48 +0100108/**
109 * @brief set echo-source interface
110 */
Klement Sekera239790f2017-02-16 10:53:53 +0100111vnet_api_error_t bfd_udp_set_echo_source (u32 loopback_sw_if_index);
112
Klement Sekerab16bfe32017-02-28 11:56:48 +0100113/**
114 * @brief unset echo-source interface
115 */
Klement Sekera239790f2017-02-16 10:53:53 +0100116vnet_api_error_t bfd_udp_del_echo_source ();
117
Klement Sekera0e3c0de2016-09-29 14:43:44 +0200118#endif /* __included_bfd_api_h__ */
119
120/*
121 * fd.io coding-style-patch-verification: ON
122 *
123 * Local Variables:
124 * eval: (c-set-style "gnu")
125 * End:
126 */