From 6a0fcc659121bbe3a5a13897ceb357e3a12bcc1f Mon Sep 17 00:00:00 2001 From: jihoonl Date: Fri, 10 Jul 2009 01:03:49 +0000 Subject: [PATCH] fixed --- .../Benchmarks/SingleTM/Intruder/Decoder.java | 10 ++++++---- .../Benchmarks/SingleTM/Intruder/Detector.java | 1 - .../Benchmarks/SingleTM/Intruder/Intruder.java | 3 ++- .../Benchmarks/SingleTM/Intruder/Stream.java | 17 ++++++++++------- .../src/Benchmarks/SingleTM/Intruder/makefile | 2 -- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java b/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java index 972d1bf2..aa9e6085 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Decoder.java @@ -139,6 +139,7 @@ public class Decoder { return er.SHORT; } + int flowId = packetPtr.flowId; int fragmentId = packetPtr.fragmentId; int numFragment = packetPtr.numFragment; @@ -190,15 +191,17 @@ public class Decoder { List_Iter it = new List_Iter(); it.reset(fragmentListPtr); - + if(!it.hasNext(fragmentListPtr)) { System.out.println("Assertion in Decoder2.process"); System.exit(1); } Packet firstFragmentPtr = (Packet)it.next(fragmentListPtr); + int expectedNumFragment = firstFragmentPtr.numFragment; + if (numFragment != expectedNumFragment) { status = MAP_REMOVE(fragmentedMapPtr,flowId); if(!status) { @@ -245,11 +248,10 @@ public class Decoder { String data = new String(); - Packet fragmentPtr = null; it.reset(fragmentListPtr); - while(it.hasNext(fragmentListPtr)) { - fragmentPtr = (Packet)it.next(fragmentListPtr); + while(it.hasNext(fragmentListPtr)) { + Packet fragmentPtr = (Packet)it.next(fragmentListPtr); data +=(fragmentPtr.data); } diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java b/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java index 4f1c6f0a..eaf29d3d 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Detector.java @@ -152,7 +152,6 @@ public class Detector { for(p = 0; p < numPreprocessor; p++) { Integer preprocessor = (Integer)preprocessorVectorPtr.vector_at(p); if(preprocessor.intValue() == 1) { - convertURNHex.process(str); System.out.println("NOOOOOOOOOOOOO"); } else if(preprocessor.intValue() == 2) { diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java b/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java index 8c1dce7a..529179bf 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Intruder.java @@ -102,7 +102,7 @@ public class Intruder extends Thread { threadID = myID; } - private setDefaultParams() + private void setDefaultParams() { percentAttack = PARAM_DEFAULT_ATTACK; maxDataLength = PARAM_DEFAULT_LENGTH; @@ -389,6 +389,7 @@ public class Intruder extends Thread { } System.out.println("Finished"); + System.exit(0); } } diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java b/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java index a432f096..0b4d9dbb 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java +++ b/Robust/src/Benchmarks/SingleTM/Intruder/Stream.java @@ -1,9 +1,9 @@ #define MAP_T RBTree #define MAP_ALLOC(hash, cmp) RBTree.alloc(cmp) #define MAP_INSERT(map, key, data) map.insert(key, data) -#define MAP_CONTAINS(map, key) map.contains(key); -#define MAP_FIND(map,key) map.get(key); -#define MAP_REMOVE(map,key) map.deleteNode(key); +#define MAP_CONTAINS(map, key) map.contains(key) +#define MAP_FIND(map,key) map.get(key) +#define MAP_REMOVE(map,key) map.deleteNode(key) public class Stream { int percentAttack; @@ -151,10 +151,6 @@ public class Stream { /* Create random string */ int length = (randomPtr.random_generate() % maxLength) + 1; - if (!status) { - System.out.printString("Assert failed: status is null\n"); - System.exit(0); - } int l; char c[] = new char[length+1]; for (l = 0; l < length; l++) { @@ -164,6 +160,13 @@ public class Stream { str = new String(c); String str2 = new String(c); status = allocVectorPtr.vector_pushBack(str); + + if(!status) { + System.out.println("Assert faiiled status is null."); + System.exit(0); + } + + int err = detectorPtr.process(str2); if (err == error.SIGNATURE) { status = MAP_INSERT(attackMapPtr, f, str); diff --git a/Robust/src/Benchmarks/SingleTM/Intruder/makefile b/Robust/src/Benchmarks/SingleTM/Intruder/makefile index 77cbe56e..4be1d892 100644 --- a/Robust/src/Benchmarks/SingleTM/Intruder/makefile +++ b/Robust/src/Benchmarks/SingleTM/Intruder/makefile @@ -6,8 +6,6 @@ SRC=ttttmp${MAINCLASS}.java \ ttttmpRBTree.java \ Preprocessor.java \ Detector.java \ - convertURNHex.java \ - toLower.java \ Decoded.java \ ERROR.java \ Dictionary.java \ -- 2.34.1