The program jumps into this code, where I think something is going wrong. But the packet which is to be sent is created correctly, AMSend.send() returns SUCCESS as does sendDone(). A funny thing is, that when the node didn't get a Route Reply (so isRouteReplyOption is FALSE) then sending works.

/ ************************************************************************* * Forward a RouteRequest * ************************************************************************/
else {
        /*********************************************************************
         * Create a new packet and fill with appropriate values              *
         ********************************************************************/
fwdPayload = (nx_struct dsrPacket*) call Packet.getPayload (&fwdMessage, (localLength + sizeof(nx_am_addr_t))); // Let fwdPayload point to the space for our newly created request packet
        
if(fwdPayload==NULL) {printf("NULL...\n");printfflush();return localMessage;}
        
fwdOptionsHeader = (nx_struct dsrOptionsHeader*) fwdPayload; // Create the DSR Options Header
        fwdOptionsHeader->nextHeader    = optionsHeader->nextHeader;
        fwdOptionsHeader->flagF         = optionsHeader->flagF;
        fwdOptionsHeader->reserved      = optionsHeader->reserved;
fwdOptionsHeader->payloadLength = optionsHeader->payloadLength + sizeof(nx_am_addr_t);
        
fwdRrOption = (nx_struct dsrRouteRequestOption*)((nx_uint8_t*) fwdOptionsHeader + sizeof(nx_struct dsrOptionsHeader));// Create the DSR Route Request Option
                
        fwdRrOption->optionType     = rrOption->optionType;
fwdRrOption->optDataLength = rrOption->optDataLength + sizeof (nx_am_addr_t);
        fwdRrOption->identification = rrOption->identification;
        fwdRrOption->targetAddress  = rrOption->targetAddress;
        
tmpVar = (rrOption->optDataLength-4)/sizeof(nx_am_addr_t); // tmpVar now holds the number of addresses in the route request option
        
        for(tmpCounter=0; tmpCounter<tmpVar; tmpCounter++)
                fwdRrOption->address[tmpCounter] = 
rrOption->address[tmpCounter];
        
        fwdRrOption->address[tmpCounter] = myAddress;
        
if(isRouteReplyOption) { // Create DSR Route Reply Option fwdRouteReplyOption = (nx_struct dsrRouteReplyOption*) (((nx_uint8_t*) fwdPayload) + sizeof(nx_struct dsrOptionsHeader) + fwdRrOption->optDataLength + 2);
                fwdRouteReplyOption->optionType    = 
routeReplyOption->optionType;
                fwdRouteReplyOption->optDataLength = 
routeReplyOption->optDataLength;
                fwdRouteReplyOption->flagL         = routeReplyOption->flagL;
                fwdRouteReplyOption->reserved      = routeReplyOption->reserved;
                
tmpVar = (routeReplyOption->optDataLength-1)/2; // tmpVar now holds the number of addresses in the received route reply option
                
for(tmpCounter=0; tmpCounter<tmpVar; tmpCounter++) // Copy all the addersses to the new route reply option fwdRouteReplyOption->address[tmpCounter] = routeReplyOption->address [tmpCounter];
        }
        
err = call AMSend.send(AM_BROADCAST_ADDR, &fwdMessage, localLength + sizeof(nx_am_addr_t)); // Broadcast the request...
        
        return localMessage;
}
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to