A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
packet-sink.h
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright 2007 University of Washington
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Tom Henderson (tomhend@u.washington.edu)
19
*/
20
21
#ifndef PACKET_SINK_H
22
#define PACKET_SINK_H
23
24
#include "ns3/application.h"
25
#include "ns3/event-id.h"
26
#include "ns3/ptr.h"
27
#include "ns3/traced-callback.h"
28
#include "ns3/address.h"
29
30
namespace
ns3 {
31
32
class
Address;
33
class
Socket;
34
class
Packet;
35
68
class
PacketSink
:
public
Application
69
{
70
public
:
71
static
TypeId
GetTypeId (
void
);
72
PacketSink
();
73
74
virtual
~
PacketSink
();
75
79
uint32_t
GetTotalRx
()
const
;
80
84
Ptr<Socket>
GetListeningSocket
(
void
)
const
;
85
89
std::list<Ptr<Socket> >
GetAcceptedSockets
(
void
)
const
;
90
91
protected
:
92
virtual
void
DoDispose
(
void
);
93
private
:
94
// inherited from Application base class.
95
virtual
void
StartApplication
(
void
);
// Called at time specified by Start
96
virtual
void
StopApplication
(
void
);
// Called at time specified by Stop
97
98
void
HandleRead (
Ptr<Socket>
);
99
void
HandleAccept (
Ptr<Socket>
,
const
Address
& from);
100
void
HandlePeerClose (
Ptr<Socket>
);
101
void
HandlePeerError (
Ptr<Socket>
);
102
103
// In the case of TCP, each socket accept returns a new socket, so the
104
// listening socket is stored seperately from the accepted sockets
105
Ptr<Socket>
m_socket;
// Listening socket
106
std::list<Ptr<Socket> > m_socketList;
//the accepted sockets
107
108
Address
m_local;
// Local address to bind to
109
uint32_t m_totalRx;
// Total bytes received
110
TypeId
m_tid;
// Protocol TypeId
111
TracedCallback<Ptr<const Packet>
,
const
Address
&> m_rxTrace;
112
113
};
114
115
}
// namespace ns3
116
117
#endif
/* PACKET_SINK_H */
118
ns3::Ptr< Socket >
ns3::TracedCallback
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
Definition:
traced-callback.h:43
ns3::Address
a polymophic address class
Definition:
address.h:86
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:61
ns3::PacketSink::StopApplication
virtual void StopApplication(void)
Application specific shutdown code.
Definition:
packet-sink.cc:138
ns3::PacketSink::GetTotalRx
uint32_t GetTotalRx() const
Definition:
packet-sink.cc:72
ns3::PacketSink::GetAcceptedSockets
std::list< Ptr< Socket > > GetAcceptedSockets(void) const
Definition:
packet-sink.cc:86
ns3::PacketSink::DoDispose
virtual void DoDispose(void)
Definition:
packet-sink.cc:92
ns3::PacketSink::StartApplication
virtual void StartApplication(void)
Application specific startup code.
Definition:
packet-sink.cc:104
ns3::PacketSink
Receive and consume traffic generated to an IP address and port.
Definition:
packet-sink.h:68
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:44
ns3::PacketSink::GetListeningSocket
Ptr< Socket > GetListeningSocket(void) const
Definition:
packet-sink.cc:79
src
applications
model
packet-sink.h
Generated on Sun Mar 16 2014 11:25:01 for ns-3 by
1.8.6