]> git.proxmox.com Git - mirror_frr.git/blob - lib/bfd.h
Merge remote-tracking branch 'origin/stable/2.0'
[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
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
27 #include "lib/json.h"
28
29 #define BFD_DEF_MIN_RX 300
30 #define BFD_MIN_MIN_RX 50
31 #define BFD_MAX_MIN_RX 60000
32 #define BFD_DEF_MIN_TX 300
33 #define BFD_MIN_MIN_TX 50
34 #define BFD_MAX_MIN_TX 60000
35 #define BFD_DEF_DETECT_MULT 3
36 #define BFD_MIN_DETECT_MULT 2
37 #define BFD_MAX_DETECT_MULT 255
38
39 #define BFD_GBL_FLAG_IN_SHUTDOWN (1 << 0) /* The daemon in shutdown */
40 struct bfd_gbl
41 {
42 u_int16_t flags;
43 };
44
45 #define BFD_FLAG_PARAM_CFG (1 << 0) /* parameters have been configured */
46 #define BFD_FLAG_BFD_REG (1 << 1) /* Peer registered with BFD */
47 #define BFD_FLAG_BFD_TYPE_MULTIHOP (1 << 2) /* Peer registered with BFD as multihop */
48
49 #define BFD_STATUS_UNKNOWN (1 << 0) /* BFD session status never received */
50 #define BFD_STATUS_DOWN (1 << 1) /* BFD session status is down */
51 #define BFD_STATUS_UP (1 << 2) /* BFD session status is up */
52
53 enum bfd_sess_type {
54 BFD_TYPE_NOT_CONFIGURED,
55 BFD_TYPE_SINGLEHOP,
56 BFD_TYPE_MULTIHOP
57 };
58
59 struct bfd_info
60 {
61 u_int16_t flags;
62 u_int8_t detect_mult;
63 u_int32_t desired_min_tx;
64 u_int32_t required_min_rx;
65 time_t last_update;
66 u_int8_t status;
67 enum bfd_sess_type type;
68 };
69
70 extern struct bfd_info *
71 bfd_info_create(void);
72
73 extern void
74 bfd_info_free(struct bfd_info **bfd_info);
75
76 extern int
77 bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str,
78 const char *tx_str, u_int8_t *dm_val, u_int32_t *rx_val,
79 u_int32_t *tx_val);
80
81 extern void
82 bfd_set_param (struct bfd_info **bfd_info, u_int32_t min_rx, u_int32_t min_tx,
83 u_int8_t detect_mult, int defaults, int *command);
84 extern void
85 bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info,
86 int family, void *dst_ip, void *src_ip, char *if_name,
87 int ttl, int multihop, int command, int set_flag,
88 vrf_id_t vrf_id);
89
90 extern const char *
91 bfd_get_command_dbg_str(int command);
92
93 extern struct interface *
94 bfd_get_peer_info (struct stream *s, struct prefix *dp, struct prefix *sp,
95 int *status, vrf_id_t vrf_id);
96
97 const char *
98 bfd_get_status_str(int status);
99
100 extern void
101 bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag,
102 int extra_space, u_char use_json, json_object *json_obj);
103
104 extern void
105 bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop,
106 int extra_space, u_char use_json, json_object *json_obj);
107
108 extern void
109 bfd_client_sendmsg (struct zclient *zclient, int command);
110
111 extern void
112 bfd_gbl_init(void);
113
114 extern void
115 bfd_gbl_exit(void);
116
117 #endif /* _ZEBRA_BFD_H */