summaryrefslogtreecommitdiffstats
path: root/lib/ptm_lib.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-06-12 16:59:11 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-06-12 16:59:11 +0200
commitc43ed2e48af8c787a1ebc4b648f844c44032db35 (patch)
tree24e3abff6f724033ab16418961da91ff1ddd6aee /lib/ptm_lib.h
parentKey changes: (diff)
downloadfrr-c43ed2e48af8c787a1ebc4b648f844c44032db35.tar.xz
frr-c43ed2e48af8c787a1ebc4b648f844c44032db35.zip
This patch changes BGP from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering BFD enabled peers with PTM/BFD through zebra. Peer is registered with BFD when it goes into established state and de-registers when it goes out of establish state.
This patch also adds BFD multihop support for BGP. Whether a peer is multi-hop or single hop is determined internally. All IGP peers are considered as multi-hop peers. EBGP peers are considered as single hop unless configured as multi-hop. BGP BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx). router bgp <as-number> neighbor <name/ip-address> bfd <detect mult> <min rx> <min tx> Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Kanna Rajagopal <kanna@cumulusnetworks.com>
Diffstat (limited to 'lib/ptm_lib.h')
-rw-r--r--lib/ptm_lib.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/ptm_lib.h b/lib/ptm_lib.h
new file mode 100644
index 000000000..1aa2f356f
--- /dev/null
+++ b/lib/ptm_lib.h
@@ -0,0 +1,49 @@
+/*********************************************************************
+ * Copyright 2015 Cumulus Networks, LLC. All rights reserved.
+ *
+ * library file used by clients for sending commands and parsing response
+ *
+ */
+
+#define PTMLIB_MSG_SZ 1024
+#define PTMLIB_MSG_HDR_LEN 37
+#define PTMLIB_MSG_VERSION 2
+#define PTMLIB_MAXNAMELEN 32
+
+#define PTMLIB_CMD_GET_STATUS "get-status"
+#define PTMLIB_CMD_GET_BFD_CLIENT "get-bfd-client"
+#define PTMLIB_CMD_START_BFD_SESS "start-bfd-sess"
+#define PTMLIB_CMD_STOP_BFD_SESS "stop-bfd-sess"
+
+typedef enum {
+ PTMLIB_MSG_TYPE_NOTIFICATION = 1,
+ PTMLIB_MSG_TYPE_CMD,
+ PTMLIB_MSG_TYPE_RESPONSE,
+} ptmlib_msg_type;
+
+typedef enum {
+ MODULE_BFD = 0,
+ MODULE_LLDP,
+ MODULE_MAX,
+} ptmlib_mod_type;
+
+typedef int (*ptm_cmd_cb) (void *data, void *arg);
+typedef int (*ptm_notify_cb) (void *data, void *arg);
+typedef int (*ptm_response_cb) (void *data, void *arg);
+typedef int (*ptm_log_cb) (void *data, void *arg,...);
+
+typedef struct ptm_lib_handle_s {
+ char client_name[PTMLIB_MAXNAMELEN];
+ ptm_cmd_cb cmd_cb;
+ ptm_notify_cb notify_cb;
+ ptm_response_cb response_cb;
+} ptm_lib_handle_t;
+
+/* Prototypes */
+int ptm_lib_process_msg(ptm_lib_handle_t *, int, char *, int, void *);
+ptm_lib_handle_t *ptm_lib_register(char *, ptm_cmd_cb, ptm_notify_cb, ptm_response_cb);
+void ptm_lib_deregister(ptm_lib_handle_t *);
+int ptm_lib_find_key_in_msg(void *, const char *, char *);
+int ptm_lib_init_msg(ptm_lib_handle_t *, int, int, void *, void **);
+int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, char *);
+int ptm_lib_complete_msg(ptm_lib_handle_t *, void *, char *, int *);