+int relayd_send_metadata(struct lttcomm_relayd_sock *rsock, size_t len)
+{
+ int ret;
+
+ /* Code flow error. Safety net. */
+ assert(rsock);
+
+ DBG("Relayd sending metadata of size %zu", len);
+
+ /* Send command */
+ ret = send_command(rsock, RELAYD_SEND_METADATA, NULL, len, 0);
+ if (ret < 0) {
+ goto error;
+ }
+
+ DBG2("Relayd metadata added successfully");
+
+ /*
+ * After that call, the metadata data MUST be sent to the relayd so the
+ * receive size on the other end matches the len of the metadata packet
+ * header. This is why we don't wait for a reply here.
+ */
+
+error:
+ return ret;
+}
+
+/*
+ * Connect to relay daemon with an allocated lttcomm_relayd_sock.
+ */
+int relayd_connect(struct lttcomm_relayd_sock *rsock)
+{
+ /* Code flow error. Safety net. */
+ assert(rsock);
+
+ DBG3("Relayd connect ...");
+
+ return rsock->sock.ops->connect(&rsock->sock);
+}
+
+/*
+ * Close relayd socket with an allocated lttcomm_relayd_sock.
+ *
+ * If no socket operations are found, simply return 0 meaning that everything
+ * is fine. Without operations, the socket can not possibly be opened or used.
+ * This is possible if the socket was allocated but not created. However, the
+ * caller could simply use it to store a valid file descriptor for instance
+ * passed over a Unix socket and call this to cleanup but still without a valid
+ * ops pointer.
+ *
+ * Return the close returned value. On error, a negative value is usually
+ * returned back from close(2).
+ */
+int relayd_close(struct lttcomm_relayd_sock *rsock)