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
ns3tcp-socket-writer.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*/
6
7
#ifndef NS3TCP_SOCKET_WRITER_H
8
#define NS3TCP_SOCKET_WRITER_H
9
10
#include "ns3/address.h"
11
#include "ns3/application.h"
12
#include "ns3/node.h"
13
#include "ns3/ptr.h"
14
#include "ns3/socket.h"
15
16
namespace
ns3
17
{
18
19
/**
20
* @ingroup system-tests-tcp
21
*
22
* @brief Simple class to write data to sockets.
23
*/
24
class
SocketWriter
:
public
Application
25
{
26
public
:
27
SocketWriter
();
28
~SocketWriter
()
override
;
29
/**
30
* Register this type.
31
* @return The TypeId.
32
*/
33
static
TypeId
GetTypeId
();
34
35
/**
36
* Setup the socket.
37
* @param node The node owning the socket.
38
* @param peer The destination address.
39
*/
40
void
Setup
(
Ptr<Node>
node,
Address
peer);
41
/**
42
* Connect the socket.
43
*/
44
void
Connect
();
45
/**
46
* Write to the socket.
47
* @param numBytes The number of bytes to write.
48
*/
49
void
Write
(
uint32_t
numBytes);
50
/**
51
* Close the socket.
52
*/
53
void
Close
();
54
55
private
:
56
void
StartApplication
()
override
;
57
void
StopApplication
()
override
;
58
Address
m_peer
;
//!< Peer's address.
59
Ptr<Node>
m_node
;
//!< Node pointer
60
Ptr<Socket>
m_socket
;
//!< Socket.
61
bool
m_isSetup
;
//!< True if the socket is connected.
62
bool
m_isConnected
;
//!< True if the socket setup has been done.
63
};
64
}
// namespace ns3
65
66
#endif
// NS3TCP_SOCKET_WRITER_H
ns3::Address
a polymophic address class
Definition
address.h:114
ns3::Application::Application
Application()
Definition
application.cc:49
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:70
ns3::SocketWriter::m_peer
Address m_peer
Peer's address.
Definition
ns3tcp-socket-writer.h:58
ns3::SocketWriter::SocketWriter
SocketWriter()
Definition
ns3tcp-socket-writer.cc:15
ns3::SocketWriter::~SocketWriter
~SocketWriter() override
Definition
ns3tcp-socket-writer.cc:23
ns3::SocketWriter::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
ns3tcp-socket-writer.cc:31
ns3::SocketWriter::Connect
void Connect()
Connect the socket.
Definition
ns3tcp-socket-writer.cc:61
ns3::SocketWriter::Setup
void Setup(Ptr< Node > node, Address peer)
Setup the socket.
Definition
ns3tcp-socket-writer.cc:53
ns3::SocketWriter::Write
void Write(uint32_t numBytes)
Write to the socket.
Definition
ns3tcp-socket-writer.cc:72
ns3::SocketWriter::m_node
Ptr< Node > m_node
Node pointer.
Definition
ns3tcp-socket-writer.h:59
ns3::SocketWriter::Close
void Close()
Close the socket.
Definition
ns3tcp-socket-writer.cc:83
ns3::SocketWriter::m_isSetup
bool m_isSetup
True if the socket is connected.
Definition
ns3tcp-socket-writer.h:61
ns3::SocketWriter::StopApplication
void StopApplication() override
Application specific shutdown code.
Definition
ns3tcp-socket-writer.cc:48
ns3::SocketWriter::m_socket
Ptr< Socket > m_socket
Socket.
Definition
ns3tcp-socket-writer.h:60
ns3::SocketWriter::m_isConnected
bool m_isConnected
True if the socket setup has been done.
Definition
ns3tcp-socket-writer.h:62
ns3::SocketWriter::StartApplication
void StartApplication() override
Application specific startup code.
Definition
ns3tcp-socket-writer.cc:41
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:49
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
test
ns3tcp
ns3tcp-socket-writer.h
Generated on
for ns-3 by
1.15.0