yumapro  23.10T-7
YumaPro SDK
Loading...
Searching...
No Matches
agt_yp_ha.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 - 2021, YumaWorks, Inc., All Rights Reserved.
3 *
4 * Unless required by applicable law or agreed to in writing,
5 * software distributed under the License is distributed on an
6 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7 * KIND, either express or implied. See the License for the
8 * specific language governing permissions and limitations
9 * under the License.
10 */
11#ifdef WITH_YP_HA
12#ifndef _H_agt_yp_ha
13#define _H_agt_yp_ha
14
15/* FILE: agt_yp_ha.h
16*********************************************************************
17* *
18* P U R P O S E *
19* *
20*********************************************************************/
21
28/*********************************************************************
29* *
30* C H A N G E H I S T O R Y *
31* *
32*********************************************************************
33
34date init comment
35----------------------------------------------------------------------
3606-feb-16 abb Begun
37*/
38
39#include <xmlstring.h>
40
41#ifndef _H_agt
42#include "agt.h"
43#endif
44
45#ifndef _H_agt_cfg
46#include "agt_cfg.h"
47#endif
48
49#ifndef _H_status_enum
50#include "status_enum.h"
51#endif
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57
58/* header only */
59
60
84/********************************************************************
85* *
86* C O N S T A N T S *
87* *
88*********************************************************************/
89
90
91/********************************************************************
92* *
93* T Y P E S *
94* *
95*********************************************************************/
96
98typedef enum yp_ha_state_t_ {
101
104
107
110
113
116
119
122
126
127
133typedef struct yp_ha_server_t_ {
135 dlq_hdr_t qhdr;
136
138 xmlChar *server_name;
139
141 xmlChar *server_addr;
142
145
147 struct yp_ha_subsys_t_ *subsys_cb;
148
150
151
157typedef struct yp_ha_service_t_ {
159 dlq_hdr_t ha_serverQ;
160
163
165 const xmlChar *ha_server_key;
166
169
172
175
177 boolean ha_enabled;
178
181
183 struct yp_ha_active_t_ *active_cb;
184
186 struct yp_ha_standby_t_ *standby_cb;
187
189 xmlChar tstamp[TSTAMP_MIN_SIZE];
190
193
196
198 xmlChar last_error_time[TSTAMP_MIN_SIZE];
199
202
204
205
206/********************************************************************
207* *
208* F U N C T I O N S *
209* *
210*********************************************************************/
211
220extern void
221 agt_yp_ha_preinit (void);
222
223
229extern status_t
230 agt_yp_ha_init (void);
231
232
241extern status_t
242 agt_yp_ha_init2 (void);
243
244
250extern void
251 agt_yp_ha_cleanup (void);
252
253
260extern status_t
261 agt_yp_ha_add_server_cli (const xmlChar *valstr);
262
263
269extern boolean
271
272
278extern status_t
279 agt_yp_ha_be_active (void);
280
281
287extern status_t
288 agt_yp_ha_be_none (void);
289
290
297extern status_t
298 agt_yp_ha_be_standby (const xmlChar *new_server_id);
299
300
306extern agt_ha_role_t
307 agt_yp_ha_get_role (void);
308
309
317extern const xmlChar *
318 agt_yp_ha_get_role_state (const xmlChar **tstamp);
319
320
326extern yp_ha_service_t *
328
329
335extern void
337
338
348extern yp_ha_server_t *
349 agt_yp_ha_find_server (const xmlChar *server_name);
350
351
358extern void
361
362
368extern status_t
369 agt_yp_ha_nvstore (void);
370
371
378extern boolean
380
381
382
393extern void
394 agt_yp_ha_mod_event (const xmlChar *name,
395 const xmlChar *revision,
396 val_value_t *inputval,
397 boolean is_module,
398 boolean is_load);
399
400
410extern status_t
412 const xmlChar **config_stamp);
413
414
415
426extern status_t
427 agt_yp_ha_get_error_info (const xmlChar **tstamp,
428 const xmlChar **msg);
429
430
436extern const xmlChar *
438
439
440
450extern status_t
451 agt_yp_ha_get_config_counters(uint64 *updates,
452 uint64 *failures);
453
454
458#ifdef __cplusplus
459} /* end extern 'C' */
460#endif
461
462#endif /* _H_agt_yp_ha */
463#endif // WITH_YP_HA
Multi-Protocol Network Management Server.
Manage Server configuration edit transactions.
agt_ha_role_t
server HA mode mode
Definition: agt.h:775
void agt_yp_ha_mod_event(const xmlChar *name, const xmlChar *revision, val_value_t *inputval, boolean is_module, boolean is_load)
Generate a module event.
Definition: agt_yp_ha.c:1317
yp_ha_state_t
YP-HA Shared State.
Definition: agt_yp_ha.h:98
status_t agt_yp_ha_nvstore(void)
Do an <nvstore> in the active role.
Definition: agt_yp_ha.c:1247
yp_ha_server_t * agt_yp_ha_find_server(const xmlChar *server_name)
Find a server record.
Definition: agt_yp_ha.c:1129
status_t agt_yp_ha_get_error_info(const xmlChar **tstamp, const xmlChar **msg)
Get the last error time and error message, if any.
Definition: agt_yp_ha.c:1400
status_t agt_yp_ha_be_standby(const xmlChar *new_server_id)
Put this server in YP-HA Standby mode.
Definition: agt_yp_ha.c:784
agt_ha_role_t agt_yp_ha_get_role(void)
Get the YP-HA server role for this server.
Definition: agt_yp_ha.c:974
status_t agt_yp_ha_add_server_cli(const xmlChar *valstr)
Add an HA server entry from the –ha-server CLI parm.
Definition: agt_yp_ha.c:482
status_t agt_yp_ha_init(void)
Initialize the YP-HA subsys handler (begin phase 2 init)
Definition: agt_yp_ha.c:246
const xmlChar * agt_yp_ha_get_active_server(void)
Get the active server or in progress of connecting.
Definition: agt_yp_ha.c:1435
status_t agt_yp_ha_init2(void)
Initialize the YP-HA shared state (phase 2 init, post external init).
Definition: agt_yp_ha.c:371
void agt_yp_ha_cleanup(void)
Cleanup the YP-HA Module.
Definition: agt_yp_ha.c:448
status_t agt_yp_ha_be_active(void)
Put this server in YP-HA Active mode.
Definition: agt_yp_ha.c:573
void agt_yp_ha_config_update(rpc_msg_t *msg, agt_cfg_transaction_t *txcb)
Do a config update in the active role.
Definition: agt_yp_ha.c:1156
boolean agt_yp_ha_sil_disabled(void)
Check if all hooks are enabled or disabled because of the YP-HA Standby mode.
Definition: agt_yp_ha.c:1284
status_t agt_yp_ha_be_none(void)
Put this server in WAIT_ROLE state.
Definition: agt_yp_ha.c:683
void agt_yp_ha_preinit(void)
Pre-Initialize the YP-HA subsys handler.
Definition: agt_yp_ha.c:220
status_t agt_yp_ha_get_config_info(ncx_transaction_id_t *config_id, const xmlChar **config_stamp)
Get the config ID and timestamp info.
Definition: agt_yp_ha.c:1357
boolean agt_yp_ha_mgmt_enabled(void)
Check if MGMT protocols disabled because YP-HA Standby mode.
Definition: agt_yp_ha.c:930
yp_ha_service_t * agt_yp_ha_get_service_cb(void)
Get the YP-HA service control block for this server.
Definition: agt_yp_ha.c:1065
void agt_yp_ha_check_standby_io(void)
Check if the YP-SA Standby mode needs to check for input.
Definition: agt_yp_ha.c:1082
status_t agt_yp_ha_get_config_counters(uint64 *updates, uint64 *failures)
Get the config-updates and config-failures counters.
Definition: agt_yp_ha.c:1467
const xmlChar * agt_yp_ha_get_role_state(const xmlChar **tstamp)
Get the YP-HA server role for this server as a string.
Definition: agt_yp_ha.c:1016
@ HA_STATE_DISABLED
HA disabled.
Definition: agt_yp_ha.h:103
@ HA_STATE_SHUTTING_DOWN
shutting down HA service
Definition: agt_yp_ha.h:124
@ HA_STATE_WAIT_ROLE
waiting for HA role
Definition: agt_yp_ha.h:109
@ HA_STATE_STANDBY
standby server role
Definition: agt_yp_ha.h:121
@ HA_STATE_ERROR
HA error state.
Definition: agt_yp_ha.h:106
@ HA_STATE_ACTIVE
active server role
Definition: agt_yp_ha.h:115
@ HA_STATE_NONE
not set
Definition: agt_yp_ha.h:100
@ HA_STATE_BE_STANDBY
in process of becoming standby server
Definition: agt_yp_ha.h:118
@ HA_STATE_BE_ACTIVE
in process of becoming active server
Definition: agt_yp_ha.h:112
status_t
global error return code
Definition: status_enum.h:210
#define TSTAMP_MIN_SIZE
normal minimum buffer size for a tstamp buffer
Definition: tstamp.h:71
uint64 ncx_transaction_id_t
transaction is scoped to single session write operation on a config
Definition: ncxtypes.h:724
global error status code enumerations
Transaction Control Block.
Definition: agt_cfg.h:235
One YANG data-def-stmt.
Definition: obj.h:1209
NETCONF Server and Client RPC Request/Reply Message Header.
Definition: rpc.h:181
one value to match one type
Definition: val.h:911
For each CLI-configured ha-server there will be one entry entry the active and standby both need this...
Definition: agt_yp_ha.h:133
dlq_hdr_t qhdr
queue header
Definition: agt_yp_ha.h:135
xmlChar * server_name
service name
Definition: agt_yp_ha.h:138
struct yp_ha_subsys_t_ * subsys_cb
maintained only by the active server
Definition: agt_yp_ha.h:147
uint16 server_port
peer TCP port number
Definition: agt_yp_ha.h:144
xmlChar * server_addr
peer IP address or domain name
Definition: agt_yp_ha.h:141
YP-HA service instance.
Definition: agt_yp_ha.h:157
val_value_t * payload_val
payload_val for reuse and faster messages
Definition: agt_yp_ha.h:171
struct yp_ha_standby_t_ * standby_cb
standby mode
Definition: agt_yp_ha.h:186
obj_template_t * yp_ha_obj
YANG object template for service layer.
Definition: agt_yp_ha.h:168
uint64 config_updates
config-updates leaf
Definition: agt_yp_ha.h:192
boolean ha_enabled
HA enabled flag.
Definition: agt_yp_ha.h:177
boolean ha_init_done
HA init done flag.
Definition: agt_yp_ha.h:180
struct yp_ha_active_t_ * active_cb
active mode
Definition: agt_yp_ha.h:183
uint64 config_failures
config-failures leaf
Definition: agt_yp_ha.h:195
yp_ha_server_t * my_server_cb
HA control block.
Definition: agt_yp_ha.h:162
yp_ha_state_t ha_state
current HA state
Definition: agt_yp_ha.h:174
const xmlChar * ha_server_key
shared HA pool key
Definition: agt_yp_ha.h:165
dlq_hdr_t ha_serverQ
common state is a Q of yp_ha_server_t
Definition: agt_yp_ha.h:159
status_t last_error_num
last error message leaf
Definition: agt_yp_ha.h:201