]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_mlag.h
Zebra: adding support for Zebra MLAG Functionality
[mirror_frr.git] / zebra / zebra_mlag.h
CommitLineData
df395600 1/* Zebra mlag header.
6a597223 2 * Copyright (C) 2018 Cumulus Networks, Inc.
df395600
DS
3 * Donald Sharp
4 *
5 * This file is part of FRR.
6 *
7 * FRR is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * FRR is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with FRR; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22#ifndef __ZEBRA_MLAG_H__
23#define __ZEBRA_MLAG_H__
24
25#include "mlag.h"
ee235396
SK
26#include "zclient.h"
27#include "zebra/zserv.h"
df395600 28
ee235396
SK
29#define ZEBRA_MLAG_BUF_LIMIT 2048
30#define ZEBRA_MLAG_LEN_SIZE 4
d5167496 31
ee235396
SK
32extern uint8_t mlag_wr_buffer[ZEBRA_MLAG_BUF_LIMIT];
33extern uint8_t mlag_rd_buffer[ZEBRA_MLAG_BUF_LIMIT];
34extern uint32_t mlag_rd_buf_offset;
ff1fb8d5 35
ee235396
SK
36static inline void zebra_mlag_reset_write_buffer(void)
37{
38 memset(mlag_wr_buffer, 0, ZEBRA_MLAG_BUF_LIMIT);
39}
51e94aa7 40
ee235396
SK
41static inline void zebra_mlag_reset_read_buffer(void)
42{
43 memset(mlag_rd_buffer, 0, ZEBRA_MLAG_BUF_LIMIT);
44 mlag_rd_buf_offset = 0;
6a597223 45}
51e94aa7 46
ee235396
SK
47enum zebra_mlag_state {
48 MLAG_UP = 1,
49 MLAG_DOWN = 2,
50};
51
52void zebra_mlag_init(void);
53void zebra_mlag_terminate(void);
54enum mlag_role zebra_mlag_get_role(void);
55void zebra_mlag_client_register(ZAPI_HANDLER_ARGS);
56void zebra_mlag_client_unregister(ZAPI_HANDLER_ARGS);
57void zebra_mlag_forward_client_msg(ZAPI_HANDLER_ARGS);
58void zebra_mlag_send_register(void);
59void zebra_mlag_send_deregister(void);
60void zebra_mlag_handle_process_state(enum zebra_mlag_state state);
61void zebra_mlag_process_mlag_data(uint8_t *data, uint32_t len);
62/*
63 * ProtoBuffer Api's
64 */
65int zebra_mlag_protobuf_encode_client_data(struct stream *s,
66 uint32_t *msg_type);
67int zebra_mlag_protobuf_decode_message(struct stream **s, uint8_t *data,
68 uint32_t len);
df395600 69#endif