Commit 7f9a4ddb authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Added support for both Rubenstein & wavelet post-processing to the withLibpcap...

Added support for both Rubenstein & wavelet post-processing to the withLibpcap code. wavelet needs no extra steps, Rubenstein requires the use of the delay2dump script.
parent 81122822
# delay2dump.pl
if ($ARGV != 2)
{
die ("Usage: delay2dump.pl <in-file> <out-path>");
}
open (IN, "<".$ARGV[0]) or die("Cannot open ".$ARGV[0]);
open (OUT_SOURCE, ">".$ARGV[1]."/source.dump") or die("Cannot open source");
open (OUT_DEST1, ">".$ARGV[1]."/dest1.dump") or die("Cannot open dest 1");
open (OUT_DEST2, ">".$ARGV[1]."/dest2.dump") or die("Cannot open dest 2");
$sequence = 0;
while ($line = <IN>)
{
$line =~ /^([0-9.]+) ([0-9.]+) ([0-9.]+) ([0-9.]+)$/;
$send1 = $1;
$send2 = $2;
$delay1 = $3;
$delay2 = $4;
if ($send1 ne -9999 && $send2 ne -9999)
{
print (OUT_SOURCE, $send1." 10.0.0.2 ".$sequence);
print (OUT_SOURCE, $send2." 10.0.0.3 ".$sequence);
print (OUT_DEST1, ($send1 + $delay1)." 10.0.0.1 ".$sequence);
print (OUT_DEST2, ($send2 + $delay2)." 10.0.0.1 ".$sequence);
}
$sequence++;
}
......@@ -9,7 +9,7 @@ pathTwoDelayList = []
for delayLine in delayFileHandle.readlines():
#{
pathOneDelay, pathTwoDelay = delayLine.split()
pathOneDelay, pathTwoDelay, ignore1, ignore2 = delayLine.split()
pathOneDelay = int(pathOneDelay)
pathTwoDelay = int(pathTwoDelay)
......
......@@ -34,6 +34,7 @@ pcap_t *pcapDescriptor = NULL;
using namespace std;
vector< vector< vector< vector<double> > > > sendTimesArray;
vector< vector< vector< vector<int> > > > delaySequenceArray;
vector< vector< vector< map<unsigned long long, int> > > > packetTimeMaps;
vector< vector< vector< map<string, unsigned long long> > > > actualTimeMaps;
......@@ -92,6 +93,7 @@ void handleUDP(struct pcap_pkthdr const *pcap_info, struct udphdr const *udpHdr,
cout <<" Orig timestamp was "<< tmpStrStream.str() << " , actual time = "<< actualTimeMaps[xIndex][yIndex][hostIndex][tmpStrStream.str()]<<"\n";
cout <<"Packet time map Index = "<< packetTimeMaps[xIndex][yIndex][hostIndex][origTimestamp] << ", host index = " << hostIndex << " \n";
delaySequenceArray[xIndex][yIndex][hostIndex][packetTimeMaps[xIndex][yIndex][hostIndex][origTimestamp]] = oneWayDelay - ( actualTimeMaps[xIndex][yIndex][hostIndex][tmpStrStream.str()] - origTimestamp);
sendTimesArray[xIndex][yIndex][hostIndex][packetTimeMaps[xIndex][yIndex][hostIndex][origTimestamp]] = actualTimeMaps[xIndex][yIndex][hostIndex][tmpStrStream.str()];
if(oneWayDelay < 50000 && oneWayDelay > -50000 && (delaySequenceArray[xIndex][yIndex][hostIndex][packetTimeMaps[xIndex][yIndex][hostIndex][origTimestamp]] > 100000 || delaySequenceArray[xIndex][yIndex][hostIndex][packetTimeMaps[xIndex][yIndex][hostIndex][origTimestamp]] < -100000 ) )
{
......@@ -293,6 +295,7 @@ int main(int argc, char **argv)
fcntl(clientSocket, F_SETFL, flags | O_NONBLOCK);
delaySequenceArray.resize(numHosts-1);
sendTimesArray.resize(numHosts - 1);
packetTimeMaps.resize(numHosts-1);
actualTimeMaps.resize(numHosts-1);
......@@ -314,6 +317,7 @@ int main(int argc, char **argv)
delaySequenceArray[i].resize(numHosts - i - 1);
sendTimesArray[i].resize(numHosts - i - 1);
packetTimeMaps[i].resize(numHosts - i - 1);
actualTimeMaps[i].resize(numHosts -i - 1);
......@@ -321,7 +325,6 @@ int main(int argc, char **argv)
for( int j = i+1; j < numHosts; j++)
{
printf("PROGRESS: i = %d/%d, j = %d/%d\n",i, numHosts - 2, j, numHosts - 1);
host2 = NULL;
host2 = gethostbyname(hostList[j].c_str());
if(host2 == NULL)
......@@ -339,19 +342,22 @@ int main(int argc, char **argv)
//system(iperfCmd2.c_str());
//////////////////////////////
remoteServAddr2.sin_family = host2->h_addrtype;
memcpy((char *) &remoteServAddr2.sin_addr.s_addr,
host2->h_addr_list[0], host2->h_length);
remoteServAddr2.sin_port = htons(REMOTE_SERVER_PORT);
delaySequenceArray[i][j-i-1].resize(2);
sendTimesArray[i][j - i - 1].resize(2);
packetTimeMaps[i][j-i-1].resize(2);
actualTimeMaps[i][j-i-1].resize(2);
delaySequenceArray[i][j-i-1][0].resize(0);
delaySequenceArray[i][j-i-1][1].resize(0);
sendTimesArray[i][j - i - 1][0].resize(0);
sendTimesArray[i][j - i - 1][1].resize(0);
packetTimeMaps[i][j-i-1][0].clear();
packetTimeMaps[i][j-i-1][1].clear();
......@@ -454,6 +460,7 @@ int main(int argc, char **argv)
printf("ERROR sending first udp message\n");
packetTimeMaps[i][j-i-1][0][sendTime] = packetCounter;
delaySequenceArray[i][j-i-1][0].push_back(-9999);
sendTimesArray[i][j-i-1][0].push_back(-9999);
cout<< "TO " << hostList[i] << " :Counter=" << packetCounter << " :SendTime= " << sendTime << endl;
sendTime = getTimeMilli();
......@@ -471,6 +478,7 @@ int main(int argc, char **argv)
printf("ERROR sending second udp message\n");
packetTimeMaps[i][j-i-1][1][sendTime] = packetCounter;
delaySequenceArray[i][j-i-1][1].push_back(-9999);
sendTimesArray[i][j-i-1][0].push_back(-9999);
cout<< "TO " << hostList[j] << " :Counter=" << packetCounter << " :SendTime= " << sendTime << endl;
lastSentTime = getTimeMilli();
......@@ -563,7 +571,10 @@ int main(int argc, char **argv)
// Interpolate delays for the missing packets in this range.
int y = 0;
for (int x = k, y = 1; x < lastInRange; x++, y++)
{
delaySequenceArray[xIndex][yIndex][0][x] = delaySequenceArray[xIndex][yIndex][0][k-1] + y*step ;
sendTimesArray[xIndex][yIndex][0][x] -9999;
}
}
if (delaySequenceArray[xIndex][yIndex][1][k] == -9999)
{
......@@ -588,7 +599,10 @@ int main(int argc, char **argv)
// Interpolate delays for the missing packets in this range.
int y = 0;
for (int x = k, y = 1; x < lastInRange; x++, y++)
{
delaySequenceArray[xIndex][yIndex][1][x] = delaySequenceArray[xIndex][yIndex][1][k-1] + y*step ;
sendTimesArray[xIndex][yIndex][1][x] = -9999;
}
}
}
}
......@@ -602,7 +616,19 @@ int main(int argc, char **argv)
{
for (int k = firstSeenIndex; k < lastSeenIndex + 1; k++)
{
outputFileHandle << delaySequenceArray[xIndex][yIndex][0][k] << " " << delaySequenceArray[xIndex][yIndex][1][k] << "\n";
// Output the delay of the first packet, the delay
// of the second packet, the send time of the first
// packet, the send time of the second packet.
//
// The sequence numbers are implicit in the order.
outputFileHandle << delaySequenceArray[xIndex][yIndex][0][k]
<< " "
<< delaySequenceArray[xIndex][yIndex][1][k]
<< " "
<< sendTimesArray[xIndex][yIndex][0][k]
<< " "
<< sendTimesArray[xIndex][yIndex][1][k]
<< "\n";
}
}
outputFileHandle.close();
......
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