1 /**********************************************************************
2 * Copyright (c) 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Matthew Khouzam - Initial implementation and API
11 * Marc-Andre Laperle - Initial implementation and API
12 **********************************************************************/
14 package org
.eclipse
.linuxtools
.internal
.lttng2
.control
.core
.relayd
.lttngviewerCommands
;
16 import java
.nio
.ByteBuffer
;
17 import java
.nio
.ByteOrder
;
22 * @author Matthew Khouzam
25 public class ViewerCommand
implements IRelayCommand
{
30 * fDataSize + fCmdVersion + fCmd
32 public static final int SIZE
= (Long
.SIZE
+ Integer
.SIZE
) / 8 + Command
.SIZE
;
34 * data size following this header, you normally attach a payload that one,
37 private final long fDataSize
;
38 /** enum lttcomm_relayd_command */
39 private final Command fCmd
;
40 /** command version */
41 private final int fCmdVersion
;
44 * Sets the packet command
46 * @param viewerConnect
48 * @param size size of the command
49 * @param version the version number
51 public ViewerCommand(Command viewerConnect
, long size
, int version
) {
54 fCmdVersion
= version
;
60 * @return the DataSize
62 public long getDataSize() {
71 public Command
getCmd() {
76 * Get the command version
78 * @return the CmdVersion
80 public int getCmdVersion() {
85 public byte[] serialize() {
86 byte data
[] = new byte[SIZE
];
87 ByteBuffer bb
= ByteBuffer
.wrap(data
);
88 bb
.order(ByteOrder
.BIG_ENDIAN
);
89 bb
.putLong(getDataSize());
90 bb
.putInt(getCmd().getCommand());
91 bb
.putInt(fCmdVersion
);
This page took 0.035115 seconds and 5 git commands to generate.