]> git.proxmox.com Git - mirror_frr.git/blame - lib/bfd.h
BGP: At exit, remove callbacks before invoking vrf_terminate()
[mirror_frr.git] / lib / bfd.h
CommitLineData
7f342629
DS
1/**
2 * bfd.h: BFD definitions and structures
3 *
4 * @copyright Copyright (C) 2015 Cumulus Networks, Inc.
5 *
6 * This file is part of GNU Zebra.
7 *
8 * GNU Zebra is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * GNU Zebra is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with GNU Zebra; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 * 02111-1307, USA.
22 */
23
24#ifndef _ZEBRA_BFD_H
25#define _ZEBRA_BFD_H
26
68fe91d6 27#include "lib/json.h"
28
7f342629
DS
29#define BFD_CMD_DETECT_MULT_RANGE "<2-255> "
30#define BFD_CMD_MIN_RX_RANGE "<50-60000> "
31#define BFD_CMD_MIN_TX_RANGE "<50-60000>"
986aa00f 32#define BFD_CMD_TYPE "(multihop|singlehop)"
7f342629
DS
33
34#define BFD_DEF_MIN_RX 300
35#define BFD_MIN_MIN_RX 50
36#define BFD_MAX_MIN_RX 60000
37#define BFD_DEF_MIN_TX 300
38#define BFD_MIN_MIN_TX 50
39#define BFD_MAX_MIN_TX 60000
40#define BFD_DEF_DETECT_MULT 3
41#define BFD_MIN_DETECT_MULT 2
42#define BFD_MAX_DETECT_MULT 255
43
44#define BFD_FLAG_PARAM_CFG (1 << 0) /* parameters have been configured */
45#define BFD_FLAG_BFD_REG (1 << 1) /* Peer registered with BFD */
986aa00f 46#define BFD_FLAG_BFD_TYPE_MULTIHOP (1 << 2) /* Peer registered with BFD as multihop */
7f342629 47
68fe91d6 48#define BFD_STATUS_UNKNOWN (1 << 0) /* BFD session status never received */
49#define BFD_STATUS_DOWN (1 << 1) /* BFD session status is down */
50#define BFD_STATUS_UP (1 << 2) /* BFD session status is up */
51
986aa00f 52enum bfd_sess_type {
53 BFD_TYPE_NOT_CONFIGURED,
54 BFD_TYPE_SINGLEHOP,
55 BFD_TYPE_MULTIHOP
56};
57
7f342629
DS
58struct bfd_info
59{
986aa00f 60 u_int16_t flags;
61 u_int8_t detect_mult;
62 u_int32_t desired_min_tx;
63 u_int32_t required_min_rx;
64 time_t last_update;
65 u_int8_t status;
66 enum bfd_sess_type type;
7f342629
DS
67};
68
69extern struct bfd_info *
70bfd_info_create(void);
71
72extern void
88177fe3 73bfd_info_free(struct bfd_info **bfd_info);
7f342629
DS
74
75extern int
76bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str,
77 const char *tx_str, u_int8_t *dm_val, u_int32_t *rx_val,
78 u_int32_t *tx_val);
79
80extern void
81bfd_set_param (struct bfd_info **bfd_info, u_int32_t min_rx, u_int32_t min_tx,
82 u_int8_t detect_mult, int defaults, int *command);
83extern void
84bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info,
85 int family, void *dst_ip, void *src_ip, char *if_name,
7076bb2f
FL
86 int ttl, int multihop, int command, int set_flag,
87 vrf_id_t vrf_id);
7f342629
DS
88
89extern const char *
90bfd_get_command_dbg_str(int command);
91
92extern struct interface *
68fe91d6 93bfd_get_peer_info (struct stream *s, struct prefix *dp, struct prefix *sp,
1e22a2af 94 int *status, vrf_id_t vrf_id);
68fe91d6 95
96const char *
97bfd_get_status_str(int status);
98
99extern void
100bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag,
101 int extra_space, u_char use_json, json_object *json_obj);
102
103extern void
104bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop,
105 int extra_space, u_char use_json, json_object *json_obj);
7f342629 106
055c4dfc 107extern void
108bfd_client_sendmsg (struct zclient *zclient, int command);
109
7f342629 110#endif /* _ZEBRA_BFD_H */