lttng: Remove capital letter in package name
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 23 Apr 2015 19:25:06 +0000 (15:25 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 7 May 2015 17:23:29 +0000 (13:23 -0400)
Rename lttng2.control.core.relayd.lttngviewerCommands to
.commands. Package names should not contain capital letters.

Change-Id: I250f9a72b2ea966e0c3e3e6568d87cab5a77dc9e
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/46378
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
65 files changed:
org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/relayd/LttngRelayd24Test.java
org.eclipse.tracecompass.lttng2.control.core/META-INF/MANIFEST.MF
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/ILttngRelaydConnector.java
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/LttngRelaydConnectorFactory.java
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachReturnCode.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachSessionRequest.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachSessionResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/Command.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ConnectResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ConnectionType.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/CreateSessionResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/CreateSessionReturnCode.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetMetadata.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetMetadataReturnCode.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetNextIndex.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetPacket.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetPacketReturnCode.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IBaseCommand.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IRelayCommand.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IRelayResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IndexResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ListSessionsResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/LttngViewerCommands.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/MetadataPacketResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsRequest.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsReturnCode.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NextIndexReturnCode.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/SeekCommand.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/SessionResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/StreamResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/TracePacketResponse.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ViewerCommand.java [new file with mode: 0644]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/impl/LttngRelaydConnector_2_4.java
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/impl/LttngRelaydConnector_Unsupported.java
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachReturnCode.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachSessionRequest.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachSessionResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/Command.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ConnectResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ConnectionType.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/CreateSessionResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/CreateSessionReturnCode.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetMetadata.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetMetadataReturnCode.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetNextIndex.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetPacket.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetPacketReturnCode.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IBaseCommand.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IRelayCommand.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IRelayResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IndexResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ListSessionsResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/LttngViewerCommands.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/MetadataPacketResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsRequest.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsReturnCode.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NextIndexReturnCode.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/SeekCommand.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/SessionResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/StreamResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/TracePacketResponse.java [deleted file]
org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ViewerCommand.java [deleted file]
org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/relayd/LttngRelaydConsumer.java

index 73715e1c315bba8fae59d69e3d42d63f415a56f0..85334590b497cf6ad19150435f051e11528605f4 100644 (file)
@@ -25,17 +25,17 @@ import java.util.List;
 
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.ILttngRelaydConnector;
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.LttngRelaydConnectorFactory;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.AttachSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.Command;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ConnectResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.CreateSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.CreateSessionReturnCode;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.GetNextIndex;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.IndexResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.NextIndexReturnCode;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.SessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.StreamResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ViewerCommand;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.AttachSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.Command;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ConnectResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.CreateSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.CreateSessionReturnCode;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.GetNextIndex;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.IndexResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.NextIndexReturnCode;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.SessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.StreamResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ViewerCommand;
 import org.junit.Test;
 
 /**
index 61e5f092109cc63c560014605f14941593502c58..9bcb35bc7d83779092fbfc5dbd65b0650d0e9ab9 100644 (file)
@@ -16,7 +16,7 @@ Export-Package: org.eclipse.tracecompass.internal.lttng2.control.core;x-friends:
  org.eclipse.tracecompass.internal.lttng2.control.core.model;x-friends:="org.eclipse.tracecompass.lttng2.control.ui,org.eclipse.tracecompass.lttng2.control.ui.tests,org.eclipse.tracecompass.lttng2.control.core.tests",
  org.eclipse.tracecompass.internal.lttng2.control.core.model.impl;x-friends:="org.eclipse.tracecompass.lttng2.control.ui,org.eclipse.tracecompass.lttng2.control.ui.tests,org.eclipse.tracecompass.lttng2.control.core.tests",
  org.eclipse.tracecompass.internal.lttng2.control.core.relayd;x-friends:="org.eclipse.tracecompass.lttng2.control.core.tests,org.eclipse.tracecompass.lttng2.control.ui,org.eclipse.tracecompass.lttng2.control.ui.tests",
+ org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;x-friends:="org.eclipse.tracecompass.lttng2.control.core.tests,org.eclipse.tracecompass.lttng2.control.ui,org.eclipse.tracecompass.lttng2.control.ui.tests",
  org.eclipse.tracecompass.internal.lttng2.control.core.relayd.impl;x-friends:="org.eclipse.tracecompass.lttng2.control.core.tests,org.eclipse.tracecompass.lttng2.control.ui,org.eclipse.tracecompass.lttng2.control.ui.tests",
- org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;x-friends:="org.eclipse.tracecompass.lttng2.control.core.tests,org.eclipse.tracecompass.lttng2.control.ui,org.eclipse.tracecompass.lttng2.control.ui.tests",
  org.eclipse.tracecompass.lttng2.control.core.session
 Import-Package: com.google.common.collect
index 1f79162b3534f9dd7759b84aa4e64aaf2fccdbeb..88862b025d8377041fd389a16f1375f8a83a794a 100644 (file)
@@ -15,12 +15,12 @@ package org.eclipse.tracecompass.internal.lttng2.control.core.relayd;
 import java.io.IOException;
 import java.util.List;
 
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.AttachSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.CreateSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.IndexResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.SessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.StreamResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.TracePacketResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.AttachSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.CreateSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.IndexResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.SessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.StreamResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.TracePacketResponse;
 
 /**
  * Connector for Lttng Relayd
index 0f813761e2717bdb088d4df6e5877eeb60557045..faac481941f7631316ba9b44fd3e425e41228236 100644 (file)
@@ -17,12 +17,12 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.net.Socket;
 
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.Command;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ConnectResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ConnectionType;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ViewerCommand;
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.impl.LttngRelaydConnector_2_4;
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.impl.LttngRelaydConnector_Unsupported;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.Command;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ConnectResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ConnectionType;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ViewerCommand;
 
 /**
  * LTTng RelayD connector factory
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachReturnCode.java
new file mode 100644 (file)
index 0000000..d81fed8
--- /dev/null
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Return codes for "viewer attach" command
+ *
+ * @author Matthew Khouzam
+ */
+public enum AttachReturnCode implements IBaseCommand {
+
+    /** If the attach command succeeded. */
+    VIEWER_ATTACH_OK(1),
+    /** If a viewer is already attached. */
+    VIEWER_ATTACH_ALREADY(2),
+    /** If the session ID is unknown. */
+    VIEWER_ATTACH_UNK(3),
+    /** If the session is not live. */
+    VIEWER_ATTACH_NOT_LIVE(4),
+    /** Seek error. */
+    VIEWER_ATTACH_SEEK_ERR(5),
+    /** No session */
+    VIEWER_ATTACH_NO_SESSION(6);
+
+    private final int fCode;
+
+    private AttachReturnCode(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachSessionRequest.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachSessionRequest.java
new file mode 100644 (file)
index 0000000..cf9ee7b
--- /dev/null
@@ -0,0 +1,80 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * VIEWER_ATTACH_SESSION payload.
+ *
+ * @author Matthew Khouzam
+ */
+public class AttachSessionRequest implements IRelayCommand {
+
+    /**
+     * Command size
+     *
+     * fSessionId + fOffset + fSeek
+     */
+    public static final int SIZE = (Long.SIZE + Long.SIZE) / 8 + SeekCommand.SIZE;
+    /** the id of a session */
+    private final long fSessionId;
+    /** unused for now */
+    private final long fOffset;
+    /** enum lttng_viewer_seek */
+    private final SeekCommand fSeek;
+
+    /**
+     * Attach session request constructor
+     *
+     * @param id
+     *            the session id
+     * @param seekCommand
+     *            the seek command
+     */
+    public AttachSessionRequest(long id, SeekCommand seekCommand) {
+        this(id, 0, seekCommand);
+    }
+
+    /**
+     * Attach session request constructor
+     *
+     * @param id
+     *            the session id
+     * @param offset
+     *            unused for now
+     * @param seekCommand
+     *            the seek command
+     */
+
+    public AttachSessionRequest(long id, int offset, SeekCommand seekCommand) {
+        fSessionId = id;
+        fOffset = offset;
+        fSeek = seekCommand;
+
+    }
+
+    @Override
+    public byte[] serialize() {
+        byte data[] = new byte[SIZE];
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        bb.putLong(fSessionId);
+        bb.putLong(fOffset);
+        bb.putInt(fSeek.getCommand());
+        return data;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachSessionResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/AttachSessionResponse.java
new file mode 100644 (file)
index 0000000..d30876a
--- /dev/null
@@ -0,0 +1,94 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.List;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+/**
+ * Attach session response
+ *
+ * @author Matthew Khouzam
+ */
+public class AttachSessionResponse implements IRelayResponse {
+
+    /**
+     * Response size
+     *
+     * fStatus + fStreamsCount (first half of a packet) */
+    private static final int SIZE = (Integer.SIZE + Integer.SIZE) / 8;
+    /** enum lttng_viewer_attach_return_code */
+    private final AttachReturnCode fStatus;
+    /** how many streams are there */
+    private final int fStreamsCount;
+    /** public class lttng_viewer_stream */
+    private final List<StreamResponse> fStreamList;
+
+    /**
+     * Attach session response network constructor
+     *
+     * @param inNet
+     *            network input stream
+     * @throws IOException
+     *             network error
+     */
+    public AttachSessionResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[SIZE];
+        inNet.readFully(data, 0, SIZE);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fStatus = AttachReturnCode.values()[bb.getInt() - 1];
+        fStreamsCount = bb.getInt();
+        Builder<StreamResponse> streamResponses = ImmutableList.builder();
+        for (int i = 0; i < getNbStreams(); i++) {
+            streamResponses.add(new StreamResponse(inNet));
+        }
+        fStreamList = streamResponses.build();
+
+    }
+
+    /**
+     * Gets the Status
+     *
+     * @return the Status
+     */
+    public AttachReturnCode getStatus() {
+        return fStatus;
+    }
+
+    /**
+     * Gets the StreamsCount
+     *
+     * @return the StreamsCount
+     */
+    public int getNbStreams() {
+        return fStreamsCount;
+    }
+
+    /**
+     * Gets the StreamList
+     *
+     * @return the StreamList
+     */
+    public List<StreamResponse> getStreamList() {
+        return fStreamList;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/Command.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/Command.java
new file mode 100644 (file)
index 0000000..706d189
--- /dev/null
@@ -0,0 +1,55 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Viewer commands
+ *
+ * @author Matthew Khouzam
+ */
+public enum Command implements IBaseCommand {
+
+    /** get version */
+    VIEWER_CONNECT(1),
+    /** list all lttng sessions */
+    VIEWER_LIST_SESSIONS(2),
+    /** attach to a session */
+    VIEWER_ATTACH_SESSION(3),
+    /** get the next index */
+    VIEWER_GET_NEXT_INDEX(4),
+    /** get packet */
+    VIEWER_GET_PACKET(5),
+    /** get metadata */
+    VIEWER_GET_METADATA(6),
+    /** get new streams */
+    VIEWER_GET_NEW_STREAMS(7),
+    /** create a new session */
+    VIEWER_CREATE_SESSION(8);
+
+    /**
+     * Command size (fCode)
+     */
+    public static final int SIZE = Integer.SIZE / 8;
+
+    private final int fCode;
+
+    private Command(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ConnectResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ConnectResponse.java
new file mode 100644 (file)
index 0000000..e608151
--- /dev/null
@@ -0,0 +1,118 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * CONNECT payload.
+ *
+ * @author Matthew Khouzam
+ */
+public class ConnectResponse implements IRelayResponse, IRelayCommand {
+
+    /**
+     * Response or command size
+     *
+     * fViewerSessionId + fMajor + fMinor + fType
+     */
+    public static final int SIZE = (Long.SIZE + Integer.SIZE + Integer.SIZE + Integer.SIZE) / 8;
+    /** session id, counts from 1 and increments by session */
+    private final long fViewerSessionId;
+    /**
+     * Major version, hint, it's at least 2
+     */
+    private final int fMajor;
+    /**
+     * Minor version, hint, it's at least 4
+     */
+    private final int fMinor;
+    /**
+     * type of connect to {@link ConnectionType}
+     */
+    private final ConnectionType fType;
+
+    /**
+     * Connection response reply constructor
+     *
+     * @param inStream
+     *            the data input stream
+     * @throws IOException
+     *             a network error
+     */
+    public ConnectResponse(DataInputStream inStream) throws IOException {
+        byte data[] = new byte[SIZE];
+        inStream.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fViewerSessionId = bb.getLong();
+        fMajor = bb.getInt();
+        fMinor = bb.getInt();
+        bb.getInt(); // Should not be used, see http://bugs.lttng.org/issues/728
+        fType = ConnectionType.VIEWER_CLIENT_COMMAND;
+    }
+
+    /**
+     * Constructor for command
+     *
+     * @param sessionID
+     *            session id
+     * @param major
+     *            the major version
+     * @param minor
+     *            the minor version
+     * @param connection
+     *            the connection type, typically VIEWER_CLIENT_COMMAND
+     */
+    public ConnectResponse(long sessionID, int major, int minor, ConnectionType connection) {
+        fViewerSessionId = sessionID;
+        fMajor = major;
+        fMinor = minor;
+        fType = connection;
+    }
+
+    /**
+     * get the major version
+     *
+     * @return the major version
+     */
+    public int getMajor() {
+        return fMajor;
+    }
+
+    /**
+     * get the minor version
+     *
+     * @return the minor version
+     */
+    public int getMinor() {
+        return fMinor;
+    }
+
+    @Override
+    public byte[] serialize() {
+        byte data[] = new byte[SIZE];
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        bb.putLong(fViewerSessionId);
+        bb.putInt(fMajor);
+        bb.putInt(fMinor);
+        bb.putInt(fType.getCommand());
+        return data;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ConnectionType.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ConnectionType.java
new file mode 100644 (file)
index 0000000..a89c374
--- /dev/null
@@ -0,0 +1,39 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Get viewer connection type
+ *
+ * @author Matthew Khouzam
+ */
+public enum ConnectionType implements IBaseCommand {
+
+    /** Command sent */
+    VIEWER_CLIENT_COMMAND(1),
+    /** Notification sent */
+    VIEWER_CLIENT_NOTIFICATION(2);
+
+    private final int fCode;
+
+    private ConnectionType(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/CreateSessionResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/CreateSessionResponse.java
new file mode 100644 (file)
index 0000000..6e988f6
--- /dev/null
@@ -0,0 +1,61 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Response to a "create session" command
+ *
+ * @author Matthew Khouzam
+ */
+public class CreateSessionResponse implements IRelayResponse {
+
+    /**
+     * Response size (fStatus)
+     */
+    public static final int SIZE = Integer.SIZE / 8;
+
+    /** enum lttng_viewer_create_session_return_code */
+    private final CreateSessionReturnCode fStatus;
+
+    /**
+     * Create session response network constructor
+     *
+     * @param inNet
+     *            network input stream
+     * @throws IOException
+     *             network error
+     */
+    public CreateSessionResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[SIZE];
+        inNet.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fStatus = (CreateSessionReturnCode.values()[bb.getInt() - 1]);
+    }
+
+    /**
+     * Get status
+     *
+     * @return the status
+     */
+    public CreateSessionReturnCode getStatus() {
+        return fStatus;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/CreateSessionReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/CreateSessionReturnCode.java
new file mode 100644 (file)
index 0000000..cd910a2
--- /dev/null
@@ -0,0 +1,38 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Create new session return code
+ *
+ * @author Matthew Khouzam
+ */
+public enum CreateSessionReturnCode implements IBaseCommand {
+
+    /** If new streams are being sent. */
+    LTTNG_VIEWER_CREATE_SESSION_OK(1),
+    /** Fatal error on the server-side. */
+    LTTNG_VIEWER_CREATE_SESSION_ERR(2);
+
+    private final int fCode;
+
+    private CreateSessionReturnCode(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetMetadata.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetMetadata.java
new file mode 100644 (file)
index 0000000..13c61dc
--- /dev/null
@@ -0,0 +1,64 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * VIEWER_GET_METADATA payload.
+ *
+ * @author Matthew Khouzam
+ */
+public class GetMetadata implements IRelayCommand {
+
+    /**
+     * Command size (fStreamId)
+     */
+    public static final int SIZE = Long.SIZE / 8;
+
+    /**
+     * The stream id
+     */
+    private final long fStreamId;
+
+    /**
+     * Set the stream id
+     *
+     * @param streamId
+     *            the stream id
+     */
+    public GetMetadata(long streamId) {
+        fStreamId = streamId;
+    }
+
+    /**
+     * Get the stream id
+     *
+     * @return the stream id
+     */
+    public long getStreamId() {
+        return fStreamId;
+    }
+
+    @Override
+    public byte[] serialize() {
+        byte data[] = new byte[SIZE];
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        bb.putLong(getStreamId());
+        return data;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetMetadataReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetMetadataReturnCode.java
new file mode 100644 (file)
index 0000000..f126dc4
--- /dev/null
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Get metadata return code
+ *
+ * @author Matthew Khouzam
+ */
+public enum GetMetadataReturnCode implements IBaseCommand {
+
+    /** Response was OK */
+    VIEWER_METADATA_OK(1),
+    /** Response was nothing new */
+    VIEWER_NO_NEW_METADATA(2),
+    /** Response was Error */
+    VIEWER_METADATA_ERR(3);
+
+    private final int fCode;
+
+    private GetMetadataReturnCode(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetNextIndex.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetNextIndex.java
new file mode 100644 (file)
index 0000000..697789a
--- /dev/null
@@ -0,0 +1,63 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * VIEWER_GET_NEXT_INDEX payload.
+ *
+ * @author Matthew Khouzam
+ */
+public class GetNextIndex implements IRelayCommand {
+
+    /**
+     * Command size (fStreamId)
+     */
+    public static final int SIZE = Long.SIZE / 8;
+    /**
+     * the id of the stream
+     */
+    private final long fStreamId;
+
+    /**
+     * Constructor
+     *
+     * @param streamId
+     *            the index stream id
+     */
+    public GetNextIndex(long streamId) {
+        fStreamId = streamId;
+    }
+
+    /**
+     * Gets the stream id
+     *
+     * @return the stream id
+     */
+    public long getStreamId() {
+        return fStreamId;
+    }
+
+    @Override
+    public byte[] serialize() {
+        byte data[] = new byte[SIZE];
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        bb.putLong(getStreamId());
+        return data;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetPacket.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetPacket.java
new file mode 100644 (file)
index 0000000..2eb0483
--- /dev/null
@@ -0,0 +1,93 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * VIEWER_GET_PACKET payload.
+ *
+ * @author Matthew Khouzam
+ */
+public class GetPacket implements IRelayCommand {
+
+    /**
+     * Command size
+     *
+     * fStreamId + fOffset + fLength
+     */
+    public static final int SIZE = (Long.SIZE + Long.SIZE + Integer.SIZE) / 8;
+    /** the stream Id */
+    private final long fStreamId;
+    /** the offset */
+    private final long fOffset;
+    /** the length of the packet */
+    private final int fLength;
+
+    /**
+     * Get packet constructor
+     *
+     * @param streamId
+     *            the stream id
+     * @param offset
+     *            the offset
+     * @param length
+     *            the packet length
+     */
+    public GetPacket(long streamId, long offset, int length) {
+        fStreamId = streamId;
+        fOffset = offset;
+        fLength = length;
+    }
+
+    /**
+     * Get the length of the packet
+     *
+     * @return the length of the packet in bytes
+     */
+    public int getLength() {
+        return fLength;
+    }
+
+    /**
+     * Gets the offset of the packet
+     *
+     * @return the offset
+     */
+    public long getOffset() {
+        return fOffset;
+    }
+
+    /**
+     * Gets the stream id
+     *
+     * @return the stream id
+     */
+    public long getStreamId() {
+        return fStreamId;
+    }
+
+    @Override
+    public byte[] serialize() {
+        byte data[] = new byte[SIZE];
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        bb.putLong(getStreamId());
+        bb.putLong(getOffset());
+        bb.putInt(getLength());
+        return data;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetPacketReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/GetPacketReturnCode.java
new file mode 100644 (file)
index 0000000..b46d171
--- /dev/null
@@ -0,0 +1,43 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Get packet return code
+ *
+ * @author Matthew Khouzam
+ */
+public enum GetPacketReturnCode implements IBaseCommand {
+
+    /** Response was OK */
+    VIEWER_GET_PACKET_OK(1),
+    /** Response was RETRY */
+    VIEWER_GET_PACKET_RETRY(2),
+    /** Response was ERROR */
+    VIEWER_GET_PACKET_ERR(3),
+    /** Response was End of File */
+    VIEWER_GET_PACKET_EOF(4);
+
+    private final int fCode;
+
+    private GetPacketReturnCode(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IBaseCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IBaseCommand.java
new file mode 100644 (file)
index 0000000..16fe7b3
--- /dev/null
@@ -0,0 +1,29 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Instruction to send to relayd
+ *
+ * @author Matthew Khouzam
+ */
+public interface IBaseCommand {
+
+    /**
+     * gets the numerical value of the command
+     *
+     * @return the numerical value of the command
+     */
+    int getCommand();
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IRelayCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IRelayCommand.java
new file mode 100644 (file)
index 0000000..4c0f5e6
--- /dev/null
@@ -0,0 +1,30 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+
+/**
+ * Command sent, needs a getBytes to stream the data
+ *
+ * @author Matthew Khouzam
+ */
+public interface IRelayCommand {
+
+    /**
+     * Gets a byte array of the command so that it may be streamed
+     *
+     * @return the byte array of the command
+     */
+    byte[] serialize();
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IRelayResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IRelayResponse.java
new file mode 100644 (file)
index 0000000..b034da6
--- /dev/null
@@ -0,0 +1,23 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Command response, this will allow sorting commands easier
+ *
+ * @author Matthew Khouzam
+ */
+public interface IRelayResponse {
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IndexResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/IndexResponse.java
new file mode 100644 (file)
index 0000000..ebfcf88
--- /dev/null
@@ -0,0 +1,162 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * An Lttng packet index
+ *
+ * @author Matthew Khouzam
+ */
+public class IndexResponse implements IRelayResponse {
+
+    /**
+     * Command size
+     *
+     * Sum of the field sizes / 8 ( 7 longs and 2 ints):
+     * fOffset + fPacketSize + fContentSize + fTimestampBegin + fTimestampEnd +
+     * fEventsDiscarded + fStreamId + fStatus + fFlags
+     */
+    public static final int SIZE =
+            (Long.SIZE * 7 + Integer.SIZE * 2) / 8;
+
+    /** the offset */
+    private final long fOffset;
+    /** packet_size */
+    private final long fPacketSize;
+    /** the content size - how much of the packet is used */
+    private final long fContentSize;
+    /** timestamp of the beginning of the packet */
+    private final long fTimestampBegin;
+    /** timestamp of the end of the packet */
+    private final long fTimestampEnd;
+    /** number of discarded events BEFORE this packet */
+    private final long fEventsDiscarded;
+    /** the CTF stream id */
+    private final long fStreamId;
+    /** the status of the getNextIndex request */
+    private final NextIndexReturnCode fStatus;
+    /** whether there are new streams or metadata */
+    private final int fFlags;
+
+    /**
+     * IndexResposne from network
+     *
+     * @param inNet
+     *            data input stream
+     * @throws IOException
+     *             network error
+     */
+    public IndexResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[SIZE];
+        inNet.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fOffset = bb.getLong();
+        fPacketSize = bb.getLong();
+        fContentSize = bb.getLong();
+        fTimestampBegin = bb.getLong();
+        fTimestampEnd = bb.getLong();
+        fEventsDiscarded = bb.getLong();
+        fStreamId = bb.getLong();
+        fStatus = NextIndexReturnCode.values()[bb.getInt() - 1];
+        fFlags = bb.getInt();
+    }
+
+    /**
+     * Gets the offset
+     *
+     * @return the offset
+     */
+    public long getOffset() {
+        return fOffset;
+    }
+
+    /**
+     * Gets the packet size
+     *
+     * @return the packet size
+     */
+    public long getPacketSize() {
+        return fPacketSize;
+    }
+
+    /**
+     * Gets the content size - how much of the packet is used
+     *
+     * @return the content size
+     */
+    public long getContentSize() {
+        return fContentSize;
+    }
+
+    /**
+     * Gets the timestamp of the beginning of the packet
+     *
+     * @return the timestamp of the beginning of the packet
+     */
+    public long getTimestampBegin() {
+        return fTimestampBegin;
+    }
+
+    /**
+     * Gets the timestamp of the end of the packet
+     *
+     * @return the timestamp of the end of the packet
+     */
+    public long getTimestampEnd() {
+        return fTimestampEnd;
+    }
+
+    /**
+     * Gets the number of discarded events BEFORE this packet
+     *
+     * @return the number of discarded events BEFORE this packet
+     */
+    public long getEventsDiscarded() {
+        return fEventsDiscarded;
+    }
+
+    /**
+     * Gets the CTF stream id
+     *
+     * @return the CTF stream id
+     */
+    public long getStreamId() {
+        return fStreamId;
+    }
+
+    /**
+     * Gets the status
+     *
+     * @return the status
+     */
+    public NextIndexReturnCode getStatus() {
+        return fStatus;
+    }
+
+    /**
+     * Gets the flags that describe whether there are new streams or metadata
+     *
+     * @return the flags
+     */
+    public int getFlags() {
+        return fFlags;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ListSessionsResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ListSessionsResponse.java
new file mode 100644 (file)
index 0000000..532c8a5
--- /dev/null
@@ -0,0 +1,71 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.List;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+/**
+ * VIEWER_LIST_SESSIONS payload.
+ *
+ * @author Matthew Khouzam
+ */
+public class ListSessionsResponse implements IRelayResponse {
+
+    /**
+     * Response size (nbSessions)
+     */
+    public static final int PACKET_FIXED_SIZE = Integer.SIZE / 8;
+
+    /** the list of sessions */
+    private final List<SessionResponse> fSessionList;
+
+    /**
+     * List Sessions response from network
+     *
+     * @param inNet
+     *            the network stream
+     * @throws IOException
+     *             network error
+     */
+    public ListSessionsResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[PACKET_FIXED_SIZE];
+        inNet.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        int nbSessions = bb.getInt();
+        Builder<SessionResponse> sl = new ImmutableList.Builder<>();
+        for (int session = 0; session < nbSessions; session++) {
+            sl.add(new SessionResponse(inNet));
+        }
+        fSessionList = sl.build();
+    }
+
+    /**
+     * Gets the session list
+     *
+     * @return the sessions list
+     */
+    public List<SessionResponse> getSessionsList() {
+        return fSessionList;
+    }
+
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/LttngViewerCommands.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/LttngViewerCommands.java
new file mode 100644 (file)
index 0000000..4a77664
--- /dev/null
@@ -0,0 +1,36 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * LTTng Relay Daemon API. needs a TCP connection, API is defined from
+ * BSD-licensed implementation in Lttng tools: <a href=
+ * "http://git.lttng.org/?p=lttng-tools.git;a=blob;f=src/bin/lttng-relayd/lttng-viewer-abi.h"
+ * > src/bin/lttng-relayd/lttng-viewer-abi.h</a>
+ *
+ * @author Matthew Khouzam
+ */
+public interface LttngViewerCommands {
+
+    /** Maximum path name length */
+    static final int LTTNG_VIEWER_PATH_MAX = 4096;
+    /** Maximum name length */
+    static final int LTTNG_VIEWER_NAME_MAX = 255;
+    /** Maximum host name length */
+    static final int LTTNG_VIEWER_HOST_NAME_MAX = 64;
+    /** New stream in the trace */
+    static final int NEW_STREAM = (1 << 1);
+    /** New metadata in the trace */
+    static final int NEW_METADATA = (1 << 0);
+
+}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/MetadataPacketResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/MetadataPacketResponse.java
new file mode 100644 (file)
index 0000000..528593c
--- /dev/null
@@ -0,0 +1,78 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Metadata packet response containing a packet of metadata
+ *
+ * @author Matthew Khouzam
+ */
+public class MetadataPacketResponse implements IRelayResponse {
+
+    /**
+     * Response size
+     *
+     * fData.length + fStatus
+     */
+    private static final int SIZE = (Long.SIZE + Integer.SIZE) / 8;
+    /** status of the metadata request */
+    private final GetMetadataReturnCode fStatus;
+    /** the packet */
+    private final byte fData[];
+
+    /**
+     * Read new metadata packet from the network
+     *
+     * @param inNet
+     *            network input reader
+     * @throws IOException
+     *             network error
+     */
+    public MetadataPacketResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[SIZE];
+        inNet.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        long length = bb.getLong();
+        fStatus = GetMetadataReturnCode.values()[bb.getInt() - 1];
+        if (length >= Integer.MAX_VALUE) {
+            throw new IOException("Metadata Packet too big " + length); //$NON-NLS-1$
+        }
+        fData = new byte[(int) length];
+        inNet.readFully(fData);
+    }
+
+    /**
+     * Get the packet
+     *
+     * @return the packet
+     */
+    public byte[] getData() {
+        return fData;
+    }
+
+    /**
+     * Gets the status
+     *
+     * @return the status
+     */
+    public GetMetadataReturnCode getStatus() {
+        return fStatus;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsRequest.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsRequest.java
new file mode 100644 (file)
index 0000000..edb2c68
--- /dev/null
@@ -0,0 +1,52 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * LTTNG_VIEWER_GET_NEW_STREAMS payload.
+ *
+ * @author Matthew Khouzam
+ */
+public class NewStreamsRequest implements IRelayCommand {
+
+    /**
+     * Command size (fSessionId)
+     */
+    public static final int SIZE = Long.SIZE / 8;
+
+    /** session ID */
+    private final long fSessionId;
+
+    /**
+     * Constructor
+     *
+     * @param sessionId
+     *            the session id we want
+     */
+    public NewStreamsRequest(long sessionId) {
+        fSessionId = sessionId;
+    }
+
+    @Override
+    public byte[] serialize() {
+        byte data[] = new byte[SIZE];
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        bb.putLong(fSessionId);
+        return data;
+    }
+}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsResponse.java
new file mode 100644 (file)
index 0000000..b02ef88
--- /dev/null
@@ -0,0 +1,95 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.List;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Response to a "new streams" command
+ *
+ * @author Matthew Khouzam
+ */
+public class NewStreamsResponse implements IRelayResponse {
+
+    /**
+     * Response size
+     *
+     * fStatus + fNbStreams
+     */
+    private static final int SIZE = (Integer.SIZE + Integer.SIZE) / 8;
+    /** status of the request */
+    private final NewStreamsReturnCode fStatus;
+    /** the number of streams */
+    private final int fNbStreams;
+    /** the list of streams in the response */
+    private final List<StreamResponse> fStreamList;
+
+    /**
+     * New stream response network constructor
+     *
+     * @param inNet
+     *            network stream
+     * @throws IOException
+     *             network error
+     */
+    public NewStreamsResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[SIZE];
+        inNet.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fStatus = NewStreamsReturnCode.values()[bb.getInt() - 1];
+        fNbStreams = bb.getInt();
+        ImmutableList.Builder<StreamResponse> sl = new ImmutableList.Builder<>();
+        if (getStatus().equals(NewStreamsReturnCode.LTTNG_VIEWER_NEW_STREAMS_OK)) {
+            for (int stream = 0; stream < fNbStreams; stream++) {
+                sl.add(new StreamResponse(inNet));
+            }
+        }
+        fStreamList = sl.build();
+    }
+
+    /**
+     * Gets the status
+     *
+     * @return the status
+     */
+    public NewStreamsReturnCode getStatus() {
+        return fStatus;
+    }
+
+    /**
+     * gets the stream list
+     *
+     * @return the stream list
+     */
+    public List<StreamResponse> getStreamList() {
+        return fStreamList;
+    }
+
+    /**
+     * The number of streams
+     *
+     * @return the number of streams
+     */
+    public int getNbStreams() {
+        return fNbStreams;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NewStreamsReturnCode.java
new file mode 100644 (file)
index 0000000..aa324f7
--- /dev/null
@@ -0,0 +1,42 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Return codes for "new streams" command
+ *
+ * @author Matthew Khouzam
+ */
+public enum NewStreamsReturnCode implements IBaseCommand {
+
+    /** If new streams are being sent. */
+    LTTNG_VIEWER_NEW_STREAMS_OK(1),
+    /** If no new streams are available. */
+    LTTNG_VIEWER_NEW_STREAMS_NO_NEW(2),
+    /** Error. */
+    LTTNG_VIEWER_NEW_STREAMS_ERR(3),
+    /** Session closed. */
+    LTTNG_VIEWER_NEW_STREAMS_HUP(4);
+
+    private final int fCode;
+
+    private NewStreamsReturnCode(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NextIndexReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/NextIndexReturnCode.java
new file mode 100644 (file)
index 0000000..3c5c32a
--- /dev/null
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Get next index return code (hope it's viewer_index_ok)
+ *
+ * @author Matthew Khouzam
+ */
+public enum NextIndexReturnCode implements IBaseCommand {
+
+    /** Index is available. */
+    VIEWER_INDEX_OK(1),
+    /** Index not yet available. */
+    VIEWER_INDEX_RETRY(2),
+    /** Index closed (trace destroyed). */
+    VIEWER_INDEX_HUP(3),
+    /** Unknown error. */
+    VIEWER_INDEX_ERR(4),
+    /** Inactive stream beacon. */
+    VIEWER_INDEX_INACTIVE(5),
+    /** End of index file. */
+    VIEWER_INDEX_EOF(6);
+
+    private final int fCode;
+
+    private NextIndexReturnCode(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/SeekCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/SeekCommand.java
new file mode 100644 (file)
index 0000000..e187830
--- /dev/null
@@ -0,0 +1,43 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+/**
+ * Seek command
+ *
+ * @author Matthew Khouzam
+ */
+public enum SeekCommand implements IBaseCommand {
+
+    /** Receive the trace packets from the beginning. */
+    VIEWER_SEEK_BEGINNING(1),
+    /** Receive the trace packets from now. */
+    VIEWER_SEEK_LAST(2);
+
+    private final int fCode;
+
+    /**
+     * Command size (fCode)
+     */
+    public static final int SIZE = Integer.SIZE / 8;
+
+    private SeekCommand(int c) {
+        fCode = c;
+    }
+
+    @Override
+    public int getCommand() {
+        return fCode;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/SessionResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/SessionResponse.java
new file mode 100644 (file)
index 0000000..7253ecb
--- /dev/null
@@ -0,0 +1,127 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Get viewer session response to command
+ *
+ * @author Matthew Khouzam
+ */
+public class SessionResponse implements IRelayResponse {
+
+    /**
+     * Response size
+     *
+     * fHostname + fSessionName + fId + fLiveTimer + fClients + fStreams
+     */
+    public static final int SIZE =
+            LttngViewerCommands.LTTNG_VIEWER_HOST_NAME_MAX + LttngViewerCommands.LTTNG_VIEWER_NAME_MAX + (Long.SIZE + Integer.SIZE + Integer.SIZE + Integer.SIZE) / 8;
+    /** id of the session */
+    private final long fId;
+    /** live timer */
+    private final int fLiveTimer;
+    /** number of clients */
+    private final int fClients;
+    /** number streams */
+    private final int fStreams;
+    /** Hostname, like 'localhost' */
+    private final String fHostname;
+    /** Session name, like 'streaming session' */
+    private final String fSessionName;
+
+    /**
+     * Session response network constructor
+     *
+     * @param inNet
+     *            input network stream
+     * @throws IOException
+     *             network error
+     */
+    public SessionResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[SIZE];
+        inNet.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fId = bb.getLong();
+        fLiveTimer = bb.getInt();
+        fClients = bb.getInt();
+        fStreams = bb.getInt();
+        byte[] hostName = new byte[LttngViewerCommands.LTTNG_VIEWER_HOST_NAME_MAX];
+        byte[] sessionName = new byte[LttngViewerCommands.LTTNG_VIEWER_NAME_MAX];
+        bb.get(hostName, 0, hostName.length);
+        bb.get(sessionName, 0, sessionName.length);
+        fHostname = new String(hostName);
+        fSessionName = new String(sessionName);
+    }
+
+    /**
+     * Gets the id of the session
+     *
+     * @return the id of the session
+     */
+    public long getId() {
+        return fId;
+    }
+
+    /**
+     * Gets the live timer
+     *
+     * @return the live timer
+     */
+    public int getLiveTimer() {
+        return fLiveTimer;
+    }
+
+    /**
+     * Gets the number of clients
+     *
+     * @return the number of clients
+     */
+    public int getClients() {
+        return fClients;
+    }
+
+    /**
+     * Gets the number streams
+     *
+     * @return the number streams
+     */
+    public int getStreams() {
+        return fStreams;
+    }
+
+    /**
+     * Gets the Hostname
+     *
+     * @return the Hostname
+     */
+    public String getHostname() {
+        return fHostname;
+    }
+
+    /**
+     * Gets the session name
+     *
+     * @return the session name
+     */
+    public String getSessionName() {
+        return fSessionName;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/StreamResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/StreamResponse.java
new file mode 100644 (file)
index 0000000..89d2c34
--- /dev/null
@@ -0,0 +1,126 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Get response of viewer stream
+ *
+ * @author Matthew Khouzam
+ */
+public class StreamResponse implements IRelayResponse {
+
+    /**
+     * Response size
+     *
+     * fId + fCtfTraceId + fMetadataFlag + fPathName + fChannelName
+     */
+    public static final int SIZE = (Long.SIZE + Long.SIZE + Integer.SIZE) / 8 + LttngViewerCommands.LTTNG_VIEWER_PATH_MAX + LttngViewerCommands.LTTNG_VIEWER_NAME_MAX;
+
+    /**
+     * id of the stream
+     */
+    private final long fId;
+    /**
+     * It is guaranteed to be unique, because the value is assigned sequentially
+     * by the relay.
+     */
+    private final long fCtfTraceId;
+    /**
+     * if the stream is a metadata stream
+     */
+    private final int fMetadataFlag;
+    /**
+     * the path
+     */
+    private final String fPathName;
+    /**
+     * The channel, traditionally channel0
+     */
+    private final String fChannelName;
+
+    /**
+     * Stream response
+     *
+     * @param inNet
+     *            input data stream
+     * @throws IOException
+     *             network time
+     */
+    public StreamResponse(DataInputStream inNet) throws IOException {
+        byte[] streamData = new byte[SIZE];
+        inNet.readFully(streamData, 0, SIZE);
+        ByteBuffer bb = ByteBuffer.wrap(streamData);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fId = (bb.getLong());
+        fCtfTraceId = bb.getLong();
+        fMetadataFlag = bb.getInt();
+        byte pathName[] = new byte[LttngViewerCommands.LTTNG_VIEWER_PATH_MAX];
+        byte channelName[] = new byte[LttngViewerCommands.LTTNG_VIEWER_NAME_MAX];
+        bb.get(pathName, 0, LttngViewerCommands.LTTNG_VIEWER_PATH_MAX);
+        bb.get(channelName, 0, LttngViewerCommands.LTTNG_VIEWER_NAME_MAX);
+        fPathName = new String(pathName);
+        fChannelName = new String(channelName);
+    }
+
+    /**
+     * Get the id
+     *
+     * @return the Id
+     */
+    public long getId() {
+        return fId;
+    }
+
+    /**
+     * Get the CtfTraceId
+     *
+     * @return the CtfTraceId
+     */
+    public long getCtfTraceId() {
+        return fCtfTraceId;
+    }
+
+    /**
+     * Get the metadata flag
+     *
+     * @return the MetadataFlag
+     */
+    public int getMetadataFlag() {
+        return fMetadataFlag;
+    }
+
+    /**
+     * Get the path name
+     *
+     * @return the PathName
+     */
+    public String getPathName() {
+        return fPathName;
+    }
+
+    /**
+     * get the Channel name
+     *
+     * @return the ChannelName
+     */
+    public String getChannelName() {
+        return fChannelName;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/TracePacketResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/TracePacketResponse.java
new file mode 100644 (file)
index 0000000..11fa823
--- /dev/null
@@ -0,0 +1,92 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Response to getpacket command
+ *
+ * @author Matthew Khouzam
+ */
+public class TracePacketResponse implements IRelayResponse {
+
+    /**
+     * Command size
+     *
+     * fStatus + fData.length + fFlags
+     */
+    private static final int SIZE = (Integer.SIZE + Integer.SIZE + Integer.SIZE) / 8;
+    /** Enum lttng_viewer_get_packet_return_code */
+    private final GetPacketReturnCode fStatus;
+    /** flags: is there new metadata or new streams? */
+    private final int fFlags;
+    /** the packet */
+    private final byte[] fData;
+
+    /**
+     * Trace packet response network constructor
+     *
+     * @param inNet
+     *            network input stream
+     * @throws IOException
+     *             network error
+     */
+    public TracePacketResponse(DataInputStream inNet) throws IOException {
+        byte[] data = new byte[SIZE];
+        inNet.readFully(data);
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        fStatus = GetPacketReturnCode.values()[bb.getInt() - 1];
+        int length = bb.getInt();
+        fFlags = bb.getInt();
+        if (fStatus.equals(GetPacketReturnCode.VIEWER_GET_PACKET_OK)) {
+            fData = new byte[length];
+            inNet.readFully(fData);
+        } else {
+            fData = new byte[0];
+        }
+    }
+
+    /**
+     * Get the status
+     *
+     * @return the Status
+     */
+    public GetPacketReturnCode getStatus() {
+        return fStatus;
+    }
+
+    /**
+     * Get the flags
+     *
+     * @return the Flags
+     */
+    public int getFlags() {
+        return fFlags;
+    }
+
+    /**
+     * Get the packet data, please do not modify the data
+     *
+     * @return the Data
+     */
+    public byte[] getData() {
+        return fData;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ViewerCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/commands/ViewerCommand.java
new file mode 100644 (file)
index 0000000..06e6b16
--- /dev/null
@@ -0,0 +1,95 @@
+/**********************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation and API
+ *   Marc-Andre Laperle - Initial implementation and API
+ **********************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * The LTTng command
+ *
+ * @author Matthew Khouzam
+ */
+public class ViewerCommand implements IRelayCommand {
+
+    /**
+     * Command size
+     *
+     * fDataSize + fCmdVersion + fCmd
+     */
+    public static final int SIZE = (Long.SIZE + Integer.SIZE) / 8 + Command.SIZE;
+    /**
+     * data size following this header, you normally attach a payload that one,
+     * in bytes
+     */
+    private final long fDataSize;
+    /** enum lttcomm_relayd_command */
+    private final Command fCmd;
+    /** command version */
+    private final int fCmdVersion;
+
+    /**
+     * Sets the packet command
+     *
+     * @param viewerConnect
+     *            the command
+     * @param size size of the command
+     * @param version the version number
+     */
+    public ViewerCommand(Command viewerConnect, long size, int version) {
+        fCmd = viewerConnect;
+        fDataSize = size;
+        fCmdVersion = version;
+    }
+
+    /**
+     * Get the data size
+     *
+     * @return the DataSize
+     */
+    public long getDataSize() {
+        return fDataSize;
+    }
+
+    /**
+     * Get the command
+     *
+     * @return the Cmd
+     */
+    public Command getCmd() {
+        return fCmd;
+    }
+
+    /**
+     * Get the command version
+     *
+     * @return the CmdVersion
+     */
+    public int getCmdVersion() {
+        return fCmdVersion;
+    }
+
+    @Override
+    public byte[] serialize() {
+        byte data[] = new byte[SIZE];
+        ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.order(ByteOrder.BIG_ENDIAN);
+        bb.putLong(getDataSize());
+        bb.putInt(getCmd().getCommand());
+        bb.putInt(fCmdVersion);
+        return data;
+    }
+
+
+}
\ No newline at end of file
index 21bbfbd1788962d24e4830dc700505304fc1a95c..288d91427b9ac070a9249151ab6b121e12211a09 100644 (file)
@@ -20,24 +20,24 @@ import java.util.List;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.ILttngRelaydConnector;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.AttachSessionRequest;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.AttachSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.Command;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ConnectResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.CreateSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.GetMetadata;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.GetNextIndex;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.GetPacket;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.IndexResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ListSessionsResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.MetadataPacketResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.NewStreamsResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.NextIndexReturnCode;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.SeekCommand;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.SessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.StreamResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.TracePacketResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.ViewerCommand;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.AttachSessionRequest;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.AttachSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.Command;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ConnectResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.CreateSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.GetMetadata;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.GetNextIndex;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.GetPacket;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.IndexResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ListSessionsResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.MetadataPacketResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.NewStreamsResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.NextIndexReturnCode;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.SeekCommand;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.SessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.StreamResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.TracePacketResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.ViewerCommand;
 
 /**
  * Lttng 2.4 implementation
index 4e5fafa972a4063c1644f1c957d7d6bf015a296b..1635445ceace4c071f67dd0072c0a5b49398140d 100644 (file)
@@ -15,12 +15,12 @@ package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.impl;
 import java.util.List;
 
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.ILttngRelaydConnector;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.AttachSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.CreateSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.IndexResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.SessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.StreamResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.TracePacketResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.AttachSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.CreateSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.IndexResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.SessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.StreamResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.TracePacketResponse;
 
 /**
  * Unsupported version of the relay daemon
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachReturnCode.java
deleted file mode 100644 (file)
index 5618ad6..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Return codes for "viewer attach" command
- *
- * @author Matthew Khouzam
- */
-public enum AttachReturnCode implements IBaseCommand {
-
-    /** If the attach command succeeded. */
-    VIEWER_ATTACH_OK(1),
-    /** If a viewer is already attached. */
-    VIEWER_ATTACH_ALREADY(2),
-    /** If the session ID is unknown. */
-    VIEWER_ATTACH_UNK(3),
-    /** If the session is not live. */
-    VIEWER_ATTACH_NOT_LIVE(4),
-    /** Seek error. */
-    VIEWER_ATTACH_SEEK_ERR(5),
-    /** No session */
-    VIEWER_ATTACH_NO_SESSION(6);
-
-    private final int fCode;
-
-    private AttachReturnCode(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachSessionRequest.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachSessionRequest.java
deleted file mode 100644 (file)
index 58c0d2f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * VIEWER_ATTACH_SESSION payload.
- *
- * @author Matthew Khouzam
- */
-public class AttachSessionRequest implements IRelayCommand {
-
-    /**
-     * Command size
-     *
-     * fSessionId + fOffset + fSeek
-     */
-    public static final int SIZE = (Long.SIZE + Long.SIZE) / 8 + SeekCommand.SIZE;
-    /** the id of a session */
-    private final long fSessionId;
-    /** unused for now */
-    private final long fOffset;
-    /** enum lttng_viewer_seek */
-    private final SeekCommand fSeek;
-
-    /**
-     * Attach session request constructor
-     *
-     * @param id
-     *            the session id
-     * @param seekCommand
-     *            the seek command
-     */
-    public AttachSessionRequest(long id, SeekCommand seekCommand) {
-        this(id, 0, seekCommand);
-    }
-
-    /**
-     * Attach session request constructor
-     *
-     * @param id
-     *            the session id
-     * @param offset
-     *            unused for now
-     * @param seekCommand
-     *            the seek command
-     */
-
-    public AttachSessionRequest(long id, int offset, SeekCommand seekCommand) {
-        fSessionId = id;
-        fOffset = offset;
-        fSeek = seekCommand;
-
-    }
-
-    @Override
-    public byte[] serialize() {
-        byte data[] = new byte[SIZE];
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        bb.putLong(fSessionId);
-        bb.putLong(fOffset);
-        bb.putInt(fSeek.getCommand());
-        return data;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachSessionResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/AttachSessionResponse.java
deleted file mode 100644 (file)
index ae8214b..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-
-/**
- * Attach session response
- *
- * @author Matthew Khouzam
- */
-public class AttachSessionResponse implements IRelayResponse {
-
-    /**
-     * Response size
-     *
-     * fStatus + fStreamsCount (first half of a packet) */
-    private static final int SIZE = (Integer.SIZE + Integer.SIZE) / 8;
-    /** enum lttng_viewer_attach_return_code */
-    private final AttachReturnCode fStatus;
-    /** how many streams are there */
-    private final int fStreamsCount;
-    /** public class lttng_viewer_stream */
-    private final List<StreamResponse> fStreamList;
-
-    /**
-     * Attach session response network constructor
-     *
-     * @param inNet
-     *            network input stream
-     * @throws IOException
-     *             network error
-     */
-    public AttachSessionResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[SIZE];
-        inNet.readFully(data, 0, SIZE);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fStatus = AttachReturnCode.values()[bb.getInt() - 1];
-        fStreamsCount = bb.getInt();
-        Builder<StreamResponse> streamResponses = ImmutableList.builder();
-        for (int i = 0; i < getNbStreams(); i++) {
-            streamResponses.add(new StreamResponse(inNet));
-        }
-        fStreamList = streamResponses.build();
-
-    }
-
-    /**
-     * Gets the Status
-     *
-     * @return the Status
-     */
-    public AttachReturnCode getStatus() {
-        return fStatus;
-    }
-
-    /**
-     * Gets the StreamsCount
-     *
-     * @return the StreamsCount
-     */
-    public int getNbStreams() {
-        return fStreamsCount;
-    }
-
-    /**
-     * Gets the StreamList
-     *
-     * @return the StreamList
-     */
-    public List<StreamResponse> getStreamList() {
-        return fStreamList;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/Command.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/Command.java
deleted file mode 100644 (file)
index 6d6074f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Viewer commands
- *
- * @author Matthew Khouzam
- */
-public enum Command implements IBaseCommand {
-
-    /** get version */
-    VIEWER_CONNECT(1),
-    /** list all lttng sessions */
-    VIEWER_LIST_SESSIONS(2),
-    /** attach to a session */
-    VIEWER_ATTACH_SESSION(3),
-    /** get the next index */
-    VIEWER_GET_NEXT_INDEX(4),
-    /** get packet */
-    VIEWER_GET_PACKET(5),
-    /** get metadata */
-    VIEWER_GET_METADATA(6),
-    /** get new streams */
-    VIEWER_GET_NEW_STREAMS(7),
-    /** create a new session */
-    VIEWER_CREATE_SESSION(8);
-
-    /**
-     * Command size (fCode)
-     */
-    public static final int SIZE = Integer.SIZE / 8;
-
-    private final int fCode;
-
-    private Command(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ConnectResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ConnectResponse.java
deleted file mode 100644 (file)
index 3238942..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * CONNECT payload.
- *
- * @author Matthew Khouzam
- */
-public class ConnectResponse implements IRelayResponse, IRelayCommand {
-
-    /**
-     * Response or command size
-     *
-     * fViewerSessionId + fMajor + fMinor + fType
-     */
-    public static final int SIZE = (Long.SIZE + Integer.SIZE + Integer.SIZE + Integer.SIZE) / 8;
-    /** session id, counts from 1 and increments by session */
-    private final long fViewerSessionId;
-    /**
-     * Major version, hint, it's at least 2
-     */
-    private final int fMajor;
-    /**
-     * Minor version, hint, it's at least 4
-     */
-    private final int fMinor;
-    /**
-     * type of connect to {@link ConnectionType}
-     */
-    private final ConnectionType fType;
-
-    /**
-     * Connection response reply constructor
-     *
-     * @param inStream
-     *            the data input stream
-     * @throws IOException
-     *             a network error
-     */
-    public ConnectResponse(DataInputStream inStream) throws IOException {
-        byte data[] = new byte[SIZE];
-        inStream.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fViewerSessionId = bb.getLong();
-        fMajor = bb.getInt();
-        fMinor = bb.getInt();
-        bb.getInt(); // Should not be used, see http://bugs.lttng.org/issues/728
-        fType = ConnectionType.VIEWER_CLIENT_COMMAND;
-    }
-
-    /**
-     * Constructor for command
-     *
-     * @param sessionID
-     *            session id
-     * @param major
-     *            the major version
-     * @param minor
-     *            the minor version
-     * @param connection
-     *            the connection type, typically VIEWER_CLIENT_COMMAND
-     */
-    public ConnectResponse(long sessionID, int major, int minor, ConnectionType connection) {
-        fViewerSessionId = sessionID;
-        fMajor = major;
-        fMinor = minor;
-        fType = connection;
-    }
-
-    /**
-     * get the major version
-     *
-     * @return the major version
-     */
-    public int getMajor() {
-        return fMajor;
-    }
-
-    /**
-     * get the minor version
-     *
-     * @return the minor version
-     */
-    public int getMinor() {
-        return fMinor;
-    }
-
-    @Override
-    public byte[] serialize() {
-        byte data[] = new byte[SIZE];
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        bb.putLong(fViewerSessionId);
-        bb.putInt(fMajor);
-        bb.putInt(fMinor);
-        bb.putInt(fType.getCommand());
-        return data;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ConnectionType.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ConnectionType.java
deleted file mode 100644 (file)
index 6f846f1..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Get viewer connection type
- *
- * @author Matthew Khouzam
- */
-public enum ConnectionType implements IBaseCommand {
-
-    /** Command sent */
-    VIEWER_CLIENT_COMMAND(1),
-    /** Notification sent */
-    VIEWER_CLIENT_NOTIFICATION(2);
-
-    private final int fCode;
-
-    private ConnectionType(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/CreateSessionResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/CreateSessionResponse.java
deleted file mode 100644 (file)
index 4608143..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Response to a "create session" command
- *
- * @author Matthew Khouzam
- */
-public class CreateSessionResponse implements IRelayResponse {
-
-    /**
-     * Response size (fStatus)
-     */
-    public static final int SIZE = Integer.SIZE / 8;
-
-    /** enum lttng_viewer_create_session_return_code */
-    private final CreateSessionReturnCode fStatus;
-
-    /**
-     * Create session response network constructor
-     *
-     * @param inNet
-     *            network input stream
-     * @throws IOException
-     *             network error
-     */
-    public CreateSessionResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[SIZE];
-        inNet.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fStatus = (CreateSessionReturnCode.values()[bb.getInt() - 1]);
-    }
-
-    /**
-     * Get status
-     *
-     * @return the status
-     */
-    public CreateSessionReturnCode getStatus() {
-        return fStatus;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/CreateSessionReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/CreateSessionReturnCode.java
deleted file mode 100644 (file)
index da4b534..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Create new session return code
- *
- * @author Matthew Khouzam
- */
-public enum CreateSessionReturnCode implements IBaseCommand {
-
-    /** If new streams are being sent. */
-    LTTNG_VIEWER_CREATE_SESSION_OK(1),
-    /** Fatal error on the server-side. */
-    LTTNG_VIEWER_CREATE_SESSION_ERR(2);
-
-    private final int fCode;
-
-    private CreateSessionReturnCode(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetMetadata.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetMetadata.java
deleted file mode 100644 (file)
index 929249a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * VIEWER_GET_METADATA payload.
- *
- * @author Matthew Khouzam
- */
-public class GetMetadata implements IRelayCommand {
-
-    /**
-     * Command size (fStreamId)
-     */
-    public static final int SIZE = Long.SIZE / 8;
-
-    /**
-     * The stream id
-     */
-    private final long fStreamId;
-
-    /**
-     * Set the stream id
-     *
-     * @param streamId
-     *            the stream id
-     */
-    public GetMetadata(long streamId) {
-        fStreamId = streamId;
-    }
-
-    /**
-     * Get the stream id
-     *
-     * @return the stream id
-     */
-    public long getStreamId() {
-        return fStreamId;
-    }
-
-    @Override
-    public byte[] serialize() {
-        byte data[] = new byte[SIZE];
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        bb.putLong(getStreamId());
-        return data;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetMetadataReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetMetadataReturnCode.java
deleted file mode 100644 (file)
index bbf2dbc..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Get metadata return code
- *
- * @author Matthew Khouzam
- */
-public enum GetMetadataReturnCode implements IBaseCommand {
-
-    /** Response was OK */
-    VIEWER_METADATA_OK(1),
-    /** Response was nothing new */
-    VIEWER_NO_NEW_METADATA(2),
-    /** Response was Error */
-    VIEWER_METADATA_ERR(3);
-
-    private final int fCode;
-
-    private GetMetadataReturnCode(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetNextIndex.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetNextIndex.java
deleted file mode 100644 (file)
index 5a63776..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * VIEWER_GET_NEXT_INDEX payload.
- *
- * @author Matthew Khouzam
- */
-public class GetNextIndex implements IRelayCommand {
-
-    /**
-     * Command size (fStreamId)
-     */
-    public static final int SIZE = Long.SIZE / 8;
-    /**
-     * the id of the stream
-     */
-    private final long fStreamId;
-
-    /**
-     * Constructor
-     *
-     * @param streamId
-     *            the index stream id
-     */
-    public GetNextIndex(long streamId) {
-        fStreamId = streamId;
-    }
-
-    /**
-     * Gets the stream id
-     *
-     * @return the stream id
-     */
-    public long getStreamId() {
-        return fStreamId;
-    }
-
-    @Override
-    public byte[] serialize() {
-        byte data[] = new byte[SIZE];
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        bb.putLong(getStreamId());
-        return data;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetPacket.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetPacket.java
deleted file mode 100644 (file)
index 59faafb..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * VIEWER_GET_PACKET payload.
- *
- * @author Matthew Khouzam
- */
-public class GetPacket implements IRelayCommand {
-
-    /**
-     * Command size
-     *
-     * fStreamId + fOffset + fLength
-     */
-    public static final int SIZE = (Long.SIZE + Long.SIZE + Integer.SIZE) / 8;
-    /** the stream Id */
-    private final long fStreamId;
-    /** the offset */
-    private final long fOffset;
-    /** the length of the packet */
-    private final int fLength;
-
-    /**
-     * Get packet constructor
-     *
-     * @param streamId
-     *            the stream id
-     * @param offset
-     *            the offset
-     * @param length
-     *            the packet length
-     */
-    public GetPacket(long streamId, long offset, int length) {
-        fStreamId = streamId;
-        fOffset = offset;
-        fLength = length;
-    }
-
-    /**
-     * Get the length of the packet
-     *
-     * @return the length of the packet in bytes
-     */
-    public int getLength() {
-        return fLength;
-    }
-
-    /**
-     * Gets the offset of the packet
-     *
-     * @return the offset
-     */
-    public long getOffset() {
-        return fOffset;
-    }
-
-    /**
-     * Gets the stream id
-     *
-     * @return the stream id
-     */
-    public long getStreamId() {
-        return fStreamId;
-    }
-
-    @Override
-    public byte[] serialize() {
-        byte data[] = new byte[SIZE];
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        bb.putLong(getStreamId());
-        bb.putLong(getOffset());
-        bb.putInt(getLength());
-        return data;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetPacketReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/GetPacketReturnCode.java
deleted file mode 100644 (file)
index 1ecf70f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Get packet return code
- *
- * @author Matthew Khouzam
- */
-public enum GetPacketReturnCode implements IBaseCommand {
-
-    /** Response was OK */
-    VIEWER_GET_PACKET_OK(1),
-    /** Response was RETRY */
-    VIEWER_GET_PACKET_RETRY(2),
-    /** Response was ERROR */
-    VIEWER_GET_PACKET_ERR(3),
-    /** Response was End of File */
-    VIEWER_GET_PACKET_EOF(4);
-
-    private final int fCode;
-
-    private GetPacketReturnCode(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IBaseCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IBaseCommand.java
deleted file mode 100644 (file)
index c691ad1..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Instruction to send to relayd
- *
- * @author Matthew Khouzam
- */
-public interface IBaseCommand {
-
-    /**
-     * gets the numerical value of the command
-     *
-     * @return the numerical value of the command
-     */
-    int getCommand();
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IRelayCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IRelayCommand.java
deleted file mode 100644 (file)
index 88443bf..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-
-/**
- * Command sent, needs a getBytes to stream the data
- *
- * @author Matthew Khouzam
- */
-public interface IRelayCommand {
-
-    /**
-     * Gets a byte array of the command so that it may be streamed
-     *
-     * @return the byte array of the command
-     */
-    byte[] serialize();
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IRelayResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IRelayResponse.java
deleted file mode 100644 (file)
index 9ce986a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Command response, this will allow sorting commands easier
- *
- * @author Matthew Khouzam
- */
-public interface IRelayResponse {
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IndexResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/IndexResponse.java
deleted file mode 100644 (file)
index f0b801d..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * An Lttng packet index
- *
- * @author Matthew Khouzam
- */
-public class IndexResponse implements IRelayResponse {
-
-    /**
-     * Command size
-     *
-     * Sum of the field sizes / 8 ( 7 longs and 2 ints):
-     * fOffset + fPacketSize + fContentSize + fTimestampBegin + fTimestampEnd +
-     * fEventsDiscarded + fStreamId + fStatus + fFlags
-     */
-    public static final int SIZE =
-            (Long.SIZE * 7 + Integer.SIZE * 2) / 8;
-
-    /** the offset */
-    private final long fOffset;
-    /** packet_size */
-    private final long fPacketSize;
-    /** the content size - how much of the packet is used */
-    private final long fContentSize;
-    /** timestamp of the beginning of the packet */
-    private final long fTimestampBegin;
-    /** timestamp of the end of the packet */
-    private final long fTimestampEnd;
-    /** number of discarded events BEFORE this packet */
-    private final long fEventsDiscarded;
-    /** the CTF stream id */
-    private final long fStreamId;
-    /** the status of the getNextIndex request */
-    private final NextIndexReturnCode fStatus;
-    /** whether there are new streams or metadata */
-    private final int fFlags;
-
-    /**
-     * IndexResposne from network
-     *
-     * @param inNet
-     *            data input stream
-     * @throws IOException
-     *             network error
-     */
-    public IndexResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[SIZE];
-        inNet.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fOffset = bb.getLong();
-        fPacketSize = bb.getLong();
-        fContentSize = bb.getLong();
-        fTimestampBegin = bb.getLong();
-        fTimestampEnd = bb.getLong();
-        fEventsDiscarded = bb.getLong();
-        fStreamId = bb.getLong();
-        fStatus = NextIndexReturnCode.values()[bb.getInt() - 1];
-        fFlags = bb.getInt();
-    }
-
-    /**
-     * Gets the offset
-     *
-     * @return the offset
-     */
-    public long getOffset() {
-        return fOffset;
-    }
-
-    /**
-     * Gets the packet size
-     *
-     * @return the packet size
-     */
-    public long getPacketSize() {
-        return fPacketSize;
-    }
-
-    /**
-     * Gets the content size - how much of the packet is used
-     *
-     * @return the content size
-     */
-    public long getContentSize() {
-        return fContentSize;
-    }
-
-    /**
-     * Gets the timestamp of the beginning of the packet
-     *
-     * @return the timestamp of the beginning of the packet
-     */
-    public long getTimestampBegin() {
-        return fTimestampBegin;
-    }
-
-    /**
-     * Gets the timestamp of the end of the packet
-     *
-     * @return the timestamp of the end of the packet
-     */
-    public long getTimestampEnd() {
-        return fTimestampEnd;
-    }
-
-    /**
-     * Gets the number of discarded events BEFORE this packet
-     *
-     * @return the number of discarded events BEFORE this packet
-     */
-    public long getEventsDiscarded() {
-        return fEventsDiscarded;
-    }
-
-    /**
-     * Gets the CTF stream id
-     *
-     * @return the CTF stream id
-     */
-    public long getStreamId() {
-        return fStreamId;
-    }
-
-    /**
-     * Gets the status
-     *
-     * @return the status
-     */
-    public NextIndexReturnCode getStatus() {
-        return fStatus;
-    }
-
-    /**
-     * Gets the flags that describe whether there are new streams or metadata
-     *
-     * @return the flags
-     */
-    public int getFlags() {
-        return fFlags;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ListSessionsResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ListSessionsResponse.java
deleted file mode 100644 (file)
index bf78e37..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-
-/**
- * VIEWER_LIST_SESSIONS payload.
- *
- * @author Matthew Khouzam
- */
-public class ListSessionsResponse implements IRelayResponse {
-
-    /**
-     * Response size (nbSessions)
-     */
-    public static final int PACKET_FIXED_SIZE = Integer.SIZE / 8;
-
-    /** the list of sessions */
-    private final List<SessionResponse> fSessionList;
-
-    /**
-     * List Sessions response from network
-     *
-     * @param inNet
-     *            the network stream
-     * @throws IOException
-     *             network error
-     */
-    public ListSessionsResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[PACKET_FIXED_SIZE];
-        inNet.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        int nbSessions = bb.getInt();
-        Builder<SessionResponse> sl = new ImmutableList.Builder<>();
-        for (int session = 0; session < nbSessions; session++) {
-            sl.add(new SessionResponse(inNet));
-        }
-        fSessionList = sl.build();
-    }
-
-    /**
-     * Gets the session list
-     *
-     * @return the sessions list
-     */
-    public List<SessionResponse> getSessionsList() {
-        return fSessionList;
-    }
-
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/LttngViewerCommands.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/LttngViewerCommands.java
deleted file mode 100644 (file)
index 30c9fa2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * LTTng Relay Daemon API. needs a TCP connection, API is defined from
- * BSD-licensed implementation in Lttng tools: <a href=
- * "http://git.lttng.org/?p=lttng-tools.git;a=blob;f=src/bin/lttng-relayd/lttng-viewer-abi.h"
- * > src/bin/lttng-relayd/lttng-viewer-abi.h</a>
- *
- * @author Matthew Khouzam
- */
-public interface LttngViewerCommands {
-
-    /** Maximum path name length */
-    static final int LTTNG_VIEWER_PATH_MAX = 4096;
-    /** Maximum name length */
-    static final int LTTNG_VIEWER_NAME_MAX = 255;
-    /** Maximum host name length */
-    static final int LTTNG_VIEWER_HOST_NAME_MAX = 64;
-    /** New stream in the trace */
-    static final int NEW_STREAM = (1 << 1);
-    /** New metadata in the trace */
-    static final int NEW_METADATA = (1 << 0);
-
-}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/MetadataPacketResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/MetadataPacketResponse.java
deleted file mode 100644 (file)
index 60f51a9..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Metadata packet response containing a packet of metadata
- *
- * @author Matthew Khouzam
- */
-public class MetadataPacketResponse implements IRelayResponse {
-
-    /**
-     * Response size
-     *
-     * fData.length + fStatus
-     */
-    private static final int SIZE = (Long.SIZE + Integer.SIZE) / 8;
-    /** status of the metadata request */
-    private final GetMetadataReturnCode fStatus;
-    /** the packet */
-    private final byte fData[];
-
-    /**
-     * Read new metadata packet from the network
-     *
-     * @param inNet
-     *            network input reader
-     * @throws IOException
-     *             network error
-     */
-    public MetadataPacketResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[SIZE];
-        inNet.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        long length = bb.getLong();
-        fStatus = GetMetadataReturnCode.values()[bb.getInt() - 1];
-        if (length >= Integer.MAX_VALUE) {
-            throw new IOException("Metadata Packet too big " + length); //$NON-NLS-1$
-        }
-        fData = new byte[(int) length];
-        inNet.readFully(fData);
-    }
-
-    /**
-     * Get the packet
-     *
-     * @return the packet
-     */
-    public byte[] getData() {
-        return fData;
-    }
-
-    /**
-     * Gets the status
-     *
-     * @return the status
-     */
-    public GetMetadataReturnCode getStatus() {
-        return fStatus;
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsRequest.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsRequest.java
deleted file mode 100644 (file)
index fae7515..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * LTTNG_VIEWER_GET_NEW_STREAMS payload.
- *
- * @author Matthew Khouzam
- */
-public class NewStreamsRequest implements IRelayCommand {
-
-    /**
-     * Command size (fSessionId)
-     */
-    public static final int SIZE = Long.SIZE / 8;
-
-    /** session ID */
-    private final long fSessionId;
-
-    /**
-     * Constructor
-     *
-     * @param sessionId
-     *            the session id we want
-     */
-    public NewStreamsRequest(long sessionId) {
-        fSessionId = sessionId;
-    }
-
-    @Override
-    public byte[] serialize() {
-        byte data[] = new byte[SIZE];
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        bb.putLong(fSessionId);
-        return data;
-    }
-}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsResponse.java
deleted file mode 100644 (file)
index 2bee873..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Response to a "new streams" command
- *
- * @author Matthew Khouzam
- */
-public class NewStreamsResponse implements IRelayResponse {
-
-    /**
-     * Response size
-     *
-     * fStatus + fNbStreams
-     */
-    private static final int SIZE = (Integer.SIZE + Integer.SIZE) / 8;
-    /** status of the request */
-    private final NewStreamsReturnCode fStatus;
-    /** the number of streams */
-    private final int fNbStreams;
-    /** the list of streams in the response */
-    private final List<StreamResponse> fStreamList;
-
-    /**
-     * New stream response network constructor
-     *
-     * @param inNet
-     *            network stream
-     * @throws IOException
-     *             network error
-     */
-    public NewStreamsResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[SIZE];
-        inNet.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fStatus = NewStreamsReturnCode.values()[bb.getInt() - 1];
-        fNbStreams = bb.getInt();
-        ImmutableList.Builder<StreamResponse> sl = new ImmutableList.Builder<>();
-        if (getStatus().equals(NewStreamsReturnCode.LTTNG_VIEWER_NEW_STREAMS_OK)) {
-            for (int stream = 0; stream < fNbStreams; stream++) {
-                sl.add(new StreamResponse(inNet));
-            }
-        }
-        fStreamList = sl.build();
-    }
-
-    /**
-     * Gets the status
-     *
-     * @return the status
-     */
-    public NewStreamsReturnCode getStatus() {
-        return fStatus;
-    }
-
-    /**
-     * gets the stream list
-     *
-     * @return the stream list
-     */
-    public List<StreamResponse> getStreamList() {
-        return fStreamList;
-    }
-
-    /**
-     * The number of streams
-     *
-     * @return the number of streams
-     */
-    public int getNbStreams() {
-        return fNbStreams;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NewStreamsReturnCode.java
deleted file mode 100644 (file)
index 0e993b6..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Return codes for "new streams" command
- *
- * @author Matthew Khouzam
- */
-public enum NewStreamsReturnCode implements IBaseCommand {
-
-    /** If new streams are being sent. */
-    LTTNG_VIEWER_NEW_STREAMS_OK(1),
-    /** If no new streams are available. */
-    LTTNG_VIEWER_NEW_STREAMS_NO_NEW(2),
-    /** Error. */
-    LTTNG_VIEWER_NEW_STREAMS_ERR(3),
-    /** Session closed. */
-    LTTNG_VIEWER_NEW_STREAMS_HUP(4);
-
-    private final int fCode;
-
-    private NewStreamsReturnCode(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-}
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NextIndexReturnCode.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/NextIndexReturnCode.java
deleted file mode 100644 (file)
index d9b3c91..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Get next index return code (hope it's viewer_index_ok)
- *
- * @author Matthew Khouzam
- */
-public enum NextIndexReturnCode implements IBaseCommand {
-
-    /** Index is available. */
-    VIEWER_INDEX_OK(1),
-    /** Index not yet available. */
-    VIEWER_INDEX_RETRY(2),
-    /** Index closed (trace destroyed). */
-    VIEWER_INDEX_HUP(3),
-    /** Unknown error. */
-    VIEWER_INDEX_ERR(4),
-    /** Inactive stream beacon. */
-    VIEWER_INDEX_INACTIVE(5),
-    /** End of index file. */
-    VIEWER_INDEX_EOF(6);
-
-    private final int fCode;
-
-    private NextIndexReturnCode(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/SeekCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/SeekCommand.java
deleted file mode 100644 (file)
index 450d7f4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-/**
- * Seek command
- *
- * @author Matthew Khouzam
- */
-public enum SeekCommand implements IBaseCommand {
-
-    /** Receive the trace packets from the beginning. */
-    VIEWER_SEEK_BEGINNING(1),
-    /** Receive the trace packets from now. */
-    VIEWER_SEEK_LAST(2);
-
-    private final int fCode;
-
-    /**
-     * Command size (fCode)
-     */
-    public static final int SIZE = Integer.SIZE / 8;
-
-    private SeekCommand(int c) {
-        fCode = c;
-    }
-
-    @Override
-    public int getCommand() {
-        return fCode;
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/SessionResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/SessionResponse.java
deleted file mode 100644 (file)
index 0ca4907..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Get viewer session response to command
- *
- * @author Matthew Khouzam
- */
-public class SessionResponse implements IRelayResponse {
-
-    /**
-     * Response size
-     *
-     * fHostname + fSessionName + fId + fLiveTimer + fClients + fStreams
-     */
-    public static final int SIZE =
-            LttngViewerCommands.LTTNG_VIEWER_HOST_NAME_MAX + LttngViewerCommands.LTTNG_VIEWER_NAME_MAX + (Long.SIZE + Integer.SIZE + Integer.SIZE + Integer.SIZE) / 8;
-    /** id of the session */
-    private final long fId;
-    /** live timer */
-    private final int fLiveTimer;
-    /** number of clients */
-    private final int fClients;
-    /** number streams */
-    private final int fStreams;
-    /** Hostname, like 'localhost' */
-    private final String fHostname;
-    /** Session name, like 'streaming session' */
-    private final String fSessionName;
-
-    /**
-     * Session response network constructor
-     *
-     * @param inNet
-     *            input network stream
-     * @throws IOException
-     *             network error
-     */
-    public SessionResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[SIZE];
-        inNet.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fId = bb.getLong();
-        fLiveTimer = bb.getInt();
-        fClients = bb.getInt();
-        fStreams = bb.getInt();
-        byte[] hostName = new byte[LttngViewerCommands.LTTNG_VIEWER_HOST_NAME_MAX];
-        byte[] sessionName = new byte[LttngViewerCommands.LTTNG_VIEWER_NAME_MAX];
-        bb.get(hostName, 0, hostName.length);
-        bb.get(sessionName, 0, sessionName.length);
-        fHostname = new String(hostName);
-        fSessionName = new String(sessionName);
-    }
-
-    /**
-     * Gets the id of the session
-     *
-     * @return the id of the session
-     */
-    public long getId() {
-        return fId;
-    }
-
-    /**
-     * Gets the live timer
-     *
-     * @return the live timer
-     */
-    public int getLiveTimer() {
-        return fLiveTimer;
-    }
-
-    /**
-     * Gets the number of clients
-     *
-     * @return the number of clients
-     */
-    public int getClients() {
-        return fClients;
-    }
-
-    /**
-     * Gets the number streams
-     *
-     * @return the number streams
-     */
-    public int getStreams() {
-        return fStreams;
-    }
-
-    /**
-     * Gets the Hostname
-     *
-     * @return the Hostname
-     */
-    public String getHostname() {
-        return fHostname;
-    }
-
-    /**
-     * Gets the session name
-     *
-     * @return the session name
-     */
-    public String getSessionName() {
-        return fSessionName;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/StreamResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/StreamResponse.java
deleted file mode 100644 (file)
index 9f59626..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Get response of viewer stream
- *
- * @author Matthew Khouzam
- */
-public class StreamResponse implements IRelayResponse {
-
-    /**
-     * Response size
-     *
-     * fId + fCtfTraceId + fMetadataFlag + fPathName + fChannelName
-     */
-    public static final int SIZE = (Long.SIZE + Long.SIZE + Integer.SIZE) / 8 + LttngViewerCommands.LTTNG_VIEWER_PATH_MAX + LttngViewerCommands.LTTNG_VIEWER_NAME_MAX;
-
-    /**
-     * id of the stream
-     */
-    private final long fId;
-    /**
-     * It is guaranteed to be unique, because the value is assigned sequentially
-     * by the relay.
-     */
-    private final long fCtfTraceId;
-    /**
-     * if the stream is a metadata stream
-     */
-    private final int fMetadataFlag;
-    /**
-     * the path
-     */
-    private final String fPathName;
-    /**
-     * The channel, traditionally channel0
-     */
-    private final String fChannelName;
-
-    /**
-     * Stream response
-     *
-     * @param inNet
-     *            input data stream
-     * @throws IOException
-     *             network time
-     */
-    public StreamResponse(DataInputStream inNet) throws IOException {
-        byte[] streamData = new byte[SIZE];
-        inNet.readFully(streamData, 0, SIZE);
-        ByteBuffer bb = ByteBuffer.wrap(streamData);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fId = (bb.getLong());
-        fCtfTraceId = bb.getLong();
-        fMetadataFlag = bb.getInt();
-        byte pathName[] = new byte[LttngViewerCommands.LTTNG_VIEWER_PATH_MAX];
-        byte channelName[] = new byte[LttngViewerCommands.LTTNG_VIEWER_NAME_MAX];
-        bb.get(pathName, 0, LttngViewerCommands.LTTNG_VIEWER_PATH_MAX);
-        bb.get(channelName, 0, LttngViewerCommands.LTTNG_VIEWER_NAME_MAX);
-        fPathName = new String(pathName);
-        fChannelName = new String(channelName);
-    }
-
-    /**
-     * Get the id
-     *
-     * @return the Id
-     */
-    public long getId() {
-        return fId;
-    }
-
-    /**
-     * Get the CtfTraceId
-     *
-     * @return the CtfTraceId
-     */
-    public long getCtfTraceId() {
-        return fCtfTraceId;
-    }
-
-    /**
-     * Get the metadata flag
-     *
-     * @return the MetadataFlag
-     */
-    public int getMetadataFlag() {
-        return fMetadataFlag;
-    }
-
-    /**
-     * Get the path name
-     *
-     * @return the PathName
-     */
-    public String getPathName() {
-        return fPathName;
-    }
-
-    /**
-     * get the Channel name
-     *
-     * @return the ChannelName
-     */
-    public String getChannelName() {
-        return fChannelName;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/TracePacketResponse.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/TracePacketResponse.java
deleted file mode 100644 (file)
index c21fe2c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Response to getpacket command
- *
- * @author Matthew Khouzam
- */
-public class TracePacketResponse implements IRelayResponse {
-
-    /**
-     * Command size
-     *
-     * fStatus + fData.length + fFlags
-     */
-    private static final int SIZE = (Integer.SIZE + Integer.SIZE + Integer.SIZE) / 8;
-    /** Enum lttng_viewer_get_packet_return_code */
-    private final GetPacketReturnCode fStatus;
-    /** flags: is there new metadata or new streams? */
-    private final int fFlags;
-    /** the packet */
-    private final byte[] fData;
-
-    /**
-     * Trace packet response network constructor
-     *
-     * @param inNet
-     *            network input stream
-     * @throws IOException
-     *             network error
-     */
-    public TracePacketResponse(DataInputStream inNet) throws IOException {
-        byte[] data = new byte[SIZE];
-        inNet.readFully(data);
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fStatus = GetPacketReturnCode.values()[bb.getInt() - 1];
-        int length = bb.getInt();
-        fFlags = bb.getInt();
-        if (fStatus.equals(GetPacketReturnCode.VIEWER_GET_PACKET_OK)) {
-            fData = new byte[length];
-            inNet.readFully(fData);
-        } else {
-            fData = new byte[0];
-        }
-    }
-
-    /**
-     * Get the status
-     *
-     * @return the Status
-     */
-    public GetPacketReturnCode getStatus() {
-        return fStatus;
-    }
-
-    /**
-     * Get the flags
-     *
-     * @return the Flags
-     */
-    public int getFlags() {
-        return fFlags;
-    }
-
-    /**
-     * Get the packet data, please do not modify the data
-     *
-     * @return the Data
-     */
-    public byte[] getData() {
-        return fData;
-    }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ViewerCommand.java b/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/relayd/lttngviewerCommands/ViewerCommand.java
deleted file mode 100644 (file)
index 20c3f5d..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation and API
- *   Marc-Andre Laperle - Initial implementation and API
- **********************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * The LTTng command
- *
- * @author Matthew Khouzam
- */
-public class ViewerCommand implements IRelayCommand {
-
-    /**
-     * Command size
-     *
-     * fDataSize + fCmdVersion + fCmd
-     */
-    public static final int SIZE = (Long.SIZE + Integer.SIZE) / 8 + Command.SIZE;
-    /**
-     * data size following this header, you normally attach a payload that one,
-     * in bytes
-     */
-    private final long fDataSize;
-    /** enum lttcomm_relayd_command */
-    private final Command fCmd;
-    /** command version */
-    private final int fCmdVersion;
-
-    /**
-     * Sets the packet command
-     *
-     * @param viewerConnect
-     *            the command
-     * @param size size of the command
-     * @param version the version number
-     */
-    public ViewerCommand(Command viewerConnect, long size, int version) {
-        fCmd = viewerConnect;
-        fDataSize = size;
-        fCmdVersion = version;
-    }
-
-    /**
-     * Get the data size
-     *
-     * @return the DataSize
-     */
-    public long getDataSize() {
-        return fDataSize;
-    }
-
-    /**
-     * Get the command
-     *
-     * @return the Cmd
-     */
-    public Command getCmd() {
-        return fCmd;
-    }
-
-    /**
-     * Get the command version
-     *
-     * @return the CmdVersion
-     */
-    public int getCmdVersion() {
-        return fCmdVersion;
-    }
-
-    @Override
-    public byte[] serialize() {
-        byte data[] = new byte[SIZE];
-        ByteBuffer bb = ByteBuffer.wrap(data);
-        bb.order(ByteOrder.BIG_ENDIAN);
-        bb.putLong(getDataSize());
-        bb.putInt(getCmd().getCommand());
-        bb.putInt(fCmdVersion);
-        return data;
-    }
-
-
-}
\ No newline at end of file
index ccd82f233d47171b2e453b1da2aeb50f2c42ddf8..2cc064b846ff2fd731b8ec51ddd6a641b8cd70f6 100644 (file)
@@ -26,14 +26,14 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.ILttngRelaydConnector;
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.LttngRelaydConnectorFactory;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.AttachReturnCode;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.AttachSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.CreateSessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.CreateSessionReturnCode;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.IndexResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.NextIndexReturnCode;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.SessionResponse;
-import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands.StreamResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.AttachReturnCode;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.AttachSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.CreateSessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.CreateSessionReturnCode;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.IndexResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.NextIndexReturnCode;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.SessionResponse;
+import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.StreamResponse;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
This page took 0.084892 seconds and 5 git commands to generate.