]>
git.proxmox.com Git - mirror_frr.git/blob - lib/northbound_db.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2018 NetDEF, Inc.
7 #ifndef _FRR_NORTHBOUND_DB_H_
8 #define _FRR_NORTHBOUND_DB_H_
10 #include "northbound.h"
17 * Initialize the northbound database.
19 * Currently the database is used only for storing and retrieving configuration
23 * NB_OK on success, NB_ERR otherwise.
28 * Save a configuration transaction in the northbound database.
31 * Configuration transaction to be saved.
34 * Output parameter providing the ID of the saved transaction.
37 * NB_OK on success, NB_ERR otherwise.
39 int nb_db_transaction_save(const struct nb_transaction
*transaction
,
40 uint32_t *transaction_id
);
43 * Load a configuration transaction from the transactions log.
46 * ID of the transaction to be loaded.
49 * Pointer to newly created configuration or NULL in the case of an error.
51 extern struct nb_config
*nb_db_transaction_load(uint32_t transaction_id
);
54 * Delete the specified number of transactions from the transactions log.
57 * Number of transactions to delete.
60 * NB_OK on success, NB_ERR otherwise.
62 extern int nb_db_clear_transactions(unsigned int n_oldest
);
65 * Specify the maximum number of transactions we want to record in the
66 * transactions log. Note that older transactions can be removed during this
70 * New upper limit of maximum transactions to log.
73 * NB_OK on success, NB_ERR otherwise.
75 extern int nb_db_set_max_transactions(unsigned int max
);
78 * Iterate over all configuration transactions stored in the northbound
79 * database, sorted in descending order.
82 * Function to call with each configuration transaction.
85 * Arbitrary argument passed as the first parameter in each call to 'func'.
88 * NB_OK on success, NB_ERR otherwise.
90 extern int nb_db_transactions_iterate(
91 void (*func
)(void *arg
, int transaction_id
, const char *client_name
,
92 const char *date
, const char *comment
),
99 #endif /* _FRR_NORTHBOUND_DB_H_ */