First of all, I am going to assume that your class name is not really "Header" since that's the type in ns-3, although the ns-3 type is ns3::Header. To clear confusion, you should probably chose a different name.
Also, try to follow the naming convention of the way ns-3 does the C++ names. An identifier starting with
m_ is a class's instance variable, so try not to name local variables like that.
So, you have a header of variable length, and when we have headers like that, the header itself should include a length/size before that data of variable length, and from there we know how many bytes to read afterwards. So, when you "serialize" the header, you should format it with a length field coming before the the vector items. This is very common practice with headers of potentially variable length such as the IPv4 which starts with protocol version followed by the header's length (most of the time, the IPv4 header length is 20 Bytes, but it can be longer if it has options).
Your loop control variable is m_bufferSize, but I am not sure if that's set anywhere since your start.GetSize() is stored in buffersize and NOT m_bufferSize.
The way I would do this is as follows, I am not sure if it's perfect, but it should look something like this:
uint32_t
MyHeader::Deserialize (Buffer::Iterator start)
{
m_vectorList.clear (); // I am assuming we will have a 'Get' function to acquire this
uint32_t header_length = start.ReadU16 (); //assuming header length is a 2-bytes, which limits the size of the vector to 65KB
for (uint32_t i=0; i<header_length; i++)
{
m_vectorList.push_back ( start.ReadU8() );
}
return GetSerializedSize();
}
uint32_t
MyHeader::GetSerializedSize ()
{
return 2 + m_vectorList.size(); // 2 for the header length (2-bytes) and then whatever number of bytes in the vector.
}
Cheers!
Adil