Skip to content

Commit d63d18b

Browse files
authored
Merge pull request #6 from gjaskula99/configfile
Configfile, S&F and flooding
2 parents e9071ce + 816aa21 commit d63d18b

File tree

9 files changed

+407
-76
lines changed

9 files changed

+407
-76
lines changed

Switch.config

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Rx and Tx buffers' size
2+
Switch.bufferSize=10
3+
4+
# CAM table
5+
CAM.size=8
6+
CAM.TTL=100
7+
# MAC flooding
8+
CAM.flood=false
9+
10+
# Percentage of broadcast traffic, excluding CAM learning
11+
Switch.broadcast=5
12+
# Force pushing broadcast frame to engress even if not all Tx buffers have memory available, some traffic may be lost
13+
Switch.forcePush=false
14+
15+
# Ethernet interfaces state; true is UP, false is DOWN
16+
Switch.interface0=true
17+
Switch.interface1=true
18+
Switch.interface2=false
19+
Switch.interface3=false
20+
Switch.interface4=false
21+
Switch.interface5=false
22+
Switch.interface6=false
23+
Switch.interface7=false
24+
25+
# Interface speed - how much traffic will be handled in each iteration, value is treated as bytes and should be multiplicity of 64
26+
Switch.speed=6400
27+
28+
# Switching mode; true for Cut-Through, false for Store&Forward
29+
Switch.modeCF=true
30+
31+
# Frame size
32+
Switch.fixedFrame=true
33+
34+
# Handling mode; 0 for instant, 1-4 for length percentage, 5 for EXP
35+
Switch.handling=0
36+
37+
# Minimal delay between frames
38+
Switch.delay=0
39+
40+
# Number of seconds for simulator to run
41+
Simulator.iterations=10
42+
43+
# RNG used for traffic generation
44+
# 0 - UNIFORM(min,max), 1 - EXPONENTIAL(lambda), 2 - NORMAL(mean,deviation)
45+
# Please note that not all parameters may be used for each RNG
46+
TrafficRNG.type=1
47+
TrafficRNG.param1=0.001
48+
TrafficRNG.param2=0

src/buffer/Buffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public Frame pop()
4444
assert this.currentSize > 0;
4545
currentSize--;
4646
Frame f = buffer[0];
47-
for(int i = currentSize; i >= 1; i--)
47+
for(int i = 0; i < currentSize; i++)
4848
{
49-
buffer[i - 1] = buffer[i];
49+
buffer[i] = buffer[i + 1];
5050
}
5151
return f;
5252
}

src/buffer/RxBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public Frame pop()
4040
currentSize--;
4141
Frame f = buffer[0];
4242
this.receiving[0] = 0;
43-
for(int i = currentSize; i >= 1; i--)
43+
for(int i = 0; i < currentSize; i++)
4444
{
45-
buffer[i - 1] = buffer[i];
45+
buffer[i] = buffer[i + 1];
4646
}
4747
return f;
4848
}

src/buffer/TxBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public Frame pop()
4545
currentSize--;
4646
Frame f = buffer[0];
4747
this.transmitting[0] = 0;
48-
for(int i = currentSize; i >= 1; i--)
48+
for(int i = 0; i < currentSize; i++)
4949
{
50-
buffer[i - 1] = buffer[i];
50+
buffer[i] = buffer[i + 1];
5151
}
5252
return f;
5353
}

src/l2/MAC.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ public MAC(int interfaceID, int hostID)
1717
this.address = str.toCharArray();
1818
}
1919

20+
public MAC(String address)
21+
{
22+
this.address = address.toCharArray();
23+
}
24+
2025
char[] address = new char[12];
2126

2227
public char[] getMAC()

src/l2/MACTable.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ public MACTable(int valid, int size)
1515
int defaultValidity;
1616
int maxSize;
1717

18+
public int getSize()
19+
{
20+
return address.size();
21+
}
1822
public boolean exists(MAC addr)
1923
{
2024
//if(address.contains(addr)) return true;

0 commit comments

Comments
 (0)