fork download
  1. #include <vector>
  2. #include <map>
  3. #include <stdint.h>
  4. #include <queue>
  5. #include <list>
  6. #include <set>
  7.  
  8. #ifndef MP_TCP_TYPEDEFS_H
  9. #define MP_TCP_TYPEDEFS_H
  10.  
  11. using namespace std;
  12.  
  13. namespace ns3 {
  14.  
  15. typedef enum {
  16. MP_NONE, // 0
  17. MP_MPC, // 1
  18. MP_ADDR, // 2
  19. MP_JOIN} MpStates_t;
  20. // Multipath actions
  21.  
  22. // congestion control algorithm
  23. typedef enum {
  24. Uncoupled_TCPs, // 0
  25. Linked_Increases, // 1
  26. RTT_Compensator, // 2
  27. Fully_Coupled // 3
  28. } CongestionCtrl_t;
  29.  
  30. // connection phase
  31. typedef enum {
  32. Slow_Start, // 0
  33. Congestion_Avoidance, // 1
  34. DSACK_SS, // 2 DSACK Slow Start: a temporary slow start triggered after detecting spurious retransmission based on DSACK information
  35. RTO_Recovery // 3 Reconvery algorithm after RTO expiration
  36. } Phase_t;
  37.  
  38. typedef enum {
  39. Round_Robin // 0
  40. //Collision_Avoidance // 1
  41. } DataDistribAlgo_t;
  42.  
  43. typedef enum {
  44. NoPR_Algo, // 0
  45. Eifel, // 1
  46. TCP_DOOR, // 2 Detection of Out-of-Order and Response
  47. D_SACK, // 3 Duplicate SACK (Selective ACKnowledgement)
  48. F_RTO // 4 Forward RTO-Recovery: Algorithm for detecting spurious retransmission timeouts
  49. } PacketReorder_t;
  50.  
  51. typedef enum {
  52. Step_1, // 0
  53. Step_2, // 1
  54. Step_3, // 2
  55. Step_4 // 3 In this step of F-RTO do a standard Fast Recovery algorithm
  56. } FRtoStep_t;
  57.  
  58. class DSNMapping
  59. {
  60. public:
  61. DSNMapping ();
  62.  
  63. //DSNMapping (const DSNMapping &res);
  64. virtual ~DSNMapping();
  65. uint64_t dataSeqNumber;
  66. uint16_t dataLevelLength;
  67. uint32_t subflowSeqNumber;
  68. uint32_t acknowledgement;
  69. uint32_t dupAckCount;
  70. uint8_t subflowIndex;
  71. uint8_t *packet;
  72.  
  73. bool operator < (const DSNMapping& rhs) const;
  74.  
  75. // variables for reordering simulation
  76. // Eifel Algorithm
  77. bool retransmited;
  78. uint64_t tsval; // TimesTamp value
  79.  
  80. /*
  81. private:/
  82.   bool original;
  83.   */
  84. };
  85.  
  86. typedef enum {
  87. NO_ACTION, // 0
  88. ADDR_TX,
  89. INIT_SUBFLOWS} MpActions_t;
  90.  
  91. class MpTcpStateMachine
  92. {
  93. public:
  94.  
  95. MpTcpStateMachine();
  96. virtual ~MpTcpStateMachine();
  97.  
  98.  
  99.  
  100.  
  101.  
  102. };
  103.  
  104. class MpTcpSubFlow
  105. {
  106. public:
  107.  
  108.  
  109. MpTcpSubFlow ();
  110. ~MpTcpSubFlow ();
  111. MpTcpSubFlow (uint32_t TxSeqNb);
  112.  
  113. void StartTracing (string traced);
  114. void CwndTracer (double oldval, double newval);
  115.  
  116.  
  117.  
  118. DSNMapping * GetunAckPkt (uint32_t awnd);
  119.  
  120. uint16_t routeId;
  121. bool connected;
  122.  
  123. Phase_t phase;
  124.  
  125. uint16_t sPort;
  126.  
  127. uint16_t dPort;
  128. uint32_t oif;
  129.  
  130.  
  131. uint32_t MSS; // Maximum Segment Size
  132. //double cwnd;
  133.  
  134. double scwnd; // smoothed congestion window
  135. uint32_t ssthresh;
  136. uint32_t maxSeqNb; // it represent the highest sequence number of a sent byte. In general it's egual to ( TxSeqNumber - 1 ) until a retransmission happen
  137. uint32_t highestAck; // hightest received ACK for the subflow level sequence number
  138. uint64_t bandwidth;
  139.  
  140. list<DSNMapping*> mapDSN;
  141. multiset<double> measuredRTT;
  142. //list<double> measuredRTT;
  143.  
  144.  
  145. uint32_t TxSeqNumber;
  146. uint32_t RxSeqNumber;
  147.  
  148. // for losses simulation
  149. double LostThreshold;
  150. bool CanDrop;
  151. uint64_t PktCount;
  152. uint64_t MaxPktCount;
  153. uint32_t DropedPktCount;
  154. uint32_t MaxDropedPktCount;
  155.  
  156. // Reordering simulation
  157. double savedCWND;
  158. uint32_t savedSSThresh;
  159. bool SpuriousRecovery;
  160. uint32_t recover;
  161. uint8_t ackCount; // count of received acknowledgement after an RTO expiration
  162. uint32_t ReTxSeqNumber; // higher sequence number of the retransmitted segment
  163. int nbRecvAck;
  164. };
  165.  
  166. class MpTcpAddressInfo
  167. {
  168. public:
  169. MpTcpAddressInfo();
  170. ~MpTcpAddressInfo();
  171.  
  172. uint8_t addrID;
  173.  
  174.  
  175. };
  176.  
  177. class DataBuffer
  178. {
  179. public:
  180. DataBuffer();
  181. DataBuffer(uint32_t size);
  182. ~DataBuffer();
  183.  
  184. queue<uint8_t> buffer;
  185. uint32_t bufMaxSize;
  186.  
  187. uint32_t Add(uint8_t* buf, uint32_t size);
  188. uint32_t Retrieve(uint8_t* buf, uint32_t size);
  189.  
  190.  
  191. bool Empty();
  192. bool Full ();
  193. uint32_t PendingData();
  194. uint32_t FreeSpaceSize();
  195. };
  196.  
  197.  
  198. }//namespace ns3
  199. #endif //MP_TCP_TYPEDEFS_H
  200.  
  201. /// Added just so that the linker does not complain about lack of missing main
  202. int main(int argc, char* argv[] )
  203. {
  204. return 0;
  205. }
Success #stdin #stdout 0s 3408KB
stdin
Standard input is empty
stdout
Standard output is empty