ovsdb: Implement a "lock" feature in the database protocol.
[sliver-openvswitch.git] / ovsdb / jsonrpc-server.h
index 9906e81..78ddb82 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010 Nicira Networks
+/* Copyright (c) 2009, 2010, 2011 Nicira Networks
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
 #ifndef OVSDB_JSONRPC_SERVER_H
 #define OVSDB_JSONRPC_SERVER_H 1
 
+#include <stdbool.h>
+
 struct ovsdb;
 struct shash;
 
@@ -32,6 +34,24 @@ struct ovsdb_jsonrpc_options *ovsdb_jsonrpc_default_options(void);
 void ovsdb_jsonrpc_server_set_remotes(struct ovsdb_jsonrpc_server *,
                                       const struct shash *);
 
+/* Status of a single remote connection. */
+struct ovsdb_jsonrpc_remote_status {
+    const char *state;
+    int last_error;
+    unsigned int sec_since_connect;
+    unsigned int sec_since_disconnect;
+    bool is_connected;
+    char *locks_held;
+    char *locks_waiting;
+    char *locks_lost;
+    int n_connections;
+};
+bool ovsdb_jsonrpc_server_get_remote_status(
+    const struct ovsdb_jsonrpc_server *, const char *target,
+    struct ovsdb_jsonrpc_remote_status *);
+void ovsdb_jsonrpc_server_free_remote_status(
+    struct ovsdb_jsonrpc_remote_status *);
+
 void ovsdb_jsonrpc_server_reconnect(struct ovsdb_jsonrpc_server *);
 
 void ovsdb_jsonrpc_server_run(struct ovsdb_jsonrpc_server *);