Add Python agent support
[lttng-tools.git] / src / common / mi-lttng.h
index a3a087036a310a48a8aeb368863deefb74b78a1c..fd1ef936eb4167fb409c4c34a5cb5f55ac7b9d42 100644 (file)
@@ -26,6 +26,9 @@
 #include <common/config/config.h>
 #include <lttng/lttng.h>
 
+/* Don't want to reference snapshot-internal.h here */
+struct lttng_snapshot_output;
+
 /* Instance of a machine interface writer. */
 struct mi_writer {
        struct config_writer *writer;
@@ -47,30 +50,41 @@ struct mi_lttng_version {
 
 /* Strings related to command */
 const char * const mi_lttng_element_command;
-const char * const mi_lttng_element_command_name;
-const char * const mi_lttng_element_command_version;
-const char * const mi_lttng_element_command_list;
-const char * const mi_lttng_element_command_save;
-const char * const mi_lttng_element_command_load;
-const char * const mi_lttng_element_command_stop;
-const char * const mi_lttng_element_command_start;
+const char * const mi_lttng_element_command_action;
+const char * const mi_lttng_element_command_add_context;
+const char * const mi_lttng_element_command_calibrate;
 const char * const mi_lttng_element_command_create;
 const char * const mi_lttng_element_command_destroy;
-const char * const mi_lttng_element_command_calibrate;
-const char * const mi_lttng_element_command_add_context;
+const char * const mi_lttng_element_command_disable_channel;
+const char * const mi_lttng_element_command_disable_event;
+const char * const mi_lttng_element_command_enable_channels;
+const char * const mi_lttng_element_command_enable_event;
+const char * const mi_lttng_element_command_list;
+const char * const mi_lttng_element_command_load;
+const char * const mi_lttng_element_command_name;
 const char * const mi_lttng_element_command_output;
+const char * const mi_lttng_element_command_save;
+const char * const mi_lttng_element_command_set_session;
+const char * const mi_lttng_element_command_snapshot;
+const char * const mi_lttng_element_command_snapshot_add;
+const char * const mi_lttng_element_command_snapshot_del;
+const char * const mi_lttng_element_command_snapshot_list;
+const char * const mi_lttng_element_command_snapshot_record;
+const char * const mi_lttng_element_command_start;
+const char * const mi_lttng_element_command_stop;
 const char * const mi_lttng_element_command_success;
+const char * const mi_lttng_element_command_version;
 
 /* Strings related to version command */
 const char * const mi_lttng_element_version;
-const char * const mi_lttng_element_version_str;
-const char * const mi_lttng_element_version_web;
+const char * const mi_lttng_element_version_commit;
+const char * const mi_lttng_element_version_description;
+const char * const mi_lttng_element_version_license;
 const char * const mi_lttng_element_version_major;
 const char * const mi_lttng_element_version_minor;
-const char * const mi_lttng_element_version_license;
-const char * const mi_lttng_element_version_commit;
 const char * const mi_lttng_element_version_patch_level;
-const char * const mi_lttng_element_version_description;
+const char * const mi_lttng_element_version_str;
+const char * const mi_lttng_element_version_web;
 
 /* String related to a lttng_event_field */
 const char * const mi_lttng_element_event_field;
@@ -96,13 +110,15 @@ const char * const mi_lttng_element_save;
 const char * const mi_lttng_element_load;
 
 /* General element of mi_lttng */
-const char * const mi_lttng_element_type_other;
-const char * const mi_lttng_element_type_integer;
+const char * const mi_lttng_element_empty;
+const char * const mi_lttng_element_id;
+const char * const mi_lttng_element_nowrite;
+const char * const mi_lttng_element_success;
 const char * const mi_lttng_element_type_enum;
 const char * const mi_lttng_element_type_float;
+const char * const mi_lttng_element_type_integer;
+const char * const mi_lttng_element_type_other;
 const char * const mi_lttng_element_type_string;
-const char * const mi_lttng_element_nowrite;
-const char * const mi_lttng_element_success;
 
 /* String related to loglevel */
 const char * const mi_lttng_loglevel_str_alert;
@@ -122,6 +138,35 @@ const char * const mi_lttng_loglevel_str_notice;
 const char * const mi_lttng_loglevel_str_unknown;
 const char * const mi_lttng_loglevel_str_warning;
 
+/* String related to loglevel JUL */
+const char * const mi_lttng_loglevel_str_jul_all;
+const char * const mi_lttng_loglevel_str_jul_config;
+const char * const mi_lttng_loglevel_str_jul_fine;
+const char * const mi_lttng_loglevel_str_jul_finer;
+const char * const mi_lttng_loglevel_str_jul_finest;
+const char * const mi_lttng_loglevel_str_jul_info;
+const char * const mi_lttng_loglevel_str_jul_off;
+const char * const mi_lttng_loglevel_str_jul_severe;
+const char * const mi_lttng_loglevel_str_jul_warning;
+
+/* String related to loglevel Log4j */
+const char * const mi_lttng_loglevel_str_log4j_off;
+const char * const mi_lttng_loglevel_str_log4j_fatal;
+const char * const mi_lttng_loglevel_str_log4j_error;
+const char * const mi_lttng_loglevel_str_log4j_warn;
+const char * const mi_lttng_loglevel_str_log4j_info;
+const char * const mi_lttng_loglevel_str_log4j_debug;
+const char * const mi_lttng_loglevel_str_log4j_trace;
+const char * const mi_lttng_loglevel_str_log4j_all;
+
+/* String related to loglevel Python */
+const char * const mi_lttng_loglevel_str_python_critical;
+const char * const mi_lttng_loglevel_str_python_error;
+const char * const mi_lttng_loglevel_str_python_warning;
+const char * const mi_lttng_loglevel_str_python_info;
+const char * const mi_lttng_loglevel_str_python_debug;
+const char * const mi_lttng_loglevel_str_python_notset;
+
 /* String related to loglevel type */
 const char * const mi_lttng_loglevel_type_all;
 const char * const mi_lttng_loglevel_type_range;
@@ -132,8 +177,16 @@ const char * const mi_lttng_loglevel_type_unknown;
 const char * const mi_lttng_element_calibrate;
 const char * const mi_lttng_element_calibrate_function;
 
+/* String related to a lttng_snapshot */
+const char * const mi_lttng_element_snapshot_ctrl_url;
+const char * const mi_lttng_element_snapshot_data_url;
+const char * const mi_lttng_element_snapshot_max_size;
+const char * const mi_lttng_element_snapshot_n_ptr;
+const char * const mi_lttng_element_snapshot_session_name;
+const char * const mi_lttng_element_snapshots;
+
 /* Utility string function  */
-const char *mi_lttng_loglevel_string(int value);
+const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain);
 const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value);
 const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value);
 const char *mi_lttng_domaintype_string(enum lttng_domain_type value);
@@ -300,7 +353,7 @@ int mi_lttng_sessions_open(struct mi_writer *writer);
  * is_open Defines whether or not the session element shall be closed.
  *         This should be used carefully and the client
  *         must close the session element.
- *         Use case: nested addtionnal information on a session
+ *         Use case: nested additional information on a session
  *                  ex: domain,channel event.
  *
  * Returns zero if the element's value could be written.
@@ -401,12 +454,13 @@ int mi_lttng_event_common_attributes(struct mi_writer *writer,
  *
  * writer An instance of a mi writer.
  * event single trace event.
+ * domain Event's domain
  *
  * Returns zero if the element's value could be written.
  * Negative values indicate an error.
  */
 int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
-               struct lttng_event *event);
+               struct lttng_event *event, enum lttng_domain_type domain);
 
 /*
  * Machine interface for kernel tracepoint event with no loglevel.
@@ -469,12 +523,13 @@ int mi_lttng_events_open(struct mi_writer *writer);
  *         This should be used carefully and the client
  *         must close the event element.
  *         Use case: nested additional information
+ * domain Event's domain
  *
  * Returns zero if the element's value could be written.
  * Negative values indicate an error.
  */
 int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
-               int is_open);
+               int is_open, enum lttng_domain_type domain);
 
 /*
  * Machine interface for struct lttng_event_field.
@@ -493,7 +548,7 @@ int mi_lttng_event_field(struct mi_writer *writer,
  *
  * writer An instance of a machine interface writer.
  *
- * Returns zero if the element could be written.
+ * Returns zero if the element have be written.
  * Negative values indicate an error.
  */
 int mi_lttng_event_fields_open(struct mi_writer *writer);
@@ -549,8 +604,6 @@ int mi_lttng_calibrate(struct mi_writer *writer,
  * is_open Define if we close the context element
  *         This should be used carefully and the client
  *         need to close the context element.
- *         0-> False
- *         1-> True
  * Returns zero if the element's value could be written.
  * Negative values indicate an error.
  */
@@ -570,4 +623,117 @@ int mi_lttng_context(struct mi_writer *writer,
 int mi_lttng_perf_counter_context(struct mi_writer *writer,
                struct lttng_event_perf_counter_ctx  *perf_context);
 
+/*
+ * Machine interface of the snapshot list_output.
+ * It specifies the session for which we are listing snapshots,
+ * and it opens a snapshots element to list a sequence
+ * of snapshots.
+ *
+ * writer An instance of a machine interface writer.
+ *
+ * session_name: Snapshot output for session "session_name".
+ *
+ * Note: The client has to close the session and the snapshots elements after
+ * having listed every lttng_snapshot_output.
+ *
+ * Returns zero if the element's value could be written.
+ * Negative values indicate an error.
+ */
+int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
+               const char *session_name);
+
+/*
+ * Machine interface of the snapshot output.
+ * The machine interface serializes the following attributes:
+ * - id: ID of the snapshot output.
+ * - name: Name of the output.
+ * - data_url : Destination of the output.
+ * - ctrl_url: Destination of the output.
+ * - max_size: total size of all stream combined.
+ *
+ * writer An instance of a machine interface writer.
+ *
+ * output: A list of snapshot_output.
+ *
+ * Returns zero if the element's value could be written.
+ * Negative values indicate an error.
+ */
+int mi_lttng_snapshot_list_output(struct mi_writer *writer,
+               struct lttng_snapshot_output *output);
+
+/*
+ * Machine interface of the output of the command snapshot del output
+ * when deleting a snapshot either by id or by name.
+ * If the snapshot was found and successfully deleted using its id,
+ * it return the id of the snapshot and the current session name on which it
+ * was attached.
+ *
+ * Otherwise, it do the same process with the name of the snapshot, if the
+ * snapshot output id is undefined.
+ *
+ * writer An instance of a machine interface writer.
+ *
+ * id: ID of the snapshot output.
+ *
+ * name: Name of the snapshot.
+ *
+ * current_session_name: Session to which the snapshot belongs.
+ *
+ * Returns zero if the element's value could be written.
+ * Negative values indicate an error.
+ */
+int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
+               const char *name, const char *current_session_name);
+
+/*
+ * Machine interface of the output of the command snapshot add output
+ * when adding a snapshot from a user URL.
+ *
+ * If the snapshot was successfully added, the machine interface lists
+ * these information:
+ * - id: ID of the newly add snapshot output.
+ * - current_session_name: Name of the session to which the output was added.
+ * - ctrl_url: Destination of the output.
+ * - max_size: total size of all stream combined.
+ *
+ * writer An instance of a machine interface writer.
+ *
+ * current_session_name: Session to which the snapshot belongs.
+ *
+ * n_ptr:
+ *
+ * output: iterator over a lttng_snapshot_output_list which contain
+ * the snapshot output informations.
+ *
+ * Returns zero if the element's value could be written.
+ * Negative values indicate an error.
+ */
+int mi_lttng_snapshot_add_output(struct mi_writer *writer,
+               const char *current_session_name, const char *n_ptr,
+               struct lttng_snapshot_output *output);
+
+/*
+ * Machine interface of the output of the command snapshot
+ * record  from a URL (if given).
+ *
+ * If the snapshot is successfully recorded from a url, the machine interface
+ * output the following information:
+ * - url: Destination of the output stored in the snapshot.
+ *
+ * Otherwise, the machine interface output the data and ctrl url received
+ * from the command-line.
+ *
+ * writer An instance of a machine interface writer.
+ *
+ * current_session_name: Snapshot record for session "current_session_name".
+ *
+ * ctrl_url, data_url: Destination of the output receive from the command-line.
+ *
+ * Returns zero if the element's value could be written.
+ * Negative values indicate an error.
+ */
+int mi_lttng_snapshot_record(struct mi_writer *writer,
+               const char *current_session_name, const char *url,
+               const char *cmdline_ctrl_url, const char *cmdline_data_url);
+
 #endif /* _MI_LTTNG_H */
This page took 0.028508 seconds and 5 git commands to generate.