aggregate PacketSocketFactory when requested to.

This commit is contained in:
Mathieu Lacage
2008-03-25 14:15:56 -07:00
parent a6979a7bb9
commit 58dd143df7
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#include "packet-socket-helper.h"
#include "ns3/packet-socket-factory.h"
namespace ns3 {
void
PacketSocketHelper::Build (NodeContainer c)
{
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
Ptr<Node> node = *i;
Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
node->AggregateObject (factory);
}
}
} // namespace ns3

View File

@@ -0,0 +1,25 @@
#ifndef PACKET_SOCKET_HELPER_H
#define PACKET_SOCKET_HELPER_H
#include "ns3/node-container.h"
namespace ns3 {
/**
* \brief Give ns3::PacketSocket powers to ns3::Node.
*/
class PacketSocketHelper
{
public:
/**
* \param c container of node pointers
*
* For each node in the input container, aggregate a ns3::PacketSocketFactory
* object instance.
*/
void Build (NodeContainer c);
};
} // namespace ns3
#endif /* PACKET_SOCKET_HELPER_H */