Skip to content

Commit

Permalink
Add passDDDFilter method within DDD
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinna Adhikari committed Dec 6, 2020
1 parent cbc4859 commit 6744eae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/ddd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class DDD extends Entity {
// Bind methods
this.sendPackets = this.sendPackets.bind(this);
this.passPortFilter = this.passPortFilter.bind(this);
this.passDDDFilter = this.passDDDFilter.bind(this);
this.openNewPorts = this.openNewPorts.bind(this);

}
Expand Down Expand Up @@ -45,6 +46,10 @@ export class DDD extends Entity {
return this.openPorts.includes(packet.dstPort);
}

passDDDFilter(packet){
return false;
}

sendPackets(dstEntity = undefined) {
// Send packet from srcEntity to dstEntity. If dstEntity undefined, then send to nextEntity
if (!dstEntity) {
Expand All @@ -56,7 +61,7 @@ export class DDD extends Entity {
for (let i = 0; i < this.packetsPerTimeUnit; ++i) {
let packet = this.dequeue();
if (packet) {
if (!this.passPortFilter(packet)) {
if (!this.passDDDFilter(packet)) {
packet.dropped = true;
this.garbage.enqueue(packet);
}
Expand Down

0 comments on commit 6744eae

Please sign in to comment.