]> git.proxmox.com Git - mirror_frr.git/blob - lib/bfd.h
Merge pull request #1961 from qlyoung/docuser
[mirror_frr.git] / lib / bfd.h
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 along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef _ZEBRA_BFD_H
24 #define _ZEBRA_BFD_H
25
26 #include "lib/json.h"
27
28 #define BFD_DEF_MIN_RX 300
29 #define BFD_MIN_MIN_RX 50
30 #define BFD_MAX_MIN_RX 60000
31 #define BFD_DEF_MIN_TX 300
32 #define BFD_MIN_MIN_TX 50
33 #define BFD_MAX_MIN_TX 60000
34 #define BFD_DEF_DETECT_MULT 3
35 #define BFD_MIN_DETECT_MULT 2
36 #define BFD_MAX_DETECT_MULT 255
37
38 #define BFD_GBL_FLAG_IN_SHUTDOWN (1 << 0) /* The daemon in shutdown */
39 struct bfd_gbl {
40 uint16_t flags;
41 };
42
43 #define BFD_FLAG_PARAM_CFG (1 << 0) /* parameters have been configured */
44 #define BFD_FLAG_BFD_REG (1 << 1) /* Peer registered with BFD */
45 #define BFD_FLAG_BFD_TYPE_MULTIHOP (1 << 2) /* Peer registered with BFD as multihop */
46
47 #define BFD_STATUS_UNKNOWN (1 << 0) /* BFD session status never received */
48 #define BFD_STATUS_DOWN (1 << 1) /* BFD session status is down */
49 #define BFD_STATUS_UP (1 << 2) /* BFD session status is up */
50
51 enum bfd_sess_type {
52 BFD_TYPE_NOT_CONFIGURED,
53 BFD_TYPE_SINGLEHOP,
54 BFD_TYPE_MULTIHOP
55 };
56
57 struct bfd_info {
58 uint16_t flags;
59 uint8_t detect_mult;
60 uint32_t desired_min_tx;
61 uint32_t required_min_rx;
62 time_t last_update;
63 uint8_t status;
64 enum bfd_sess_type type;
65 };
66
67 extern struct bfd_info *bfd_info_create(void);
68
69 extern void bfd_info_free(struct bfd_info **bfd_info);
70
71 extern int bfd_validate_param(struct vty *vty, const char *dm_str,
72 const char *rx_str, const char *tx_str,
73 uint8_t *dm_val, uint32_t *rx_val,
74 uint32_t *tx_val);
75
76 extern void bfd_set_param(struct bfd_info **bfd_info, uint32_t min_rx,
77 uint32_t min_tx, uint8_t detect_mult, int defaults,
78 int *command);
79 extern void bfd_peer_sendmsg(struct zclient *zclient, struct bfd_info *bfd_info,
80 int family, void *dst_ip, void *src_ip,
81 char *if_name, int ttl, int multihop, int command,
82 int set_flag, vrf_id_t vrf_id);
83
84 extern const char *bfd_get_command_dbg_str(int command);
85
86 extern struct interface *bfd_get_peer_info(struct stream *s, struct prefix *dp,
87 struct prefix *sp, int *status,
88 vrf_id_t vrf_id);
89
90 const char *bfd_get_status_str(int status);
91
92 extern void bfd_show_param(struct vty *vty, struct bfd_info *bfd_info,
93 int bfd_tag, int extra_space, uint8_t use_json,
94 json_object *json_obj);
95
96 extern void bfd_show_info(struct vty *vty, struct bfd_info *bfd_info,
97 int multihop, int extra_space, uint8_t use_json,
98 json_object *json_obj);
99
100 extern void bfd_client_sendmsg(struct zclient *zclient, int command);
101
102 extern void bfd_gbl_init(void);
103
104 extern void bfd_gbl_exit(void);
105
106 #endif /* _ZEBRA_BFD_H */