summaryrefslogtreecommitdiff
path: root/zebra/zebra_mlag.h
diff options
context:
space:
mode:
authorSatheesh Kumar K <sathk@cumulusnetworks.com>2019-11-12 00:40:35 -0800
committerSatheesh Kumar K <sathk@cumulusnetworks.com>2019-11-13 20:50:37 -0800
commitee235396b9c0187f7c72a86d3adb0bb15861c6c4 (patch)
tree7aa36f7f28189a6e93e551f0fdec8c018cc2117b /zebra/zebra_mlag.h
parent46c2687c72e59dce69a5f5d35fc7bd4d76bc740e (diff)
Zebra: adding support for Zebra MLAG Functionality
This includes: 1. Processing client Registrations for MLAG 2. storing client Interests for MLAG updates 3. Opening communication channel to MLAG with First client reg 4. Closing Communication channel with last client De-reg 5. Spawning a new thread for handling MLAG updates peocessing 6. adding Test code 7. advertising MLAG Updates to clients based on their interests Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mlag.h')
-rw-r--r--zebra/zebra_mlag.h45
1 files changed, 37 insertions, 8 deletions
diff --git a/zebra/zebra_mlag.h b/zebra/zebra_mlag.h
index 90a5a41fa4..6506089afc 100644
--- a/zebra/zebra_mlag.h
+++ b/zebra/zebra_mlag.h
@@ -23,18 +23,47 @@
#define __ZEBRA_MLAG_H__
#include "mlag.h"
+#include "zclient.h"
+#include "zebra/zserv.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+#define ZEBRA_MLAG_BUF_LIMIT 2048
+#define ZEBRA_MLAG_LEN_SIZE 4
-void zebra_mlag_init(void);
-void zebra_mlag_terminate(void);
+extern uint8_t mlag_wr_buffer[ZEBRA_MLAG_BUF_LIMIT];
+extern uint8_t mlag_rd_buffer[ZEBRA_MLAG_BUF_LIMIT];
+extern uint32_t mlag_rd_buf_offset;
-enum mlag_role zebra_mlag_get_role(void);
+static inline void zebra_mlag_reset_write_buffer(void)
+{
+ memset(mlag_wr_buffer, 0, ZEBRA_MLAG_BUF_LIMIT);
+}
-#ifdef __cplusplus
+static inline void zebra_mlag_reset_read_buffer(void)
+{
+ memset(mlag_rd_buffer, 0, ZEBRA_MLAG_BUF_LIMIT);
+ mlag_rd_buf_offset = 0;
}
-#endif
+enum zebra_mlag_state {
+ MLAG_UP = 1,
+ MLAG_DOWN = 2,
+};
+
+void zebra_mlag_init(void);
+void zebra_mlag_terminate(void);
+enum mlag_role zebra_mlag_get_role(void);
+void zebra_mlag_client_register(ZAPI_HANDLER_ARGS);
+void zebra_mlag_client_unregister(ZAPI_HANDLER_ARGS);
+void zebra_mlag_forward_client_msg(ZAPI_HANDLER_ARGS);
+void zebra_mlag_send_register(void);
+void zebra_mlag_send_deregister(void);
+void zebra_mlag_handle_process_state(enum zebra_mlag_state state);
+void zebra_mlag_process_mlag_data(uint8_t *data, uint32_t len);
+/*
+ * ProtoBuffer Api's
+ */
+int zebra_mlag_protobuf_encode_client_data(struct stream *s,
+ uint32_t *msg_type);
+int zebra_mlag_protobuf_decode_message(struct stream **s, uint8_t *data,
+ uint32_t len);
#endif