projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: compile liblttng-ctl as C++
[lttng-tools.git]
/
src
/
common
/
notification.c
diff --git
a/src/common/notification.c
b/src/common/notification.c
index 2544d042fd8192ee309558df6b41e483dc4db3ca..d1403574b1c2401a4941ae0fe389eaac7bbfcdcf 100644
(file)
--- a/
src/common/notification.c
+++ b/
src/common/notification.c
@@
-10,18
+10,17
@@
#include <lttng/condition/evaluation-internal.h>
#include <lttng/condition/condition.h>
#include <lttng/condition/evaluation.h>
#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 <common/payload.h>
#include <common/payload-view.h>
-#include <assert.h>
-LTTNG_HIDDEN
struct lttng_notification *lttng_notification_create(
struct lttng_notification *lttng_notification_create(
- struct lttng_
condition *condition
,
+ struct lttng_
trigger *trigger
,
struct lttng_evaluation *evaluation)
{
struct lttng_notification *notification = NULL;
struct lttng_evaluation *evaluation)
{
struct lttng_notification *notification = NULL;
- if (!
condition
|| !evaluation) {
+ if (!
trigger
|| !evaluation) {
goto end;
}
goto end;
}
@@
-30,13
+29,12
@@
struct lttng_notification *lttng_notification_create(
goto end;
}
goto end;
}
- notification->
condition = condition
;
+ notification->
trigger = trigger
;
notification->evaluation = evaluation;
end:
return notification;
}
notification->evaluation = evaluation;
end:
return notification;
}
-LTTNG_HIDDEN
int lttng_notification_serialize(const struct lttng_notification *notification,
struct lttng_payload *payload)
{
int lttng_notification_serialize(const struct lttng_notification *notification,
struct lttng_payload *payload)
{
@@
-53,7
+51,7
@@
int lttng_notification_serialize(const struct lttng_notification *notification,
}
size_before_payload = payload->buffer.size;
}
size_before_payload = payload->buffer.size;
- ret = lttng_
condition_serialize(notification->condition
,
+ ret = lttng_
trigger_serialize(notification->trigger
,
payload);
if (ret) {
goto end;
payload);
if (ret) {
goto end;
@@
-72,22
+70,30
@@
end:
}
}
-LTTNG_HIDDEN
ssize_t lttng_notification_create_from_payload(
struct lttng_payload_view *src_view,
struct lttng_notification **notification)
{
ssize_t lttng_notification_create_from_payload(
struct lttng_payload_view *src_view,
struct lttng_notification **notification)
{
- ssize_t ret, notification_size = 0, condition_size, evaluation_size;
+ 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_notification_comm *notification_comm;
- struct lttng_condition *condition;
- struct lttng_evaluation *evaluation;
+ const struct lttng_payload_view notification_comm_view =
+ lttng_payload_view_from_view(
+ src_view, 0, sizeof(*notification_comm));
if (!src_view || !notification) {
ret = -1;
if (!src_view || !notification) {
ret = -1;
- goto e
nd
;
+ goto e
rror
;
}
}
- notification_comm = (typeof(notification_comm)) src_view->buffer.data;
+ if (!lttng_payload_view_is_valid(¬ification_comm_view)) {
+ /* Payload not large enough to contain the header. */
+ ret = -1;
+ goto error;
+ }
+
+ notification_comm = (typeof(notification_comm)) notification_comm_view.buffer.data;
notification_size += sizeof(*notification_comm);
{
/* struct lttng_condition */
notification_size += sizeof(*notification_comm);
{
/* struct lttng_condition */
@@
-95,16
+101,16
@@
ssize_t lttng_notification_create_from_payload(
lttng_payload_view_from_view(src_view,
notification_size, -1);
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 e
nd
;
+ if (
trigger
_size < 0) {
+ ret =
trigger
_size;
+ goto e
rror
;
}
}
- notification_size +=
condition
_size;
+ notification_size +=
trigger
_size;
{
/* struct lttng_evaluation */
{
/* struct lttng_evaluation */
@@
-113,33
+119,35
@@
ssize_t lttng_notification_create_from_payload(
notification_size, -1);
evaluation_size = lttng_evaluation_create_from_payload(
notification_size, -1);
evaluation_size = lttng_evaluation_create_from_payload(
+ lttng_trigger_get_const_condition(trigger),
&evaluation_view, &evaluation);
}
if (evaluation_size < 0) {
ret = evaluation_size;
&evaluation_view, &evaluation);
}
if (evaluation_size < 0) {
ret = evaluation_size;
- goto e
nd
;
+ goto e
rror
;
}
notification_size += evaluation_size;
/* Unexpected size of inner-elements; the buffer is corrupted. */
if ((ssize_t) notification_comm->length !=
}
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;
}
ret = -1;
goto error;
}
- *notification = lttng_notification_create(
condition
, evaluation);
+ *notification = lttng_notification_create(
trigger
, evaluation);
if (!*notification) {
ret = -1;
goto error;
}
if (!*notification) {
ret = -1;
goto error;
}
+
ret = notification_size;
ret = notification_size;
-end:
return ret;
return ret;
+
error:
error:
- lttng_
condition_destroy(condition
);
+ lttng_
trigger_destroy(trigger
);
lttng_evaluation_destroy(evaluation);
return ret;
}
lttng_evaluation_destroy(evaluation);
return ret;
}
@@
-150,7
+158,7
@@
void lttng_notification_destroy(struct lttng_notification *notification)
return;
}
return;
}
- lttng_
condition_destroy(notification->condition
);
+ lttng_
trigger_destroy(notification->trigger
);
lttng_evaluation_destroy(notification->evaluation);
free(notification);
}
lttng_evaluation_destroy(notification->evaluation);
free(notification);
}
@@
-158,7
+166,7
@@
void lttng_notification_destroy(struct lttng_notification *notification)
const struct lttng_condition *lttng_notification_get_condition(
struct lttng_notification *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(
}
const struct lttng_evaluation *lttng_notification_get_evaluation(
@@
-166,3
+174,9
@@
const struct lttng_evaluation *lttng_notification_get_evaluation(
{
return notification ? notification->evaluation : NULL;
}
{
return notification ? notification->evaluation : NULL;
}
+
+const struct lttng_trigger *lttng_notification_get_trigger(
+ struct lttng_notification *notification)
+{
+ return notification ? notification->trigger : NULL;
+}
This page took
0.034137 seconds
and
4
git commands to generate.