A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
packet-socket-factory.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 Emmanuelle Laprise
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
7
*/
8
#include "
packet-socket-factory.h
"
9
10
#include "
packet-socket.h
"
11
12
#include "ns3/log.h"
13
#include "ns3/node.h"
14
15
namespace
ns3
16
{
17
18
NS_LOG_COMPONENT_DEFINE
(
"PacketSocketFactory"
);
19
20
NS_OBJECT_ENSURE_REGISTERED
(PacketSocketFactory);
21
22
TypeId
23
PacketSocketFactory::GetTypeId
()
24
{
25
static
TypeId
tid =
26
TypeId
(
"ns3::PacketSocketFactory"
).
SetParent
<
SocketFactory
>().SetGroupName(
"Network"
);
27
return
tid;
28
}
29
30
PacketSocketFactory::PacketSocketFactory
()
31
{
32
NS_LOG_FUNCTION
(
this
);
33
}
34
35
Ptr<Socket>
36
PacketSocketFactory::CreateSocket
()
37
{
38
NS_LOG_FUNCTION
(
this
);
39
Ptr<Node>
node =
GetObject<Node>
();
40
Ptr<PacketSocket>
socket =
CreateObject<PacketSocket>
();
41
socket->SetNode(node);
42
return
socket;
43
}
44
}
// namespace ns3
ns3::Object::GetObject
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition
object.h:511
ns3::PacketSocketFactory::PacketSocketFactory
PacketSocketFactory()
Definition
packet-socket-factory.cc:30
ns3::PacketSocketFactory::CreateSocket
Ptr< Socket > CreateSocket() override
Creates a PacketSocket and returns a pointer to it.
Definition
packet-socket-factory.cc:36
ns3::PacketSocketFactory::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
packet-socket-factory.cc:23
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SocketFactory
Object to create transport layer instances that provide a socket API to applications.
Definition
socket-factory.h:38
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
packet-socket-factory.h
packet-socket.h
src
network
utils
packet-socket-factory.cc
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0