Add serialization of trigger, condition and action classes
[lttng-tools.git] / src / lib / lttng-ctl / action.c
index cfad63372b623668eaeaee783a8bd62ca4a8b5ef..a97a3463f5500ea4fd0f444b7ba44491aa219c57 100644 (file)
@@ -53,3 +53,31 @@ bool lttng_action_validate(struct lttng_action *action)
 end:
        return valid;
 }
+
+LTTNG_HIDDEN
+ssize_t lttng_action_serialize(struct lttng_action *action, char *buf)
+{
+       ssize_t ret, action_size;
+       struct lttng_action_comm action_comm;
+
+       if (!action) {
+               ret = -1;
+               goto end;
+       }
+
+       action_comm.action_type = (int8_t) action->type;
+       ret = sizeof(struct lttng_action_comm);
+       if (buf) {
+               memcpy(buf, &action_comm, ret);
+               buf += ret;
+       }
+
+       action_size = action->serialize(action, buf);
+       if (action_size < 0) {
+               ret = action_size;
+               goto end;
+       }
+       ret += action_size;
+end:
+       return ret;
+}
This page took 0.023893 seconds and 5 git commands to generate.