Hello,
I would appreciate if you can take a look at the following. I have the
following simple topology:
N0 ----- N1 ------ N2
N0 sends FTP and CBR packtets to N2 throughout the simulation. I defined a new
agent My_Agent and attached it on N1 (intermediate node). Its task is to drop
both FTP and CBR packets from N0.
I defined the constructor as follows:
My_Agent::My_Agent() : Agent(PT_CBR) {...}
By writing PT_CBR does it mean it can only drop CBR packets? If yes, what shall
I put there?
Below you can find the recv() function with my queries.
It doesn't work (i.e. no packet drops) although it compiles. What do you think
is missing?
Thanks for your time.
Kind Regards,
K.
void RL_Agent::recv(Packet* pkt, Handler*) {
printf("INSIDE recv\n"); // (1) This is never printed. Why isn't
the recv() called?
struct hdr_ip *iph = hdr_ip::access(pkt);
int source_address = iph->saddr();
int destination_address = iph->daddr();;
if (source_address == 0) { drop(pkt); } // (2) By address we mean the
node number right?
else {
Packet* p = allocpkt();
hdr_ip *iph = hdr_ip::access(p);
iph->saddr() = source_address;
iph->daddr() = destination_address;
send(p, 0);
}
return;
}