]> git.proxmox.com Git - mirror_frr.git/blob - lib/bfd.h
*: add VRF ID in the API message header
[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_CMD_DETECT_MULT_RANGE "<2-255> "
30 #define BFD_CMD_MIN_RX_RANGE "<50-60000> "
31 #define BFD_CMD_MIN_TX_RANGE "<50-60000>"
32
33 #define BFD_DEF_MIN_RX 300
34 #define BFD_MIN_MIN_RX 50
35 #define BFD_MAX_MIN_RX 60000
36 #define BFD_DEF_MIN_TX 300
37 #define BFD_MIN_MIN_TX 50
38 #define BFD_MAX_MIN_TX 60000
39 #define BFD_DEF_DETECT_MULT 3
40 #define BFD_MIN_DETECT_MULT 2
41 #define BFD_MAX_DETECT_MULT 255
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
46 #define BFD_STATUS_UNKNOWN (1 << 0) /* BFD session status never received */
47 #define BFD_STATUS_DOWN (1 << 1) /* BFD session status is down */
48 #define BFD_STATUS_UP (1 << 2) /* BFD session status is up */
49
50 struct bfd_info
51 {
52 u_int16_t flags;
53 u_int8_t detect_mult;
54 u_int32_t desired_min_tx;
55 u_int32_t required_min_rx;
56 time_t last_update;
57 u_int8_t status;
58 };
59
60 extern struct bfd_info *
61 bfd_info_create(void);
62
63 extern void
64 bfd_info_free(struct bfd_info **bfd_info);
65
66 extern int
67 bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str,
68 const char *tx_str, u_int8_t *dm_val, u_int32_t *rx_val,
69 u_int32_t *tx_val);
70
71 extern void
72 bfd_set_param (struct bfd_info **bfd_info, u_int32_t min_rx, u_int32_t min_tx,
73 u_int8_t detect_mult, int defaults, int *command);
74 extern void
75 bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info,
76 int family, void *dst_ip, void *src_ip, char *if_name,
77 int ttl, int multihop, int command, int set_flag,
78 vrf_id_t vrf_id);
79
80 extern const char *
81 bfd_get_command_dbg_str(int command);
82
83 extern struct interface *
84 bfd_get_peer_info (struct stream *s, struct prefix *dp, struct prefix *sp,
85 int *status);
86
87 const char *
88 bfd_get_status_str(int status);
89
90 extern void
91 bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag,
92 int extra_space, u_char use_json, json_object *json_obj);
93
94 extern void
95 bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop,
96 int extra_space, u_char use_json, json_object *json_obj);
97
98 #endif /* _ZEBRA_BFD_H */