]>
git.proxmox.com Git - mirror_frr.git/blob - mgmtd/mgmt.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * MGMTD message definition header.
5 * Copyright (C) 2021 Vmware, Inc.
6 * Pushpasis Sarkar <spushpasis@vmware.com>
17 #include "mgmtd/mgmt_memory.h"
18 #include "mgmtd/mgmt_defines.h"
19 #include "mgmtd/mgmt_history.h"
20 #include "mgmtd/mgmt_txn.h"
21 #include "mgmtd/mgmt_ds.h"
23 #define MGMTD_VTY_PORT 2622
24 #define MGMTD_SOCKET_BUF_SIZE 65535
25 #define MGMTD_MAX_COMMIT_LIST 10
27 extern struct debug mgmt_debug_be
;
28 extern struct debug mgmt_debug_ds
;
29 extern struct debug mgmt_debug_fe
;
30 extern struct debug mgmt_debug_txn
;
32 #define MGMT_DEBUG_BE_CHECK() DEBUG_MODE_CHECK(&mgmt_debug_be, DEBUG_MODE_ALL)
33 #define MGMT_DEBUG_DS_CHECK() DEBUG_MODE_CHECK(&mgmt_debug_ds, DEBUG_MODE_ALL)
34 #define MGMT_DEBUG_FE_CHECK() DEBUG_MODE_CHECK(&mgmt_debug_fe, DEBUG_MODE_ALL)
35 #define MGMT_DEBUG_TXN_CHECK() DEBUG_MODE_CHECK(&mgmt_debug_tx, DEBUG_MODE_ALL)
40 * MGMTD master for system wide configurations and variables.
43 struct event_loop
*master
;
45 /* How big should we set the socket buffer size */
46 uint32_t socket_buffer
;
48 /* The single instance of config transaction allowed at any time */
49 struct mgmt_txns_head txn_list
;
51 /* Map of Transactions and its ID */
52 struct hash
*txn_hash
;
55 /* The single instance of config transaction allowed at any time */
56 struct mgmt_txn_ctx
*cfg_txn
;
59 struct mgmt_ds_ctx
*running_ds
;
60 struct mgmt_ds_ctx
*candidate_ds
;
61 struct mgmt_ds_ctx
*oper_ds
;
63 bool terminating
; /* global flag that sigint terminate seen */
64 bool perf_stats_en
; /* to enable performance stats measurement */
66 /* List of commit infos */
67 struct mgmt_cmt_infos_head cmts
; /* List of last 10 commits executed. */
70 extern struct mgmt_master
*mm
;
71 extern char const *const mgmt_daemons
[];
72 extern uint mgmt_daemons_count
;
74 /* Inline functions */
75 static inline unsigned long timeval_elapsed(struct timeval a
, struct timeval b
)
77 return (((a
.tv_sec
- b
.tv_sec
) * TIMER_SECOND_MICRO
)
78 + (a
.tv_usec
- b
.tv_usec
));
82 * Remove trailing separator from a string.
85 * A null terminated string.
88 * Trailing character that needs to be removed.
90 static inline void mgmt_remove_trailing_separator(char *str
, char sep
)
95 if (len
&& str
[len
- 1] == sep
)
100 extern void mgmt_terminate(void);
101 extern void mgmt_reset(void);
102 extern time_t mgmt_clock(void);
104 extern int mgmt_config_write(struct vty
*vty
);
106 extern void mgmt_master_init(struct event_loop
*master
, const int buffer_size
);
108 extern void mgmt_init(void);
109 extern void mgmt_vty_init(void);
111 #endif /* _FRR_MGMTD_H */