View | Details | Raw Unified | Return to bug 2505
Collapse All | Expand All

(-)a/src/mesh/model/dot11s/hwmp-protocol-mac.cc (-1 / +3 lines)
 Lines 108-114    Link Here 
108
      return true;
108
      return true;
109
    }
109
    }
110
  MeshInformationElementVector elements;
110
  MeshInformationElementVector elements;
111
  packet->RemoveHeader (elements);
111
  // To determine header size here, we can rely on the knowledge that
112
  // this is the last header to remove.
113
  packet->RemoveHeader (elements, packet->GetSize ());
112
  std::vector<HwmpProtocol::FailedDestination> failedDestinations;
114
  std::vector<HwmpProtocol::FailedDestination> failedDestinations;
113
  for (MeshInformationElementVector::Iterator i = elements.Begin (); i != elements.End (); i++)
115
  for (MeshInformationElementVector::Iterator i = elements.Begin (); i != elements.End (); i++)
114
    {
116
    {
(-)a/src/mesh/model/dot11s/peer-management-protocol-mac.cc (-3 / +6 lines)
 Lines 76-82    Link Here 
76
      MgtBeaconHeader beacon_hdr;
76
      MgtBeaconHeader beacon_hdr;
77
      packet->RemoveHeader (beacon_hdr);
77
      packet->RemoveHeader (beacon_hdr);
78
      MeshInformationElementVector elements;
78
      MeshInformationElementVector elements;
79
      packet->RemoveHeader (elements);
79
      // To determine header size here, we can rely on the knowledge that 
80
      // this is the last header to remove.
81
      packet->RemoveHeader (elements, packet->GetSize ());
80
      Ptr<IeBeaconTiming> beaconTiming = DynamicCast<IeBeaconTiming> (elements.FindFirst (IE_BEACON_TIMING));
82
      Ptr<IeBeaconTiming> beaconTiming = DynamicCast<IeBeaconTiming> (elements.FindFirst (IE_BEACON_TIMING));
81
      Ptr<IeMeshId> meshId = DynamicCast<IeMeshId> (elements.FindFirst (IE_MESH_ID));
83
      Ptr<IeMeshId> meshId = DynamicCast<IeMeshId> (elements.FindFirst (IE_MESH_ID));
82
84
 Lines 174-182    Link Here 
174
          NS_FATAL_ERROR ("Unknown Self-protected Action type: " << actionValue.selfProtectedAction);
176
          NS_FATAL_ERROR ("Unknown Self-protected Action type: " << actionValue.selfProtectedAction);
175
        }
177
        }
176
      Ptr<IePeerManagement> peerElement;
178
      Ptr<IePeerManagement> peerElement;
177
      //Peer Management element is the last element in this frame - so, we can use MeshInformationElementVector
178
      MeshInformationElementVector elements;
179
      MeshInformationElementVector elements;
179
      packet->RemoveHeader (elements);
180
      // To determine header size here, we can rely on the knowledge that 
181
      // this is the last header to remove.
182
      packet->RemoveHeader (elements, packet->GetSize ());
180
      peerElement = DynamicCast<IePeerManagement>(elements.FindFirst (IE_MESH_PEERING_MANAGEMENT));
183
      peerElement = DynamicCast<IePeerManagement>(elements.FindFirst (IE_MESH_PEERING_MANAGEMENT));
181
184
182
      NS_ASSERT (peerElement != 0);
185
      NS_ASSERT (peerElement != 0);
(-)a/src/mesh/test/mesh-information-element-vector-test-suite.cc (-1 / +2 lines)
 Lines 145-152    Link Here 
145
  }
145
  }
146
  Ptr<Packet> packet = Create<Packet> ();
146
  Ptr<Packet> packet = Create<Packet> ();
147
  packet->AddHeader (vector);
147
  packet->AddHeader (vector);
148
  uint32_t size = vector.GetSerializedSize ();
148
  MeshInformationElementVector resultVector;
149
  MeshInformationElementVector resultVector;
149
  packet->RemoveHeader (resultVector);
150
  packet->RemoveHeader (resultVector, size);
150
  NS_TEST_ASSERT_MSG_EQ (vector, resultVector, "Roundtrip serialization of all known information elements works");
151
  NS_TEST_ASSERT_MSG_EQ (vector, resultVector, "Roundtrip serialization of all known information elements works");
151
}
152
}
152
153
(-)a/src/wifi/model/wifi-information-element-vector.cc (-5 / +12 lines)
 Lines 72-86    Link Here 
72
uint32_t
72
uint32_t
73
WifiInformationElementVector::Deserialize (Buffer::Iterator start)
73
WifiInformationElementVector::Deserialize (Buffer::Iterator start)
74
{
74
{
75
  Buffer::Iterator i = start;
75
  NS_FATAL_ERROR ("This variant should not be called on a variable-sized header");
76
  uint32_t size = start.GetSize ();
76
  return 0;
77
}
78
79
uint32_t
80
WifiInformationElementVector::Deserialize (Buffer::Iterator start, Buffer::Iterator end)
81
{
82
  uint32_t size = start.GetDistanceFrom (end);
77
  while (size > 0)
83
  while (size > 0)
78
    {
84
    {
79
      uint32_t deserialized = DeserializeSingleIe (i);
85
      uint32_t deserialized = DeserializeSingleIe (start);
80
      i.Next (deserialized);
86
      start.Next (deserialized);
87
      NS_ASSERT (deserialized <= size);
81
      size -= deserialized;
88
      size -= deserialized;
82
    }
89
    }
83
  return i.GetDistanceFrom (start);
90
  return size;
84
}
91
}
85
92
86
uint32_t
93
uint32_t
(-)a/src/wifi/model/wifi-information-element-vector.h (-4 / +14 lines)
 Lines 51-63    Link Here 
51
  virtual uint32_t GetSerializedSize () const;
51
  virtual uint32_t GetSerializedSize () const;
52
  virtual void Serialize (Buffer::Iterator start) const;
52
  virtual void Serialize (Buffer::Iterator start) const;
53
  /**
53
  /**
54
   * \attention When you use RemoveHeader, WifiInformationElementVector supposes, that
54
   * \attention This variant should not be used but is implemented due to
55
   * all buffer consists of information elements
55
   * backward compatibility reasons
56
   *
56
   *
57
   * \param start the iterator
57
   * \param start buffer location to start deserializing from
58
   * \returns distance
58
   * \return number of bytes deserialized
59
   */
59
   */
60
  virtual uint32_t Deserialize (Buffer::Iterator start);
60
  virtual uint32_t Deserialize (Buffer::Iterator start);
61
  /**
62
   * Deserialize a number of WifiInformationElements 
63
   *
64
   * The size of this Header should equal start.GetDistanceFrom (end).
65
   *
66
   * \param start starting buffer location
67
   * \param end ending buffer location
68
   * \return number of bytes deserialized
69
   */
70
  virtual uint32_t Deserialize (Buffer::Iterator start, Buffer::Iterator end);
61
  virtual void Print (std::ostream &os) const;
71
  virtual void Print (std::ostream &os) const;
62
72
63
  /**
73
  /**

Return to bug 2505