[Ns-developers] DelayBox - ns-3
Mathieu Lacage
mathieu.lacage at sophia.inria.fr
Mon Apr 7 21:18:23 PDT 2008
On Mon, 2008-04-07 at 21:22 -0400, Matt Crinklaw wrote:
> 1. The application writer will be responsible for creating a source
> and invoking that source on every packet they send to the socket.
yes.
> 2. The application wrtier is also responsible for connecting their
> source to whatever sinks I provide to tag the packets.
Application writers are not responsible for doing the connection. They
just have to record their trace source in their TypeId in
MyApplication::GetTypeId: the code in src/core/config.cc will take care
of doing the connection for them.
class MyApplication : public Application
{
public:
static TypeId GetTypeId (void);
private:
// invoke this callback whenever a new packet is created.
TracedCallback<Ptr<const Packet> > m_txPacket;
};
TypeId
MyApplication::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MyApplication")
.SetParent<Application> ()
.AddConstructor<MyApplication> ()
.AddTraceSource ("TxPacket", "generate and send a packet down to
socket",
MakeTraceSourceAccessor (&MyApplication::m_txPacket))
;
return tid;
}
I hope that this answers your questions,
Mathieu
More information about the Ns-developers
mailing list