SCTPQueue.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2005-2009 Irene Ruengeler
00003 // Copyright (C) 2009-2010 Thomas Dreibholz
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, see <http://www.gnu.org/licenses/>.
00017 //
00018 
00019 #ifndef __SCTPQUEUE_H
00020 #define __SCTPQUEUE_H
00021 
00022 #include <omnetpp.h>
00023 #include "INETDefs.h"
00024 #include "IPvXAddress.h"
00025 #include "SCTP.h"
00026 
00027 
00028 class SCTPDataVariables;
00029 class SCTPAssociation;
00030 
00031 
00049 class INET_API SCTPQueue : public cPolymorphic
00050 {
00051     public:
00055      SCTPQueue();
00056 
00060      ~SCTPQueue();
00061 
00062     bool checkAndInsertChunk(const uint32 key, SCTPDataVariables* chunk);
00063     /* returns true if new data is inserted and false if data was present */
00064 
00065     SCTPDataVariables* getAndExtractChunk(const uint32 tsn);
00066     SCTPDataVariables* extractMessage();
00067 
00068     void printQueue() const;
00069 
00070     uint32 getQueueSize() const;
00071 
00072     SCTPDataVariables* getFirstChunk() const;
00073 
00074     cMessage* getMsg(const uint32 key) const;
00075 
00076     SCTPDataVariables* getChunk(const uint32 key) const;
00077 
00078     SCTPDataVariables* getChunkFast(const uint32 tsn, bool& firstTime);
00079 
00080     void removeMsg(const uint32 key);
00081 
00082     bool deleteMsg(const uint32 tsn);
00083 
00084     int32 getNumBytes() const;
00085 
00086     SCTPDataVariables* dequeueChunkBySSN(const uint16 ssn);
00087 
00088 
00089   public:
00090      typedef std::map<uint32, SCTPDataVariables*> PayloadQueue;
00091      PayloadQueue payloadQueue;
00092 
00093   protected:
00094      SCTPAssociation* assoc;    // SCTP connection object
00095 
00096   private:
00097      PayloadQueue::iterator GetChunkFastIterator;
00098 };
00099 
00100 #endif