Rename Java Agent event names to "event"
[lttng-ust.git] / liblttng-ust-java-agent / java / lttng-ust-agent-common / org / lttng / ust / agent / client / SessiondHeaderCommand.java
CommitLineData
d60dfbe4
AM
1/*
2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18package org.lttng.ust.agent.client;
19
20import java.nio.ByteBuffer;
21import java.nio.ByteOrder;
22
23class SessiondHeaderCommand implements ISessiondCommand {
24
25 /** ABI size of command header. */
26 public static final int HEADER_SIZE = 16;
27
28 /** Payload size in bytes following this header. */
29 private long dataSize;
30 /** Command type. */
31 private LttngAgentCommand cmd;
32
33 @Override
34 public void populate(byte[] data) {
35 ByteBuffer buf = ByteBuffer.wrap(data);
36 buf.order(ByteOrder.BIG_ENDIAN);
37
38 dataSize = buf.getLong();
39 cmd = LttngAgentCommand.values()[buf.getInt() - 1];
40 buf.getInt(); // command version, currently unused
41 }
42
43 public long getDataSize() {
44 return dataSize;
45 }
46
47 public LttngAgentCommand getCommandType() {
48 return cmd;
49 }
50}
This page took 0.024763 seconds and 4 git commands to generate.