]>
Commit | Line | Data |
---|---|---|
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 | * | |
896014f4 DL |
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 | |
7f342629 DS |
21 | */ |
22 | ||
23 | #ifndef _ZEBRA_BFD_H | |
24 | #define _ZEBRA_BFD_H | |
25 | ||
68fe91d6 | 26 | #include "lib/json.h" |
27 | ||
7f342629 DS |
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 | ||
567b877d | 38 | #define BFD_GBL_FLAG_IN_SHUTDOWN (1 << 0) /* The daemon in shutdown */ |
39 | struct bfd_gbl | |
40 | { | |
41 | u_int16_t flags; | |
42 | }; | |
43 | ||
7f342629 DS |
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 | 52 | enum bfd_sess_type { |
53 | BFD_TYPE_NOT_CONFIGURED, | |
54 | BFD_TYPE_SINGLEHOP, | |
55 | BFD_TYPE_MULTIHOP | |
56 | }; | |
57 | ||
7f342629 DS |
58 | struct 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 | ||
69 | extern struct bfd_info * | |
70 | bfd_info_create(void); | |
71 | ||
72 | extern void | |
88177fe3 | 73 | bfd_info_free(struct bfd_info **bfd_info); |
7f342629 DS |
74 | |
75 | extern int | |
76 | bfd_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 | ||
80 | extern void | |
81 | bfd_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); | |
83 | extern void | |
84 | bfd_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 | |
89 | extern const char * | |
90 | bfd_get_command_dbg_str(int command); | |
91 | ||
92 | extern struct interface * | |
68fe91d6 | 93 | bfd_get_peer_info (struct stream *s, struct prefix *dp, struct prefix *sp, |
1e22a2af | 94 | int *status, vrf_id_t vrf_id); |
68fe91d6 | 95 | |
96 | const char * | |
97 | bfd_get_status_str(int status); | |
98 | ||
99 | extern void | |
100 | bfd_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 | ||
103 | extern void | |
104 | bfd_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 | 107 | extern void |
108 | bfd_client_sendmsg (struct zclient *zclient, int command); | |
109 | ||
567b877d | 110 | extern void |
111 | bfd_gbl_init(void); | |
112 | ||
113 | extern void | |
114 | bfd_gbl_exit(void); | |
115 | ||
7f342629 | 116 | #endif /* _ZEBRA_BFD_H */ |