#include "replication.h"
#include "condition.h"
-#include "json.h"
+#include "openvswitch/json.h"
#include "jsonrpc.h"
#include "ovsdb.h"
#include "ovsdb-error.h"
static struct sset tables_blacklist = SSET_INITIALIZER(&tables_blacklist);
static bool reset_dbs = true;
-void replication_init(void);
static struct jsonrpc *open_jsonrpc(const char *server);
static struct ovsdb_error *check_jsonrpc_error(int error,
struct jsonrpc_msg **reply_);
remote_ovsdb_server = nullable_xstrdup(remote_server);
}
+const char *
+get_remote_ovsdb_server(void)
+{
+ return remote_ovsdb_server;
+}
+
void
set_tables_blacklist(const char *blacklist)
{
- char *save_ptr = NULL;
- char *blacklist_item;
-
replication_init();
-
if (blacklist) {
- char *t_blacklist = xstrdup(blacklist);
- for (blacklist_item = strtok_r(t_blacklist, ",", &save_ptr);
- blacklist_item != NULL;
- blacklist_item = strtok_r(NULL, ",", &save_ptr)) {
- sset_add(&tables_blacklist, blacklist_item);
- }
- free(t_blacklist);
+ sset_from_delimited_string(&tables_blacklist, blacklist, ",");
}
}
+struct sset
+get_tables_blacklist(void)
+{
+ return tables_blacklist;
+}
+
void
disconnect_remote_server(void)
{
struct stream *stream;
int error;
- error = stream_open_block(jsonrpc_stream_open(server, &stream,
- DSCP_DEFAULT), &stream);
+ error = jsonrpc_stream_open(server, &stream, DSCP_DEFAULT);
return error ? NULL : jsonrpc_open(stream);
}
struct ovsdb_error *error;
if (table_update->type != JSON_OBJECT) {
- error = ovsdb_error("Not a JSON object",
- "<table-update> for table is not object");
+ return ovsdb_error("Not a JSON object",
+ "<table-update> for table is not object");
}
table = ovsdb_get_table(database, table_name);
{
const struct json *where;
struct ovsdb_error *error;
- struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER;
+ struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER(&condition);
char where_string[UUID_LEN+29];
if (!table) {
struct ovsdb_table *table, struct json *json_row)
{
struct ovsdb_column_set columns = OVSDB_COLUMN_SET_INITIALIZER;
- struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER;
+ struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER(&condition);
struct update_row_cbdata ur;
struct ovsdb_row *row;
struct ovsdb_error *error;