A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
pending-data.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2006 Georgia Tech Research Corporation
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: Rajib Bhattacharjea<raj.b@gatech.edu>
19 //
20 
21 // Georgia Tech Network Simulator - Data Descriptors
22 // George F. Riley. Georgia Tech, Spring 2002
23 
24 #ifndef PENDING_DATA_H
25 #define PENDING_DATA_H
26 
27 #include "ns3/packet.h"
28 #include "pending-data.h"
29 #include "ns3/sequence-number.h"
30 
31 #include "ns3/ptr.h"
32 namespace ns3
33 {
34 class Packet;
35 
41 class PendingData {
42 public:
43  PendingData ();
44  PendingData (uint32_t s, uint8_t* d = NULL, uint32_t msg = 0, uint32_t resp = 0);
45  PendingData (const std::string&); // Construct from string
46  PendingData (uint8_t*, uint32_t&, Packet*); // Construct from serialized buffer
47  PendingData (const PendingData&); // Copy constructor
48  virtual ~PendingData (); // Destructor
49  uint32_t Size () const { return size; }
50  // Serialization
51  uint8_t* Serialize (uint8_t*, uint32_t&); // Serialize to a buffer
52  uint8_t* Construct (uint8_t*, uint32_t&); // Construct from buffer
53  virtual void Clear (); // Remove all associated data
54  virtual void Add (uint32_t s, const uint8_t* d = 0); // Add some data to end
55  virtual void Add (Ptr<Packet> p);
75  virtual uint32_t SizeFromSeq (const SequenceNumber32& seqFront, const SequenceNumber32& seqOffset);
76  // Inquire available data from offset
81  virtual uint32_t SizeFromOffset (uint32_t offset);
82  // Available size from sequence difference
91  virtual uint32_t OffsetFromSeq (const SequenceNumber32& seqFront, const SequenceNumber32& seqOffset);
92  virtual Ptr<Packet> CopyFromOffset (uint32_t, uint32_t); // Size, offset, ret packet
93  // Copy data, size, offset specified by sequence difference
94  virtual Ptr<Packet> CopyFromSeq (uint32_t, const SequenceNumber32&, const SequenceNumber32&);
104  virtual uint32_t RemoveToSeq (const SequenceNumber32& seqFront, const SequenceNumber32& seqOffset);
105  PendingData* Copy () const; // Create a copy of this header
106  PendingData* CopyS (uint32_t); // Copy with new size
107  PendingData* CopySD (uint32_t, uint8_t*); // Copy with new size, new data
108 public:
109  uint32_t size; // Number of data bytes
110  std::vector<Ptr<Packet> > data; // Corresponding data (may be null)
111  // The next two fields allow simulated applications to exchange some info
112  uint32_t msgSize; // Total size of message
113  uint32_t responseSize; // Size of response requested
114 };
115 
116 } //namepsace ns3
117 
118 #endif /* PENDING_DATA_H */
virtual uint32_t RemoveToSeq(const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
network packets
Definition: packet.h:203
virtual uint32_t SizeFromOffset(uint32_t offset)
class for managing I/O between applications and TCP
Definition: pending-data.h:41
virtual uint32_t SizeFromSeq(const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
virtual uint32_t OffsetFromSeq(const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)