--- a/src/Common/QoSCube.h
+++ b/src/Common/QoSCube.h
@@ -1,19 +1,24 @@
+// The MIT License (MIT)
//
-// 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/.
-//
+// Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
/*
* @file QoSCube.h
@@ -31,11 +36,17 @@
//RINASim libraries
#include "Policy.h"
#include "ExternConsts.h"
-
-extern const char* STR_DONOTCARE;
-extern const char* STR_YES;
-extern const char* STR_NO;
-extern const int VAL_DEFQOS;
+#include "EFCPPolicySet.h"
+
+extern const char* STR_DONOTCARE;
+extern const char* STR_YES;
+extern const char* STR_NO;
+extern const int VAL_DEFAULT_QOS;
+extern const std::string VAL_UNDEF_QOSID;
+extern const std::string VAL_MGMTQOSID;
+
+extern const char* ELEM_ATIME;
+extern const char* ELEM_EFCPPOL;
/**
* @brief Class representing QoSCube with all its properties that is primarily used by FA, RMT and RA
@@ -49,7 +60,7 @@
/**
* @brief Attribute holding QoSCube identifier. Beaware, value 0 is reserved for Flow QoS demands!
*/
- unsigned short qoSId;
+ std::string qoSId;
/**
* @brief Attribute holding average bandwidth
@@ -142,31 +153,61 @@
double aTime; //A-Timer in ms
/**
+ * @brief Attribute holding whether Retransmission Control is active
+ */
+ bool rxOn; //Is retransmission active
+
+ /**
+ * @brief Attribute holding whether Window-based Flow Control is active
+ */
+ bool windowFCOn; //Is Window-based Flow Control active
+
+ /**
+ * @brief Attribute holding whether Rate-based Flow Control is active
+ */
+ bool rateFCOn; //Is Rate-based Flow Control active
+
+ /**
* @brief Vector of bound default policies
*/
- std::vector<Policy*> policyList;
+ EFCPPolicySet* efcpPolicies;
+
public:
/**
* @brief Constructor of QoSCube with undefined values
*/
QoSCube();
+ QoSCube(cXMLElementList& attrs);
+
+ QoSCube(std::string tqosid,
+ int tavgBand, int tavgSDUBand, int tpeakBandDuration, int tpeakSDUBandDuration, int tburstPeriod, int tburstDuration,
+ double tundetectedBitErr, double tpduDropProbab,
+ int tmaxSDUsize, bool tpartDeliv, bool tincompleteDeliv, bool tforceOrder,
+ unsigned int tmaxAllowGap, int tdelay, int tjitter, int tcosttime, int tcostbits,
+ double tatime, bool trxon, bool twinfcon, bool tratefcon
+ );
+
/**
* @brief Destructor assigning default uninitialized values
*/
virtual ~QoSCube();
+
+ static const QoSCube MANAGEMENT;
+
+ bool isDefined();
/**
* @brief Gets QoSCube identifier
* @return QoSCube identifier as unsigned number, where value 0 is reserved for AE's Flow QoS parameters
*/
- unsigned short getQosId() const;
+ std::string getQosId() const;
/**
* @brief Sets QoSCube identifier
* @param qoSId A new QoSCube identifier
*/
- void setQosId(unsigned short qoSId);
+ void setQosId(std::string qoSId);
/**
* @brief Gets Average Bandwidth parameter
@@ -383,6 +424,7 @@
* @param aTime A new value measured in ms
*/
void setATime(double aTime);
+
/**
* @brief Returns true if DTCP module is needed in order to support this QoScube
* @return
@@ -390,27 +432,19 @@
bool isDTCPNeeded() const;
/**
- * @brief Simple QoSCube comparator measuring feasibility score of this and other QoSCubes
- * If QoS parameter could be satisfied then increment +1 to score. If not then decrement -1.
- * If parameter has do-not-care value then add nothing to the score.
- * Function should be reimplemented to more sophisticated one in case of inheritance.
- * @param templ
- */
- virtual short countFeasibilityScore(const QoSCube other) const;
-
- /**
- * @brief Simple QoSCube comparator measuring if this is a feasibility QoSCube to other QoSCubes
- * If any QoS parameter could not be satisfied then return false. If not return true.
- * Function should be reimplemented to more sophisticated one in case of inheritance.
- * @param templ
- */
- virtual bool isFeasibility(const QoSCube other) const;
-
- /**
* @brief Prints QoSCube information as string
* @return String of QoSCube textual representation
*/
std::string info() const;
+
+ const EFCPPolicySet* getEfcpPolicies() const;
+ void setEfcpPolicies(EFCPPolicySet* efcpPolicies);
+ bool isRateFcOn() const;
+ bool isRxOn() const;
+ bool isWindowFcOn() const;
+ void setRateFcOn(bool rateFcOn);
+ void setRxOn(bool rxOn);
+ void setWindowFcOn(bool windowFcOn);
};
//Free function