a2697270a80a33e6267c6d9b688dc146986b0ab1
[lttng-ust.git] /
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
18 package org.lttng.ust.agent.client;
19
20 import java.nio.ByteBuffer;
21 import java.nio.ByteOrder;
22
23 class 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.029802 seconds and 3 git commands to generate.