]>
Commit | Line | Data |
---|---|---|
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 | |
17e38209 RW |
29 | #ifdef __cplusplus |
30 | extern "C" { | |
31 | #endif | |
32 | ||
c19808ac | 33 | #define ZEBRA_MLAG_BUF_LIMIT 32768 |
ee235396 | 34 | #define ZEBRA_MLAG_LEN_SIZE 4 |
d5167496 | 35 | |
d621815a | 36 | DECLARE_HOOK(zebra_mlag_private_write_data, |
8451921b DL |
37 | (uint8_t *data, uint32_t len), (data, len)); |
38 | DECLARE_HOOK(zebra_mlag_private_monitor_state, (), ()); | |
39 | DECLARE_HOOK(zebra_mlag_private_open_channel, (), ()); | |
40 | DECLARE_HOOK(zebra_mlag_private_close_channel, (), ()); | |
41 | DECLARE_HOOK(zebra_mlag_private_cleanup_data, (), ()); | |
d621815a | 42 | |
ee235396 SK |
43 | extern uint8_t mlag_wr_buffer[ZEBRA_MLAG_BUF_LIMIT]; |
44 | extern uint8_t mlag_rd_buffer[ZEBRA_MLAG_BUF_LIMIT]; | |
ff1fb8d5 | 45 | |
ee235396 SK |
46 | static inline void zebra_mlag_reset_read_buffer(void) |
47 | { | |
17823cdd | 48 | memset(mlag_wr_buffer, 0, ZEBRA_MLAG_BUF_LIMIT); |
6a597223 | 49 | } |
51e94aa7 | 50 | |
ee235396 SK |
51 | enum zebra_mlag_state { |
52 | MLAG_UP = 1, | |
53 | MLAG_DOWN = 2, | |
54 | }; | |
55 | ||
56 | void zebra_mlag_init(void); | |
57 | void zebra_mlag_terminate(void); | |
58 | enum mlag_role zebra_mlag_get_role(void); | |
59 | void zebra_mlag_client_register(ZAPI_HANDLER_ARGS); | |
60 | void zebra_mlag_client_unregister(ZAPI_HANDLER_ARGS); | |
61 | void zebra_mlag_forward_client_msg(ZAPI_HANDLER_ARGS); | |
62 | void zebra_mlag_send_register(void); | |
63 | void zebra_mlag_send_deregister(void); | |
64 | void zebra_mlag_handle_process_state(enum zebra_mlag_state state); | |
65 | void zebra_mlag_process_mlag_data(uint8_t *data, uint32_t len); | |
14d9bbbe | 66 | |
ee235396 SK |
67 | /* |
68 | * ProtoBuffer Api's | |
69 | */ | |
70 | int zebra_mlag_protobuf_encode_client_data(struct stream *s, | |
71 | uint32_t *msg_type); | |
67fa73f2 | 72 | int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data, |
ee235396 | 73 | uint32_t len); |
17e38209 RW |
74 | #ifdef __cplusplus |
75 | } | |
76 | #endif | |
77 | ||
df395600 | 78 | #endif |