NS2 Notebook: Multi-channel Multi-interface Simulation in NS2 (2.29)

Back to Index


11. Modifications in apps/udp.cc

// Manual Routing
// raniwala : messy global declarations

extern int global_flowid;
extern int flow_to_tag[];

......

UdpAgent::UdpAgent() : Agent(PT_UDP), seqno_(-1)
{

  //Manual Routing
  // raniwala: adding flow-id

  global_flowid++;
  flow_id = global_flowid;
  flow_to_tag[flow_id] = -1;

}

 

UdpAgent::UdpAgent(packet_t type) : Agent(type)
{

   //Manual Routing
  // raniwala: adding flow-id

  global_flowid++;
  flow_id = global_flowid;
  flow_to_tag[flow_id] = -1;

}

 

void UdpAgent::sendmsg(int nbytes, AppData* data, const char* flags)
{

  ......

  while (n-- > 0) {
    p = allocpkt();
    hdr_cmn::access(p)->size() = size_;

    // Manual Routing
    // setting flow and tag

    hdr_cmn::access(p)->_flowid_ = flow_id;
    hdr_cmn::access(p)->_tag_ = -1;

    ......

  }

  n = nbytes % size_;
  if (n > 0) {
    p = allocpkt();
    hdr_cmn::access(p)->size() = n;

    // Manual Routing
    // raniwala: setting flow and tag

    hdr_cmn::access(p)->_flowid_ = flow_id;
    hdr_cmn::access(p)->_tag_ = -1;

    ......

  }

}

 

 
© Copyright 2008. All rights reserved. Powered by Free Site Templates