31 #include "ns3/fatal-error.h"
43 msgSize (0), responseSize (0)
49 : size (s),
data (0), msgSize (msg), responseSize (resp)
54 data.push_back (Create<Packet> (d,
size));
59 : size (s.length () + 1),
data (0),
60 msgSize (0), responseSize (0)
63 data.push_back (Create<Packet> ((uint8_t*)s.c_str (),
size));
68 msgSize (c.msgSize), responseSize (c.responseSize)
106 data.push_back (Create<Packet> (d,s));
128 if (offset >
size)
return 0;
129 return size - offset;
135 if (seqOffset < seqFront)
139 return seqOffset - seqFront;
149 return Create<Packet> ();
151 if (
data.size () != 0)
154 std::vector<Ptr<Packet> >::size_type begin = 0;
155 bool beginFound =
false;
156 std::vector<Ptr<Packet> >::size_type end = 0;
161 count+=
data[i]->GetSize ();
169 uint32_t packetStart = count - toFragment->
GetSize ();
170 uint32_t packetOffset = o - packetStart;
177 uint32_t packetStart = count - toFragment->
GetSize ();
178 uint32_t packetOffset = o - packetStart;
179 uint32_t fragmentLength = count - o;
180 outPacket = toFragment->
CreateFragment (packetOffset, fragmentLength);
189 uint32_t packetStart = count - toFragment->
GetSize ();
190 uint32_t fragmentLength = o + s1 - packetStart;
196 for (std::vector<
Ptr<Packet> >::size_type i=begin+1; i<end; ++i)
209 return Create<Packet> (s1);
233 std::vector<Ptr<Packet> >::iterator endI =
data.begin ();
234 uint32_t current = 0;
236 for (std::vector<
Ptr<Packet> >::iterator dataI =
data.begin (); dataI <
data.end (); dataI++)
238 if (current + (*dataI)->GetSize () > count)
242 current += (*dataI)->GetSize ();
double f(double x, void *params)
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
class for managing I/O between applications and TCP
virtual void Add(uint32_t s, const uint8_t *d=0)
Add some data to end.
uint32_t responseSize
Size of response requested.
uint32_t msgSize
Total size of message.
virtual void Clear()
Remove all associated data.
uint32_t Size() const
Returns the size of the pending data.
virtual uint32_t SizeFromOffset(uint32_t offset)
uint32_t size
Number of data bytes.
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.
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.
std::vector< Ptr< Packet > > data
Corresponding data (may be null)
PendingData * CopySD(uint32_t s, uint8_t *d)
Create a copy of self with new size, new data.
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.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.