[ns] UDP Agent: target_->recv(); - Segmentation fault
Thomas Michael Bohnert
both at bothom.de
Tue Sep 27 10:58:09 PDT 2005
Dear Readers,
we ask for ideas regarding the solution of following problem.
To simulate Buffering/Caching (it is not important to know exactly) we simply
copied the standard UDP Agent class and extended it with our functionalities.
A sender caches packets, a receiver buffers. However, Buffering and Caching
is implemented in the UDP Agent class solely, meaning each Agent has both
capabilites.
In case of an transfer interruption, e.g. link failure or handover, cache and
buffer are synchronised to reduces packet loss. As this scenario involves
some signalling the receiver (Buffer side) simply sends a message to the
sender (Cache side) asking for missed content which is in turn resent by the
sender (Cache side). This simple signalling is implemented in the methode
below.
Note, to carry our information, we extended the hdr_cmn with some new fields.
The problem. When we run our simulation we end up with a seg-fault because
"target_" is NULL! Who has any idea what could be the reason for?
Thanks in advance,
Thomas & Luis
bool BCUdpAgent::syncBufferRequest() {
Packet *p;
hdr_cmn *hc;
//set header content for buffer syncing
p = allocpkt();
hc=hdr_cmn::access(p);
hc->signalling()=1; //(1) means sync reply
hc->seqno()=lastSeqno+1;
hc->numPckts()=bufferSize_-buffer.getCurrentSize();
//send packet
if(target_==NULL){
if(DEBUG)printf("RECEIVER: Can not send sync request\n");
}else{
target_->recv(p);
}
}
The rellevat script code.
#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
#Create a UDP agent (sender) and attach it to node n0
set sndBcUdp [new Agent/BCUDP]
$ns attach-agent $n0 $sndBcUdp
$sndBcUdp set cacheSize_ 300 ;# simulated cachesize in packets
set poo [new Application/Traffic/Pareto] ;# Create a traffic source and attach
it to sndBcUdp
$poo attach-agent $sndBcUdp
$poo set packetSize_ $packetSize
$poo set burst_time_ 500ms
$poo set idle_time_ 500ms
$poo set rate_ $txRateVideo
#$poo set rate_ $txRateVoIP
$poo set shape_ 1.2
#Create an agent (a traffic sink) and attach it to node n1
set rcvBcUdp [new Agent/BCUDP]
$ns attach-agent $n1 $rcvBcUdp
$rcvBcUdp set target $sndBcUdp
$rcvBcUdp set bufferSize_ 200 ;# simulated buffsize in packets
$rcvBcUdp set appBufferSize_ 20 ;# simulated application buffer size.
(fraction of the buffer size)
$rcvBcUdp set haBufferMargin_ 150 ;# simulated handover buffer margin.
(fraction of the buffer size)
$rcvBcUdp set appCbrPeriod_ $packetSize/$txRateVideo
#Connect the traffic source with the traffic sink
$ns connect $sndBcUdp $rcvBcUdp
More information about the Ns-users
mailing list