Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __INET_TCPSEGMENT_H
00020 #define __INET_TCPSEGMENT_H
00021
00022 #include <list>
00023 #include "INETDefs.h"
00024 #include "TCPSegment_m.h"
00025
00026
00029 inline bool seqLess(uint32 a, uint32 b) {return a!=b && b-a<(1UL<<31);}
00030 inline bool seqLE(uint32 a, uint32 b) {return b-a<(1UL<<31);}
00031 inline bool seqGreater(uint32 a, uint32 b) {return a!=b && a-b<(1UL<<31);}
00032 inline bool seqGE(uint32 a, uint32 b) {return a-b<(1UL<<31);}
00034
00035
00040 class INET_API TCPSegment : public TCPSegment_Base
00041 {
00042 protected:
00043 std::list<TCPPayloadMessage> payloadList;
00044
00045 public:
00046 TCPSegment(const char *name=NULL, int kind=0) : TCPSegment_Base(name,kind) {}
00047 TCPSegment(const TCPSegment& other) : TCPSegment_Base(other.getName()) {operator=(other);}
00048 virtual ~TCPSegment();
00049 TCPSegment& operator=(const TCPSegment& other);
00050 virtual TCPSegment *dup() const {return new TCPSegment(*this);}
00051 virtual void parsimPack(cCommBuffer *b);
00052 virtual void parsimUnpack(cCommBuffer *b);
00053
00055 virtual void setPayloadArraySize(unsigned int size);
00057 virtual void setPayload(unsigned int k, const TCPPayloadMessage& payload_var);
00058
00062 virtual unsigned int getPayloadArraySize() const;
00063
00067 virtual TCPPayloadMessage& getPayload(unsigned int k);
00068
00073 virtual void addPayloadMessage(cPacket *msg, uint32 endSequenceNo);
00074
00079 virtual cPacket *removeFirstPayloadMessage(uint32& outEndSequenceNo);
00080
00086 virtual void truncateSegment(uint32 firstSeqNo, uint32 endSeqNo);
00087 };
00088
00089 #endif
00090
00091