A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
ofswitch13-socket-handler.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 University of Campinas (Unicamp)
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Luciano Jerez Chaves <ljerezchaves@gmail.com>
18
*/
19
20
#ifndef OFSWITCH13_SOCKET_HANDLER_H
21
#define OFSWITCH13_SOCKET_HANDLER_H
22
23
#include "
ofswitch13-interface.h
"
24
25
#include <ns3/log.h>
26
#include <ns3/packet.h>
27
#include <ns3/simulator.h>
28
#include <ns3/socket.h>
29
30
#include <queue>
31
32
namespace
ns3
33
{
34
47
class
OFSwitch13SocketHandler
:
public
Object
48
{
49
public
:
54
static
TypeId
GetTypeId
();
55
60
OFSwitch13SocketHandler
(
Ptr<Socket>
socket);
61
~OFSwitch13SocketHandler
()
override
;
62
67
typedef
Callback<void, Ptr<Packet>
,
Address
>
MessageCallback
;
68
74
void
SetReceiveCallback
(
MessageCallback
cb);
75
81
int
SendMessage
(
Ptr<Packet>
packet);
82
83
protected
:
85
void
DoDispose
()
override
;
86
87
private
:
93
void
Send
(
Ptr<Socket>
socket, uint32_t available);
94
99
void
Recv
(
Ptr<Socket>
socket);
100
101
Ptr<Socket>
m_socket
;
102
Ptr<Packet>
m_pendingPacket
;
103
uint32_t
m_pendingBytes
;
104
MessageCallback
m_receivedMsg
;
105
std::queue<Ptr<Packet>>
m_txQueue
;
106
};
107
108
}
// namespace ns3
109
#endif
/* OFSWITCH13_SOCKET_HANDLER_H */
ns3::Address
a polymophic address class
Definition:
address.h:100
ns3::Callback
Callback template class.
Definition:
callback.h:443
ns3::OFSwitch13SocketHandler
Class used to read/send single OpenFlow message from/to an open socket.
Definition:
ofswitch13-socket-handler.h:48
ns3::OFSwitch13SocketHandler::m_socket
Ptr< Socket > m_socket
TCP socket.
Definition:
ofswitch13-socket-handler.h:101
ns3::OFSwitch13SocketHandler::m_receivedMsg
MessageCallback m_receivedMsg
OpenFlow message callback.
Definition:
ofswitch13-socket-handler.h:104
ns3::OFSwitch13SocketHandler::Send
void Send(Ptr< Socket > socket, uint32_t available)
Callback for bytes available in tx buffer.
Definition:
ofswitch13-socket-handler.cc:84
ns3::OFSwitch13SocketHandler::OFSwitch13SocketHandler
OFSwitch13SocketHandler(Ptr< Socket > socket)
Complete constructor.
Definition:
ofswitch13-socket-handler.cc:37
ns3::OFSwitch13SocketHandler::m_pendingBytes
uint32_t m_pendingBytes
Pending bytes for message.
Definition:
ofswitch13-socket-handler.h:103
ns3::OFSwitch13SocketHandler::MessageCallback
Callback< void, Ptr< Packet >, Address > MessageCallback
Definition:
ofswitch13-socket-handler.h:67
ns3::OFSwitch13SocketHandler::m_txQueue
std::queue< Ptr< Packet > > m_txQueue
TX queue.
Definition:
ofswitch13-socket-handler.h:105
ns3::OFSwitch13SocketHandler::~OFSwitch13SocketHandler
~OFSwitch13SocketHandler() override
Dummy destructor, see DoDispose.
Definition:
ofswitch13-socket-handler.cc:50
ns3::OFSwitch13SocketHandler::Recv
void Recv(Ptr< Socket > socket)
Callback for bytes available in rx buffer.
Definition:
ofswitch13-socket-handler.cc:111
ns3::OFSwitch13SocketHandler::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition:
ofswitch13-socket-handler.cc:29
ns3::OFSwitch13SocketHandler::SendMessage
int SendMessage(Ptr< Packet > packet)
Send an OpenFlow message to the TCP socket.
Definition:
ofswitch13-socket-handler.cc:64
ns3::OFSwitch13SocketHandler::m_pendingPacket
Ptr< Packet > m_pendingPacket
Buffer for receiving bytes.
Definition:
ofswitch13-socket-handler.h:102
ns3::OFSwitch13SocketHandler::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
ofswitch13-socket-handler.cc:75
ns3::OFSwitch13SocketHandler::SetReceiveCallback
void SetReceiveCallback(MessageCallback cb)
Set the callback to invoke whenever an OpenFlow message has been received at the associated socket.
Definition:
ofswitch13-socket-handler.cc:56
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Ptr< Socket >
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:60
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ofswitch13-interface.h
contrib
ofswitch13
model
ofswitch13-socket-handler.h
Generated on Fri Mar 31 2023 13:30:37 for ns-3 by
1.9.1