[ns] estimate the network conditions !

2008-06-11 Thread levy david

 Hello,

I need to do the following :
a node send a packet iff he estimate that his network conditions is good
(the node want to minimize the probability of packet loss), by good
conditions i mean no congestion, no collisions ...

my questions ;
1- among the following conditions which ones i should use and how (in ns2)
-awareness of the current queue size,
-packet statistics at the routing layer (received, forwarded, dropped),
-frame statistics at the link layer (received, retransmitted, dropped),
-current random backoff timer,
-and number of collisions,
2- how to combine them to make a final decision
3- is there any others conditions ?


I appreciate your replies.

Thanks,
LEVY David.


[ns] can't send pkt (unicast/broadcast) - MANET ns2.30

2008-05-08 Thread levy david

Hello ns-suers,

 i can't send unicast or broadcast packets, I try several solutions, but no
one works!

1- the code for unicast  (sendUnicast(destination))

Packet* pkt = allocpkt();
hdr_cmn* hdrcmn = hdr_cmn::access(pkt);
hdr_ip* iphdr   = hdr_ip::access(pkt);
hdr_monitor* hdrret = hdr_monitor::access(pktret);
hdrret-ret = 1;
hdrcmn-next_hop_ = destination;
hdrcmn-prev_hop_ = this-addr();
hdrcmn-direction() = hdr_cmn::DOWN;
hdrcmn-ptype() = PT_MONITOR;
hdrcmn-addr_type() = NS_AF_INET;   //NS_AF_INET; // NS_AF_ILINK;

// setting the ip header
iphdr-saddr() = this-addr();
iphdr-sport() = 100; // 1-254
iphdr-daddr() = destination;
iphdr-dport() = 100; // 1-254
iphdr-ttl() = 32;
fprintf(stderr, %d send request to %d \n,this-addr(),destination);

// send
Scheduler::instance().schedule(ll, pkt, 0.0);

2- for broadcast i use the following code

Packet* pkt = allocpkt();
hdr_gc* hdr = hdr_gc::access(pkt);
hdr-ret = 0;
hdr_cmn* hdrcmn = hdr_cmn::access(pkt);
hdr_ip* iphdr   = hdr_ip::access(pkt);
hdrcmn-next_hop_ = IP_BROADCAST;
hdrcmn-prev_hop_ = this-addr();
hdrcmn-direction() = hdr_cmn::DOWN;
hdrcmn-ptype() = PT_GC;
hdrcmn-addr_type() = NS_AF_INET;  //NS_AF_NONE NS_AF_ILINK;

// setting the ip header
iphdr-saddr() = this-addr();
iphdr-sport() = 101; // 1-254
iphdr-daddr() = IP_BROADCAST;
iphdr-dport() = 101; // 1-254
iphdr-ttl() = 1;
fprintf(stderr, %d send bcats\n,this-addr());

// send
Scheduler::instance().schedule(ll, pkt, 0.0); // _target !
-
i use the TclObject::lookup to get the ll.


Thanks
Regards


[ns] send unicast packets and packets to the direct neighbors !

2008-05-06 Thread levy david

Hello all,

I have some questions :

1 - how to define an agent to send unicast packet (sendunicast(packet, *
destination*)!)
2 - how to define an agent to send packets to *the direct neighbors
*3-  how to estimate the the number of the *one hop neighbors*
4 - how to define two types of node (type 1 with a behaviour and type 2 with
another behavior)

I need a component that estimate the network' state (congestion,...) you
have an idea ?

Thank you.
David