[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] Allocate and send a packet in C++ level



> Packet *new_pkt = Agent::allocpkt()
> send(new_pkt,0)
> 
> I used Agent::    because I do that in the Queue class and not in the Agent
> class. Also, I changed the "allocpkt()" in the agent.h to public from
> protected and I included the "agent.h in the C++ function in which I give

You should read the implementations of Agent::allocpkt() and
Agent::initpkt() in agent.cc, then you'll see they need member variables
of an Agent object hence can't be made a static method.

If you want to create a packet without an agent, change the implementation
of allocpkt() in your own class. If you are not deriving your class from
Agent you have to copy/adapt allocpkt there.

- Haobo