Parent: [6ccca6] (diff)

Child: [569601] (diff)

Download this file

DTPState.h    193 lines (156 with data), 6.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//
// Copyright Š 2014 PRISTINE Consortium (http://ict-pristine.eu)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
/*
* @file DTPState.h
* @author Marcel Marek
* @date Apr 28, 2014
* @brief
* @detail
* EFCPSpec 8.5.2 DTP State - the DTSV
*/
#ifndef DTPSTATE_H_
#define DTPSTATE_H_
#include <omnetpp.h>
#include <cobject.h>
#include <queue>
#include <vector>
#include "EFCP_defs.h"
#include "DataTransferPDU.h"
#include "PDU.h"
typedef enum
{
//NULL = 0,
DTP_STATE_ACTIVE = 0x01,
DTP_STATE_PORT_ID_TRANS = 0x10, //Port-id transition
} DTPStateState;
/*
*
*/
class DTPState : public cSimpleModule {
private:
PDU* currentPDU;
/* These parameters can set smaller values of the DTAE constants
* for a given flow. These must have values less than or equal
* those defined for the DIF. */
unsigned int maxFlowSDUSize;
unsigned int maxFlowPDUSize;
unsigned int seqNumRollOverThresh;
int state;
bool dtcpPresent; /*!<a Boolean that indicates whether this connection is using DTCP. */
bool winBased; /*!< a Boolean that indicates whether window-based flow control is in use.*/
bool rateBased; /*!<a Boolean indicates whether rate-based flow control is in use.*/
bool rxPresent; /*!<a Boolean that indicates whether Retransmission Control (potentially with gaps) is in use*/
/* Move to DTCPState! */
PDUQ_t reassemblyPDUQ;
PDUQ_t generatedPDUs;
PDUQ_t postablePDUs;
const QoSCube* qoSCube;
bool partDeliv; /* Partial Delivery of SDUs is Allowed */
bool incompDeliv; /* Delivery of Incomplete SDUs is Allowed */
unsigned int rcvLeftWinEdge;
unsigned int maxSeqNumRcvd;
unsigned int nextSeqNumToSend;
unsigned int lastSDUDelivered;
//queue<PDU,seqNum> pduReassemblyQ
/* Not in specs */
unsigned int dropDup; //number of dropped duplicates (this variable is not mentioned in specs)
/* Not defined in specs, but referred to */
unsigned int lastSeqNumSent;
/* Moved from DTCP-SV */
bool setDRFFlag; // This Boolean indicates that the next PDU sent should have the DRF Flag set.
double rtt;
double mpl;
/* new */
bool ecnSet; //This variable gets set upon reception of DataTransfer PDU with ECN bit set and cleared upon reception of DataTransfer PDU with ECN bit cleared.
bool blockingPort;
void clearPDUQ(std::vector<DataTransferPDU*>* pduQ);
void clearGeneratedPDUQ();
void clearPostablePDUQ();
public:
DTPState();
virtual ~DTPState();
void initDefaults();
void incDropDup(){dropDup++;}
unsigned int getDropDup() const;
bool isFCPresent(){ return winBased || rateBased;}
bool isDtcpPresent() const;
void setDtcpPresent(bool dtcpPresent);
bool isIncompDeliv() const;
void setIncompDeliv(bool incompDeliv);
unsigned int getMaxFlowPduSize() const;
void setMaxFlowPduSize(unsigned int maxFlowPduSize);
unsigned int getMaxFlowSduSize() const;
void setMaxFlowSduSize(unsigned int maxFlowSduSize);
unsigned int getMaxSeqNumRcvd() const;
void setMaxSeqNumRcvd(unsigned int maxSeqNumRcvd);
void incMaxSeqNumRcvd();
void incRcvLeftWindowEdge();
unsigned int getNextSeqNumToSend();
unsigned int getNextSeqNumToSendWithoutIncrement();
void setNextSeqNumToSend(unsigned int nextSeqNumToSend);
void incNextSeqNumToSend();
bool isPartDeliv() const;
void setPartDeliv(bool partDeliv);
bool isRateBased() const;
void setRateBased(bool rateBased);
bool isRateFullfilled() const;
void setRateFullfilled(bool rateFullfilled);
unsigned int getRcvLeftWinEdge() const;
void setRcvLeftWinEdge(unsigned int rcvLeftWinEdge);
bool isRxPresent() const;
void setRxPresent(bool rxPresent);
unsigned int getSeqNumRollOverThresh() const;
void setSeqNumRollOverThresh(unsigned int seqNumRollOverThresh);
int getState() const;
void setState(int state);
bool isWinBased() const;
void setWinBased(bool winBased);
bool isSetDrfFlag() const;
void setSetDrfFlag(bool setDrfFlag);
double getRtt() const;
void setRtt(double rtt);
unsigned int getLastCtrlSeqNumRcv();
unsigned int getLastSeqNumSent() const;
void setLastSeqNumSent(unsigned int lastSeqNumSent);
bool isEcnSet() const;
void setEcnSet(bool ecnSet);
const PDU* getCurrentPdu() const;
void setCurrentPdu(PDU* currentPdu);
std::vector<DataTransferPDU*>* getReassemblyPDUQ();
void pushBackToReassemblyPDUQ(DataTransferPDU* pdu);
void addPDUToReassemblyQ(DataTransferPDU* pdu);
void clearReassemblyPDUQ();
PDUQ_t* getGeneratedPDUQ();
void pushBackToGeneratedPDUQ(DataTransferPDU* pdu);
PDUQ_t* getPostablePDUQ();
void pushBackToPostablePDUQ(DataTransferPDU* pdu);
const QoSCube* getQoSCube() const;
void setQoSCube(const QoSCube*& qoSCube);
unsigned int getLastSduDelivered() const;
void setLastSduDelivered(unsigned int lastSduDelivered);
void updateRcvLWE(unsigned int seqNum);
void updateSndLWE();
double getMPL() const;
void setMpl(double mpl);
bool isBlockingPort() const;
void setBlockingPort(bool blockingPort);
protected:
virtual void handleMessage(cMessage *msg);
virtual void initialize(int step);
int numInitStages() const { return 2;};
};
#endif /* DTPSTATE_H_ */