+int lttng_enable_channel(struct lttng_handle *handle,
+ struct lttng_channel *in_chan)
+{
+ struct lttcomm_session_msg lsm;
+
+ /* NULL arguments are forbidden. No default values. */
+ if (handle == NULL || in_chan == NULL) {
+ return -LTTNG_ERR_INVALID;
+ }
+
+ memset(&lsm, 0, sizeof(lsm));
+ memcpy(&lsm.u.channel.chan, in_chan, sizeof(lsm.u.channel.chan));
+ lsm.u.channel.chan.attr.extended.ptr = NULL;
+
+ if (!in_chan->attr.extended.ptr) {
+ struct lttng_channel *channel;
+ struct lttng_channel_extended *extended;
+
+ channel = lttng_channel_create(&handle->domain);
+ if (!channel) {
+ return -LTTNG_ERR_NOMEM;
+ }
+
+ /*
+ * Create a new channel in order to use default extended
+ * attribute values.
+ */
+ extended = (struct lttng_channel_extended *)
+ channel->attr.extended.ptr;
+ memcpy(&lsm.u.channel.extended, extended, sizeof(*extended));
+ lttng_channel_destroy(channel);
+ } else {
+ struct lttng_channel_extended *extended;
+
+ extended = (struct lttng_channel_extended *)
+ in_chan->attr.extended.ptr;
+ memcpy(&lsm.u.channel.extended, extended, sizeof(*extended));
+ }
+
+ lsm.cmd_type = LTTNG_ENABLE_CHANNEL;
+ lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain);
+
+ lttng_ctl_copy_string(lsm.session.name, handle->session_name,
+ sizeof(lsm.session.name));
+
+ return lttng_ctl_ask_sessiond(&lsm, NULL);
+}
+
+/*
+ * All tracing will be stopped for registered events of the channel.
+ * Returns size of returned session payload data or a negative error code.
+ */
+int lttng_disable_channel(struct lttng_handle *handle, const char *name)
+{
+ struct lttcomm_session_msg lsm;
+
+ /* Safety check. Both are mandatory. */
+ if (handle == NULL || name == NULL) {
+ return -LTTNG_ERR_INVALID;
+ }
+
+ memset(&lsm, 0, sizeof(lsm));
+
+ lsm.cmd_type = LTTNG_DISABLE_CHANNEL;
+
+ lttng_ctl_copy_string(lsm.u.disable.channel_name, name,
+ sizeof(lsm.u.disable.channel_name));
+
+ lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain);
+
+ lttng_ctl_copy_string(lsm.session.name, handle->session_name,
+ sizeof(lsm.session.name));
+
+ return lttng_ctl_ask_sessiond(&lsm, NULL);
+}
+
+/*
+ * Add PID to session tracker.
+ * Return 0 on success else a negative LTTng error code.
+ */
+int lttng_track_pid(struct lttng_handle *handle, int pid)
+{
+ struct lttcomm_session_msg lsm;
+
+ /* NULL arguments are forbidden. No default values. */
+ if (handle == NULL) {
+ return -LTTNG_ERR_INVALID;
+ }
+
+ memset(&lsm, 0, sizeof(lsm));
+
+ lsm.cmd_type = LTTNG_TRACK_PID;
+ lsm.u.pid_tracker.pid = pid;
+
+ lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain);
+
+ lttng_ctl_copy_string(lsm.session.name, handle->session_name,
+ sizeof(lsm.session.name));
+
+ return lttng_ctl_ask_sessiond(&lsm, NULL);
+}
+
+/*
+ * Remove PID from session tracker.
+ * Return 0 on success else a negative LTTng error code.
+ */
+int lttng_untrack_pid(struct lttng_handle *handle, int pid)
+{
+ struct lttcomm_session_msg lsm;
+
+ /* NULL arguments are forbidden. No default values. */
+ if (handle == NULL) {
+ return -LTTNG_ERR_INVALID;
+ }
+
+ memset(&lsm, 0, sizeof(lsm));
+
+ lsm.cmd_type = LTTNG_UNTRACK_PID;
+ lsm.u.pid_tracker.pid = pid;
+
+ lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain);
+
+ lttng_ctl_copy_string(lsm.session.name, handle->session_name,
+ sizeof(lsm.session.name));
+
+ return lttng_ctl_ask_sessiond(&lsm, NULL);
+}
+
+/*
+ * Lists all available tracepoints of domain.
+ * Sets the contents of the events array.
+ * Returns the number of lttng_event entries in events;
+ * on error, returns a negative value.
+ */
+int lttng_list_tracepoints(struct lttng_handle *handle,
+ struct lttng_event **events)