#include <lttng/condition/evaluation-internal.h>
#include <lttng/condition/condition.h>
#include <lttng/condition/evaluation.h>
+#include <lttng/trigger/trigger-internal.h>
#include <common/payload.h>
#include <common/payload-view.h>
#include <assert.h>
LTTNG_HIDDEN
struct lttng_notification *lttng_notification_create(
- struct lttng_condition *condition,
+ struct lttng_trigger *trigger,
struct lttng_evaluation *evaluation)
{
struct lttng_notification *notification = NULL;
- if (!condition || !evaluation) {
+ if (!trigger || !evaluation) {
goto end;
}
goto end;
}
- notification->condition = condition;
+ notification->trigger = trigger;
notification->evaluation = evaluation;
end:
return notification;
}
size_before_payload = payload->buffer.size;
- ret = lttng_condition_serialize(notification->condition,
+ ret = lttng_trigger_serialize(notification->trigger,
payload);
if (ret) {
goto end;
struct lttng_payload_view *src_view,
struct lttng_notification **notification)
{
- ssize_t ret, notification_size = 0, condition_size, evaluation_size;
- struct lttng_condition *condition;
- struct lttng_evaluation *evaluation;
+ ssize_t ret, notification_size = 0, trigger_size, evaluation_size;
+ struct lttng_trigger *trigger = NULL;
+ struct lttng_evaluation *evaluation = NULL;
const struct lttng_notification_comm *notification_comm;
const struct lttng_payload_view notification_comm_view =
lttng_payload_view_from_view(
if (!src_view || !notification) {
ret = -1;
- goto end;
+ goto error;
}
if (!lttng_payload_view_is_valid(¬ification_comm_view)) {
/* Payload not large enough to contain the header. */
ret = -1;
- goto end;
+ goto error;
}
notification_comm = (typeof(notification_comm)) notification_comm_view.buffer.data;
lttng_payload_view_from_view(src_view,
notification_size, -1);
- condition_size = lttng_condition_create_from_payload(
- &condition_view, &condition);
+ trigger_size = lttng_trigger_create_from_payload(
+ &condition_view, &trigger);
}
- if (condition_size < 0) {
- ret = condition_size;
- goto end;
+ if (trigger_size < 0) {
+ ret = trigger_size;
+ goto error;
}
- notification_size += condition_size;
+ notification_size += trigger_size;
{
/* struct lttng_evaluation */
notification_size, -1);
evaluation_size = lttng_evaluation_create_from_payload(
- condition, &evaluation_view, &evaluation);
+ lttng_trigger_get_const_condition(trigger),
+ &evaluation_view, &evaluation);
}
if (evaluation_size < 0) {
ret = evaluation_size;
- goto end;
+ goto error;
}
notification_size += evaluation_size;
/* Unexpected size of inner-elements; the buffer is corrupted. */
if ((ssize_t) notification_comm->length !=
- condition_size + evaluation_size) {
+ trigger_size + evaluation_size) {
ret = -1;
goto error;
}
- *notification = lttng_notification_create(condition, evaluation);
+ *notification = lttng_notification_create(trigger, evaluation);
if (!*notification) {
ret = -1;
goto error;
}
+
ret = notification_size;
-end:
return ret;
+
error:
- lttng_condition_destroy(condition);
+ lttng_trigger_destroy(trigger);
lttng_evaluation_destroy(evaluation);
return ret;
}
return;
}
- lttng_condition_destroy(notification->condition);
+ lttng_trigger_destroy(notification->trigger);
lttng_evaluation_destroy(notification->evaluation);
free(notification);
}
const struct lttng_condition *lttng_notification_get_condition(
struct lttng_notification *notification)
{
- return notification ? notification->condition : NULL;
+ return notification ? lttng_trigger_get_const_condition(notification->trigger) : NULL;
}
const struct lttng_evaluation *lttng_notification_get_evaluation(
{
return notification ? notification->evaluation : NULL;
}
+
+const struct lttng_trigger *lttng_notification_get_trigger(
+ struct lttng_notification *notification)
+{
+ return notification ? notification->trigger : NULL;
+}