Code

store.h: Reuse the sdb_metric_store_t type for a metric's store field.
[sysdb.git] / src / include / client / sock.h
index 638f8626660807a33776267f8116dbe38c8449c0..615227d7408effab59f3b3806b905b01186a35e1 100644 (file)
@@ -31,6 +31,7 @@
 #include "core/object.h"
 #include "core/data.h"
 #include "frontend/proto.h"
+#include "utils/ssl.h"
 #include "utils/strbuf.h"
 
 #include <sys/socket.h>
@@ -59,11 +60,22 @@ sdb_client_create(const char *address);
 
 /*
  * sdb_client_destroy:
- * Destroyes the client connection and deallocates the client object.
+ * Destroys the client connection and deallocates the client object.
  */
 void
 sdb_client_destroy(sdb_client_t *client);
 
+/*
+ * sdb_client_set_ssl_options:
+ * Use the specified options for any SSL connections.
+ *
+ * Returns:
+ *  - 0 on success
+ *  - a negative value else
+ */
+int
+sdb_client_set_ssl_options(sdb_client_t *client, const sdb_ssl_options_t *opts);
+
 /*
  * sdb_client_connect:
  * Connect to the client's address using the specified username.
@@ -97,10 +109,30 @@ sdb_client_shutdown(sdb_client_t *client, int how);
 void
 sdb_client_close(sdb_client_t *client);
 
+/*
+ * sdb_client_rpc:
+ * Send the specified message to the server and wait for the reply. All
+ * received data is written to the specified buffer. If specified, the
+ * returned status code is written to the memory location pointed to by
+ * 'code'. In case of an error or an incomplete command, the status code is
+ * set to UINT32_MAX. The returned data does not include the status code and
+ * message len as received from the remote side but only the data associated
+ * with the message. The function handles all asynchronous log messages by
+ * logging them at the right log level.
+ *
+ * Returns:
+ *  - the number of bytes read
+ *    (may be zero if the message did not include any data)
+ *  - a negative value on error
+ */
+ssize_t
+sdb_client_rpc(sdb_client_t *client,
+               uint32_t cmd, uint32_t msg_len, const char *msg,
+               uint32_t *code, sdb_strbuf_t *buf);
+
 /*
  * sdb_client_send:
- * Send the specified command and accompanying data to through the client
- * connection.
+ * Send the specified command and accompanying data to the server.
  *
  * Returns:
  *  - the number of bytes send