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
.tracecompass
.internal
.lttng2
.control
.core
.relayd
.lttngviewerCommands
;
16 import java
.nio
.ByteBuffer
;
17 import java
.nio
.ByteOrder
;
22 * @author Matthew Khouzam
24 public class ViewerCommand
implements IRelayCommand
{
29 * fDataSize + fCmdVersion + fCmd
31 public static final int SIZE
= (Long
.SIZE
+ Integer
.SIZE
) / 8 + Command
.SIZE
;
33 * data size following this header, you normally attach a payload that one,
36 private final long fDataSize
;
37 /** enum lttcomm_relayd_command */
38 private final Command fCmd
;
39 /** command version */
40 private final int fCmdVersion
;
43 * Sets the packet command
45 * @param viewerConnect
47 * @param size size of the command
48 * @param version the version number
50 public ViewerCommand(Command viewerConnect
, long size
, int version
) {
53 fCmdVersion
= version
;
59 * @return the DataSize
61 public long getDataSize() {
70 public Command
getCmd() {
75 * Get the command version
77 * @return the CmdVersion
79 public int getCmdVersion() {
84 public byte[] serialize() {
85 byte data
[] = new byte[SIZE
];
86 ByteBuffer bb
= ByteBuffer
.wrap(data
);
87 bb
.order(ByteOrder
.BIG_ENDIAN
);
88 bb
.putLong(getDataSize());
89 bb
.putInt(getCmd().getCommand());
90 bb
.putInt(fCmdVersion
);
This page took 0.052626 seconds and 5 git commands to generate.