Skip to content
Snippets Groups Projects
Commit 669ec6c7 authored by Brennenstuhl, Tobias FORNATL, GY's avatar Brennenstuhl, Tobias FORNATL, GY
Browse files

Merge origin/master

Conflicts:
	Brennenstuhl/src/PduStreamTools/PduListenerSaver.java
	Brennenstuhl/src/PduStreamTools/PduReaderPlayer.java
parent 9d5eb156
No related branches found
No related tags found
No related merge requests found
......@@ -4,85 +4,80 @@
*/
package PduStreamTools;
import PduStreamTools.RecorderBinary;
import java.io.IOException;
import java.util.Scanner;
/**
* PduSaver.java created on Aug 21, 2019
* MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu
* PduSaver.java created on Aug 21, 2019 MOVES Institute Naval Postgraduate
* School, Monterey, CA, USA www.nps.edu
*
* @author Mike Bailey, jmbailey@nps.edu
* @version $Id$
*/
public class PduListenerSaver
{
private final static String DEFAULT_OUTPUTDIR = "pduLog";
private final static String MCAST_ADDR = "239.1.2.3";
private final static int DIS_PORT = 3000;
public class PduListenerSaver {
private enum mystate
{
RUNNING,
PAUSED;
}
private final static String DEFAULT_OUTPUTDIR = "pduLog";
private final static String MCAST_ADDR = "239.1.2.3";
private final static int DIS_PORT = 3000;
public static void main(String[] args) throws IOException
{
String outDir = DEFAULT_OUTPUTDIR;
String mcast = MCAST_ADDR;
int port = DIS_PORT;
System.out.println("DisExamplesOpenDis7.PduListenerSaver started...");
switch (args.length) {
case 0:
break;
case 1:
outDir = args[0];
break;
case 3:
outDir = args[0];
mcast = args[1];
port = Integer.parseInt(args[2]);
break;
default:
System.err.println("Usage: PduListener() or PduListener(\"outputdir\") or PduListener(\"outputdir\",\"multicast address\", ipPort");
System.exit(1);
private enum mystate {
RUNNING,
PAUSED;
}
System.out.println("Beginning pdu save to directory " + outDir);
//RecorderPlainText stores an unencoded PduLog
//RecorderPlainText recorder = new RecorderPlainText(outDir, mcast, port);
//RecorderBase64 stores a BASE64 encoded PduLog
//RecorderBase64 recorder = new RecorderBase64(outDir, mcast, port);
//RecorderBinary stores a Binary PduLog
RecorderBinary recorder = new RecorderBinary(outDir, mcast, port);
recorder.startResume();
mystate state = mystate.RUNNING;
System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
Scanner scan = new Scanner(System.in);
while (true) {
System.out.println("Warning: you must quit when complete, otherwise recorded PDUs are lost!");
System.out.println("Type p/enter to pause, r/enter to resume, q/enter to stop recording, save and quit");
String line = scan.nextLine();
if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) {
recorder.stopPause();
state = mystate.PAUSED;
System.out.println("* recorder.stopPause(), state=PAUSED, recording paused...");
}
else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) {
recorder.startResume();
state = mystate.RUNNING;
System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
public static void main(String[] args) throws IOException {
String outDir = DEFAULT_OUTPUTDIR;
String mcast = MCAST_ADDR;
int port = DIS_PORT;
System.out.println("DisExamplesOpenDis7.PduListenerSaver started...");
switch (args.length) {
case 0:
break;
case 1:
outDir = args[0];
break;
case 3:
outDir = args[0];
mcast = args[1];
port = Integer.parseInt(args[2]);
break;
default:
System.err.println("Usage: PduListener() or PduListener(\"outputdir\") or PduListener(\"outputdir\",\"multicast address\", ipPort");
System.exit(1);
}
else if (line.equalsIgnoreCase("q")) {
recorder.end();
System.out.println("* recorder.end(), recording complete.");
break;
System.out.println("Beginning pdu save to directory " + outDir);
//RecorderPlainText stores an unencoded PduLog
//RecorderPlainText recorder = new RecorderPlainText(outDir, mcast, port);
//RecorderBase64 stores a BASE64 encoded PduLog
//RecorderBase64 recorder = new RecorderBase64(outDir, mcast, port);
//RecorderBinary stores a Binary PduLog
RecorderBinary recorder = new RecorderBinary(outDir, mcast, port);
recorder.startResume();
mystate state = mystate.RUNNING;
System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
Scanner scan = new Scanner(System.in);
while (true) {
System.out.println("Warning: you must quit when complete, otherwise recorded PDUs are lost!");
System.out.println("Type p/enter to pause, r/enter to resume, q/enter to stop recording, save and quit");
String line = scan.nextLine();
if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) {
recorder.stopPause();
state = mystate.PAUSED;
System.out.println("* recorder.stopPause(), state=PAUSED, recording paused...");
} else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) {
recorder.startResume();
state = mystate.RUNNING;
System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
} else if (line.equalsIgnoreCase("q")) {
recorder.end();
System.out.println("* recorder.end(), recording complete.");
break;
}
}
System.out.println("Ending pdu save to " + recorder.getLogFile());
}
System.out.println("Ending pdu save to "+recorder.getLogFile());
}
}
......@@ -53,10 +53,11 @@ public class PduReaderPlayer {
try {
//Use Tobis Code without decryption
//Does only work with unecrypted PduLogs
PlayerPlainText player = new PlayerPlainText(mcast, port, new File(outDir).toPath());
//PlayerPlainText player = new PlayerPlainText(mcast, port, new File(outDir).toPath());
//Use Mike Baileys Code to store a file in BASE64 format
//PlayerBase64 player = new PlayerBase64(mcast, port, new File(outDir).toPath());
PlayerBase64 player = new PlayerBase64(mcast, port, new File(outDir).toPath());
player.startResume();
mystate state = mystate.RUNNING;
Scanner scan = new Scanner(System.in);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment