2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2015 EfficiOS Inc.
5 * Copyright (C) 2015 Alexandre Montplaisir <alexmonthy@efficios.com>
6 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
9 package org.lttng.ust.agent.client;
11 import java.nio.ByteBuffer;
12 import java.nio.ByteOrder;
14 import org.lttng.ust.agent.client.SessiondCommand.CommandType;
17 * Header of session daemon commands.
19 * @author Alexandre Montplaisir
20 * @author David Goulet
22 class SessiondCommandHeader {
24 /** ABI size of command header. */
25 public static final int HEADER_SIZE = 16;
27 /** Payload size in bytes following this header. */
28 private final long dataSize;
31 private final CommandType cmd;
33 public SessiondCommandHeader(byte[] data) {
34 ByteBuffer buf = ByteBuffer.wrap(data);
35 buf.order(ByteOrder.BIG_ENDIAN);
37 dataSize = buf.getLong();
38 cmd = CommandType.values()[buf.getInt() - 1];
39 buf.getInt(); // command version, currently unused
42 public long getDataSize() {
46 public CommandType getCommandType() {