A Discrete-Event Network Simulator
API
pending-data.h
Go to the documentation of this file.
1//
2// Copyright (c) 2006 Georgia Tech Research Corporation
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: Rajib Bhattacharjea<raj.b@gatech.edu>
18//
19
20// Georgia Tech Network Simulator - Data Descriptors
21// George F. Riley. Georgia Tech, Spring 2002
22
23#ifndef PENDING_DATA_H
24#define PENDING_DATA_H
25
26#include "pending-data.h"
27
28#include "ns3/packet.h"
29#include "ns3/ptr.h"
30#include "ns3/sequence-number.h"
31
32namespace ns3
33{
34class Packet;
35
42{
43 public:
52 PendingData(uint32_t s, uint8_t* d = nullptr, uint32_t msg = 0, uint32_t resp = 0);
57 PendingData(const std::string& s); // Construct from string
58
63 PendingData(const PendingData& o); // Copy constructor
64 virtual ~PendingData(); // Destructor
65
70 uint32_t Size() const
71 {
72 return size;
73 }
74
78 virtual void Clear();
79
85 virtual void Add(uint32_t s, const uint8_t* d = nullptr); //
90 virtual void Add(Ptr<Packet> p);
110 virtual uint32_t SizeFromSeq(const SequenceNumber32& seqFront,
111 const SequenceNumber32& seqOffset);
112 // Inquire available data from offset
117 virtual uint32_t SizeFromOffset(uint32_t offset);
118 // Available size from sequence difference
127 virtual uint32_t OffsetFromSeq(const SequenceNumber32& seqFront,
128 const SequenceNumber32& seqOffset);
129
136 virtual Ptr<Packet> CopyFromOffset(uint32_t s, uint32_t o); // Size, offset, ret packet
147 const SequenceNumber32& f,
148 const SequenceNumber32& o);
158 virtual uint32_t RemoveToSeq(const SequenceNumber32& seqFront,
159 const SequenceNumber32& seqOffset);
160
165 PendingData* Copy() const;
173 PendingData* CopyS(uint32_t s); // Copy
182 PendingData* CopySD(uint32_t s, uint8_t* d);
183
184 public:
186 std::vector<Ptr<Packet>> data;
187 // The next two fields allow simulated applications to exchange some info
190};
191
192} // namespace ns3
193
194#endif /* PENDING_DATA_H */
double f(double x, void *params)
Definition: 80211b.c:71
class for managing I/O between applications and TCP
Definition: pending-data.h:42
uint32_t responseSize
Size of response requested.
Definition: pending-data.h:189
uint32_t msgSize
Total size of message.
Definition: pending-data.h:188
virtual ~PendingData()
Definition: pending-data.cc:79
virtual void Clear()
Remove all associated data.
uint32_t Size() const
Returns the size of the pending data.
Definition: pending-data.h:70
virtual uint32_t SizeFromOffset(uint32_t offset)
uint32_t size
Number of data bytes.
Definition: pending-data.h:185
virtual uint32_t RemoveToSeq(const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
Permits object to clear any pending data between seqFront and seqOffset - 1).
virtual uint32_t SizeFromSeq(const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
This method returns the number of bytes in the PendingData buffer beyond the sequence number specifie...
PendingData * Copy() const
Create a copy of self.
Definition: pending-data.cc:85
virtual Ptr< Packet > CopyFromOffset(uint32_t s, uint32_t o)
Copy data starting from a give offset.
PendingData * CopyS(uint32_t s)
Create a copy of self with new size.
Definition: pending-data.cc:92
std::vector< Ptr< Packet > > data
Corresponding data (may be null)
Definition: pending-data.h:186
virtual void Add(uint32_t s, const uint8_t *d=nullptr)
Add some data to end.
PendingData * CopySD(uint32_t s, uint8_t *d)
Create a copy of self with new size, new data.
Definition: pending-data.cc:99
virtual Ptr< Packet > CopyFromSeq(uint32_t s, const SequenceNumber32 &f, const SequenceNumber32 &o)
Copy data starting from a give offset.
virtual uint32_t OffsetFromSeq(const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
Subtracts seqFront from seqOffset after enforcing seqFront is less than seqOffset.
Every class exported by the ns3 library is enclosed in the ns3 namespace.