]>
git.proxmox.com Git - mirror_frr.git/blob - lib/northbound_db.h
2 * Copyright (C) 2018 NetDEF, Inc.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef _FRR_NORTHBOUND_DB_H_
21 #define _FRR_NORTHBOUND_DB_H_
23 #include "northbound.h"
26 * Initialize the northbound database.
28 * Currently the database is used only for storing and retrieving configuration
32 * NB_OK on success, NB_ERR otherwise.
37 * Save a configuration transaction in the northbound database.
40 * Configuration transaction to be saved.
43 * Output parameter providing the ID of the saved transaction.
46 * NB_OK on success, NB_ERR otherwise.
48 int nb_db_transaction_save(const struct nb_transaction
*transaction
,
49 uint32_t *transaction_id
);
52 * Load a configuration transaction from the transactions log.
55 * ID of the transaction to be loaded.
58 * Pointer to newly created configuration or NULL in the case of an error.
60 extern struct nb_config
*nb_db_transaction_load(uint32_t transaction_id
);
63 * Delete the specified number of transactions from the transactions log.
66 * Number of transactions to delete.
69 * NB_OK on success, NB_ERR otherwise.
71 extern int nb_db_clear_transactions(unsigned int n_oldest
);
74 * Specify the maximum number of transactions we want to record in the
75 * transactions log. Note that older transactions can be removed during this
79 * New upper limit of maximum transactions to log.
82 * NB_OK on success, NB_ERR otherwise.
84 extern int nb_db_set_max_transactions(unsigned int max
);
87 * Iterate over all configuration transactions stored in the northbound
88 * database, sorted in descending order.
91 * Function to call with each configuration transaction.
94 * Arbitrary argument passed as the first parameter in each call to 'func'.
97 * NB_OK on success, NB_ERR otherwise.
99 extern int nb_db_transactions_iterate(
100 void (*func
)(void *arg
, int transaction_id
, const char *client_name
,
101 const char *date
, const char *comment
),
104 #endif /* _FRR_NORTHBOUND_DB_H_ */