TCPMsgBasedRcvQueue_1.test 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. %description:
  2. Tests TCPMsgBasedSendQueue, TCPMsgBasedRcvQueue classes
  3. - segments with/without last byte of message
  4. - overlapped segments
  5. - segments out of order
  6. %includes:
  7. #include "TCPQueueTesterFunctions.h"
  8. %global:
  9. using namespace ::inet::tcp;
  10. %activity:
  11. TCPMsgBasedSendQueue sendQueue;
  12. TCPMsgBasedSendQueue *sq = &sendQueue;
  13. sq->init(1000);
  14. EV << sq->info() <<"\n";
  15. TCPMsgBasedRcvQueue rcvQueue;
  16. TCPMsgBasedRcvQueue *rq = &rcvQueue;
  17. rq->init(1000);
  18. EV << rq->info() <<"\n";
  19. enqueue(sq, "msg1", 100); // 1000..1100
  20. enqueue(sq, "msg2", 400); // 1100..1500
  21. enqueue(sq, "msg3", 600); // 1500..2100
  22. enqueue(sq, "msg4", 50); // 2100..2150
  23. enqueue(sq, "msg5", 150); // 2150..2300
  24. insertSegment(rq, createSegmentWithBytes(sq, 1000, 1099));
  25. insertSegment(rq, createSegmentWithBytes(sq, 1000, 1100));
  26. insertSegment(rq, createSegmentWithBytes(sq, 1000, 2099));
  27. insertSegment(rq, createSegmentWithBytes(sq, 1000, 2100));
  28. insertSegment(rq, createSegmentWithBytes(sq, 2000, 2099));
  29. insertSegment(rq, createSegmentWithBytes(sq, 2000, 2100));
  30. extractBytesUpTo(rq, 2099);
  31. extractBytesUpTo(rq, 2099);
  32. extractBytesUpTo(rq, 2099);
  33. extractBytesUpTo(rq, 2099);
  34. extractBytesUpTo(rq, 2099);
  35. discardUpTo(sq, 2099);
  36. extractBytesUpTo(rq, 2100);
  37. extractBytesUpTo(rq, 2100);
  38. discardUpTo(sq, 2100);
  39. insertSegment(rq, createSegmentWithBytes(sq, 2200, 2300));
  40. insertSegment(rq, createSegmentWithBytes(sq, 2100, 2200));
  41. extractBytesUpTo(rq, 2200);
  42. extractBytesUpTo(rq, 2300);
  43. discardUpTo(sq, 2300);
  44. EV << ".\n";
  45. %subst: /[\{\}]/ /
  46. %contains: stdout
  47. [1000..1000), 0 packets
  48. rcv_nxt=1000 0 msgs
  49. SQ:enqueue("msg1", 100): --> [1000..1100), 1 packets
  50. SQ:enqueue("msg2", 400): --> [1000..1500), 2 packets
  51. SQ:enqueue("msg3", 600): --> [1000..2100), 3 packets
  52. SQ:enqueue("msg4", 50): --> [1000..2150), 4 packets
  53. SQ:enqueue("msg5", 150): --> [1000..2300), 5 packets
  54. SQ:createSegmentWithBytes(1000, 1099):
  55. RQ:insertSeg [1000..1099) --> rcv_nxt=1099 [1000..1099) 0 msgs
  56. SQ:createSegmentWithBytes(1000, 1100): msg1[1000..1100)
  57. RQ:insertSeg [1000..1100) --> rcv_nxt=1100 [1000..1100) 1 msgs
  58. SQ:createSegmentWithBytes(1000, 2099): msg1[1000..1100), msg2[1100..1500)
  59. RQ:insertSeg [1000..2099) --> rcv_nxt=2099 [1000..2099) 2 msgs
  60. SQ:createSegmentWithBytes(1000, 2100): msg1[1000..1100), msg2[1100..1500), msg3[1500..2100)
  61. RQ:insertSeg [1000..2100) --> rcv_nxt=2100 [1000..2100) 3 msgs
  62. SQ:createSegmentWithBytes(2000, 2099):
  63. RQ:insertSeg [2000..2099) --> rcv_nxt=2100 [1000..2100) 3 msgs
  64. SQ:createSegmentWithBytes(2000, 2100): msg3[1500..2100)
  65. RQ:insertSeg [2000..2100) --> rcv_nxt=2100 [1000..2100) 3 msgs
  66. RQ:extractUpTo(2099): < < msg1: 100 bytes > < msg2: 400 bytes > > --> rcv_nxt=2100 [2099..2100) 1 msgs
  67. RQ:extractUpTo(2099): < > --> rcv_nxt=2100 [2099..2100) 1 msgs
  68. RQ:extractUpTo(2099): < > --> rcv_nxt=2100 [2099..2100) 1 msgs
  69. RQ:extractUpTo(2099): < > --> rcv_nxt=2100 [2099..2100) 1 msgs
  70. RQ:extractUpTo(2099): < > --> rcv_nxt=2100 [2099..2100) 1 msgs
  71. SQ:discardUpTo(2099): [2099..2300), 3 packets
  72. RQ:extractUpTo(2100): < < msg3: 600 bytes > > --> rcv_nxt=2100 0 msgs
  73. RQ:extractUpTo(2100): < > --> rcv_nxt=2100 0 msgs
  74. SQ:discardUpTo(2100): [2100..2300), 2 packets
  75. SQ:createSegmentWithBytes(2200, 2300): msg5[2150..2300)
  76. RQ:insertSeg [2200..2300) --> rcv_nxt=2100 [2200..2300) 1 msgs
  77. SQ:createSegmentWithBytes(2100, 2200): msg4[2100..2150)
  78. RQ:insertSeg [2100..2200) --> rcv_nxt=2300 [2100..2300) 2 msgs
  79. RQ:extractUpTo(2200): < < msg4: 50 bytes > > --> rcv_nxt=2300 [2200..2300) 1 msgs
  80. RQ:extractUpTo(2300): < < msg5: 150 bytes > > --> rcv_nxt=2300 0 msgs
  81. SQ:discardUpTo(2300): [2300..2300), 0 packets
  82. .