lib: compile liblttng-ctl as C++
[lttng-tools.git] / include / lttng / snapshot.h
index 8f5ee898ee1bdc7c52f7cdc8506445e1f7fd265a..b777e006b2f131e95f7508fec428d8c52f0476a3 100644 (file)
@@ -1,24 +1,15 @@
 /*
- * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
+ * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
  *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License, version 2.1 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef LTTNG_SNAPSHOT_H
 #define LTTNG_SNAPSHOT_H
 
 #include <limits.h>
+#include <lttng/lttng-export.h>
 #include <stdint.h>
 #include <sys/types.h>
 
@@ -36,12 +27,12 @@ struct lttng_snapshot_output_list;
 /*
  * Return an newly allocated snapshot output object or NULL on error.
  */
-struct lttng_snapshot_output *lttng_snapshot_output_create(void);
+LTTNG_EXPORT extern struct lttng_snapshot_output *lttng_snapshot_output_create(void);
 
 /*
  * Free a given snapshot output object.
  */
-void lttng_snapshot_output_destroy(struct lttng_snapshot_output *output);
+LTTNG_EXPORT extern void lttng_snapshot_output_destroy(struct lttng_snapshot_output *output);
 
 /*
  * Snapshot output getter family functions. They all return the value present
@@ -49,37 +40,73 @@ void lttng_snapshot_output_destroy(struct lttng_snapshot_output *output);
  */
 
 /* Return snapshot ID. */
-uint32_t lttng_snapshot_output_get_id(struct lttng_snapshot_output *output);
+LTTNG_EXPORT extern uint32_t lttng_snapshot_output_get_id(const struct lttng_snapshot_output *output);
 /* Return maximum size of a snapshot. */
-uint64_t lttng_snapshot_output_get_maxsize(struct lttng_snapshot_output *output);
+LTTNG_EXPORT extern uint64_t lttng_snapshot_output_get_maxsize(const struct lttng_snapshot_output *output);
 /* Return snapshot name. */
-const char *lttng_snapshot_output_get_name(struct lttng_snapshot_output *output);
+LTTNG_EXPORT extern const char *lttng_snapshot_output_get_name(const struct lttng_snapshot_output *output);
 /* Return snapshot control URL in a text format. */
-const char *lttng_snapshot_output_get_ctrl_url(struct lttng_snapshot_output *output);
+LTTNG_EXPORT extern const char *lttng_snapshot_output_get_ctrl_url(const struct lttng_snapshot_output *output);
 /* Return snapshot data URL in a text format. */
-const char *lttng_snapshot_output_get_data_url(struct lttng_snapshot_output *output);
+LTTNG_EXPORT extern const char *lttng_snapshot_output_get_data_url(const struct lttng_snapshot_output *output);
 
 /*
  * Snapshot output setter family functions.
  *
- * For every set* call, 0 is returned on success or else LTTNG_ERR_INVALID is
+ * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is
  * returned indicating that at least one given parameter is invalid.
  */
 
 /* Set a custom ID. */
-int lttng_snapshot_output_set_id(uint32_t id,
+LTTNG_EXPORT extern int lttng_snapshot_output_set_id(uint32_t id,
                struct lttng_snapshot_output *output);
 /* Set the maximum size. */
-int lttng_snapshot_output_set_size(uint64_t size,
+LTTNG_EXPORT extern int lttng_snapshot_output_set_size(uint64_t size,
                struct lttng_snapshot_output *output);
 /* Set the snapshot name. */
-int lttng_snapshot_output_set_name(const char *name,
+LTTNG_EXPORT extern int lttng_snapshot_output_set_name(const char *name,
+               struct lttng_snapshot_output *output);
+
+/*
+ * Set the output destination to be a path on the local filesystem.
+ *
+ * The path must be absolute. It can optionally begin with `file://`.
+ *
+ * Return 0 on success or else a negative LTTNG_ERR code.
+ */
+LTTNG_EXPORT extern int lttng_snapshot_output_set_local_path(const char *path,
+               struct lttng_snapshot_output *output);
+
+/*
+ * Set the output destination to be the network from a combined control/data
+ * URL.
+ *
+ * `url` must start with `net://` or `net6://`.
+ *
+ * Return 0 on success or else a negative LTTNG_ERR code.
+ */
+LTTNG_EXPORT extern int lttng_snapshot_output_set_network_url(const char *url,
+               struct lttng_snapshot_output *output);
+
+/*
+ * Set the output destination to be the network using separate URLs for control
+ * and data.
+ *
+ * Both ctrl_url and data_url must be non-null.
+ *
+ * `ctrl_url` and `data_url` must start with `tcp://` or `tcp6://`.
+ *
+ * Return 0 on success or else a negative LTTNG_ERR code.
+ */
+LTTNG_EXPORT extern int lttng_snapshot_output_set_network_urls(
+               const char *ctrl_url, const char *data_url,
                struct lttng_snapshot_output *output);
+
 /* Set the control URL. Local and remote URL are supported. */
-int lttng_snapshot_output_set_ctrl_url(const char *url,
+LTTNG_EXPORT extern int lttng_snapshot_output_set_ctrl_url(const char *url,
                struct lttng_snapshot_output *output);
 /* Set the data URL. Local and remote URL are supported. */
-int lttng_snapshot_output_set_data_url(const char *url,
+LTTNG_EXPORT extern int lttng_snapshot_output_set_data_url(const char *url,
                struct lttng_snapshot_output *output);
 
 /*
@@ -87,7 +114,7 @@ int lttng_snapshot_output_set_data_url(const char *url,
  *
  * Return 0 on success or else a negative LTTNG_ERR code.
  */
-int lttng_snapshot_add_output(const char *session_name,
+LTTNG_EXPORT extern int lttng_snapshot_add_output(const char *session_name,
                struct lttng_snapshot_output *output);
 
 /*
@@ -95,7 +122,7 @@ int lttng_snapshot_add_output(const char *session_name,
  *
  * Return 0 on success or else a negative LTTNG_ERR code.
  */
-int lttng_snapshot_del_output(const char *session_name,
+LTTNG_EXPORT extern int lttng_snapshot_del_output(const char *session_name,
                struct lttng_snapshot_output *output);
 
 /*
@@ -105,7 +132,7 @@ int lttng_snapshot_del_output(const char *session_name,
  * Return 0 on success or else a negative LTTNG_ERR code and the list pointer
  * is untouched.
  */
-int lttng_snapshot_list_output(const char *session_name,
+LTTNG_EXPORT extern int lttng_snapshot_list_output(const char *session_name,
                struct lttng_snapshot_output_list **list);
 
 /*
@@ -115,13 +142,13 @@ int lttng_snapshot_list_output(const char *session_name,
  * Return the next object on success or else NULL indicating the end of the
  * list.
  */
-struct lttng_snapshot_output *lttng_snapshot_output_list_get_next(
+LTTNG_EXPORT extern struct lttng_snapshot_output *lttng_snapshot_output_list_get_next(
                struct lttng_snapshot_output_list *list);
 
 /*
  * Free an output list object.
  */
-void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list);
+LTTNG_EXPORT extern void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list);
 
 /*
  * Snapshot a trace for the given session.
@@ -135,7 +162,7 @@ void lttng_snapshot_output_list_destroy(struct lttng_snapshot_output_list *list)
  *
  * Return 0 on success or else a negative LTTNG_ERR value.
  */
-int lttng_snapshot_record(const char *session_name,
+LTTNG_EXPORT extern int lttng_snapshot_record(const char *session_name,
                struct lttng_snapshot_output *output, int wait);
 
 #ifdef __cplusplus
This page took 0.026512 seconds and 4 git commands to generate.