OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011, 2012, 2013 Centre Tecnologic de Telecomunicacions de Cata
lunya (CTTC) | 3 * Copyright (c) 2011, 2012, 2013 Centre Tecnologic de Telecomunicacions de Cata
lunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 { | 45 { |
46 public: | 46 public: |
47 /** | 47 /** |
48 * Function to convert packet contents in hex format | 48 * Function to convert packet contents in hex format |
49 * \param pkt the packet | 49 * \param pkt the packet |
50 * \returns a text string | 50 * \returns a text string |
51 */ | 51 */ |
52 static std::string sprintPacketContentsHex (Ptr<Packet> pkt) | 52 static std::string sprintPacketContentsHex (Ptr<Packet> pkt) |
53 { | 53 { |
54 uint32_t psize = pkt->GetSize (); | 54 uint32_t psize = pkt->GetSize (); |
55 uint8_t buffer[psize]; | 55 uint8_t* buffer = new uint8_t[psize]; |
56 std::ostringstream oss (std::ostringstream::out); | 56 std::ostringstream oss (std::ostringstream::out); |
57 pkt->CopyData (buffer, psize); | 57 pkt->CopyData (buffer, psize); |
58 for (uint32_t i = 0; i < psize; i++) | 58 for (uint32_t i = 0; i < psize; i++) |
59 { | 59 { |
60 oss << std::setfill ('0') << std::setw (2) << std::hex << (uint32_t) buf
fer[i]; | 60 oss << std::setfill ('0') << std::setw (2) << std::hex << (uint32_t) buf
fer[i]; |
61 } | 61 } |
62 return oss.str (); | 62 return oss.str (); |
63 } | 63 } |
64 | 64 |
65 /** | 65 /** |
66 * Function to convert packet contents in binary format | 66 * Function to convert packet contents in binary format |
67 * \param pkt the packet | 67 * \param pkt the packet |
68 * \returns a text string | 68 * \returns a text string |
69 */ | 69 */ |
70 static std::string sprintPacketContentsBin (Ptr<Packet> pkt) | 70 static std::string sprintPacketContentsBin (Ptr<Packet> pkt) |
71 { | 71 { |
72 uint32_t psize = pkt->GetSize (); | 72 uint32_t psize = pkt->GetSize (); |
73 uint8_t buffer[psize]; | 73 uint8_t* buffer = new uint8_t[psize]; |
74 std::ostringstream oss (std::ostringstream::out); | 74 std::ostringstream oss (std::ostringstream::out); |
75 pkt->CopyData (buffer, psize); | 75 pkt->CopyData (buffer, psize); |
76 for (uint32_t i = 0; i < psize; i++) | 76 for (uint32_t i = 0; i < psize; i++) |
77 { | 77 { |
78 oss << (std::bitset<8> (buffer[i])); | 78 oss << (std::bitset<8> (buffer[i])); |
79 } | 79 } |
80 return std::string (oss.str () + "\n"); | 80 return std::string (oss.str () + "\n"); |
81 } | 81 } |
82 | 82 |
83 /** | 83 /** |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 { | 252 { |
253 SequenceNumber10 ackSn (2); | 253 SequenceNumber10 ackSn (2); |
254 std::list<SequenceNumber10> nackSnList; | 254 std::list<SequenceNumber10> nackSnList; |
255 nackSnList.push_back (SequenceNumber10 (1021)); | 255 nackSnList.push_back (SequenceNumber10 (1021)); |
256 nackSnList.push_back (SequenceNumber10 (754)); | 256 nackSnList.push_back (SequenceNumber10 (754)); |
257 nackSnList.push_back (SequenceNumber10 (947)); | 257 nackSnList.push_back (SequenceNumber10 (947)); |
258 nackSnList.push_back (SequenceNumber10 (347)); | 258 nackSnList.push_back (SequenceNumber10 (347)); |
259 std::string hex ("000bfed795d9cad8"); | 259 std::string hex ("000bfed795d9cad8"); |
260 AddTestCase (new RlcAmStatusPduTestCase (ackSn, nackSnList, hex), TestCase::
QUICK); | 260 AddTestCase (new RlcAmStatusPduTestCase (ackSn, nackSnList, hex), TestCase::
QUICK); |
261 } | 261 } |
262 | |
263 } | 262 } |
264 | 263 |
265 | |
266 } // namespace ns3 | 264 } // namespace ns3 |
OLD | NEW |