Please review any and all PUBLIC repositories, groups and associate files. These allow anyone on the Internet to access without authentication. Repository and group owners are responsible for their content and permission settings. Go to your project(s), click on Settings > General and expand the "Visibility, project features, permissions" to change this setting.

Merge origin/master

Conflicts:
	Brennenstuhl/src/PduStreamTools/PduListenerSaver.java
	Brennenstuhl/src/PduStreamTools/PduReaderPlayer.java
parent 9d5eb156
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment