I a newbie to c++ and Ns3 !

I want node 1 to send node 2 a packet where the data in that packet is of my choice . (

so i want to include in the packet , a message of 10 lines of string. I have this message saved in a file on my laptop.

So i did lots of research and Here are the things that I collected from this site :


The Packet in Ns3 contains a byte buffer.

The byte stores the serialized content of the chunks added to a packet.

The byte buffer is implemented as follows:

struct BufferData {
uint32_t m_count;
uint32_t m_size;
uint32_t m_initialStart;
uint32_t m_dirtyStart;
uint32_t m_dirtySize;
uint8_t m_data[1];
struct BufferData *m_data;
uint32_t m_zeroAreaSize;
uint32_t m_start;
uint32_t m_size;

BufferData::m_count: reference count for BufferData structure
BufferData::m_size: size of data buffer stored in BufferData structure
BufferData::m_initialStart: offset from start of data buffer where data was first inserted
BufferData::m_dirtyStart: offset from start of buffer where every Buffer which holds a reference to this BufferData instance have written data so far
BufferData::m_dirtySize: size of area where data has been written so far
BufferData::m_data: pointer to data buffer
Buffer::m_zeroAreaSize: size of zero area which extends before m_initialStart
Buffer::m_start: offset from start of buffer to area used by this buffer
Buffer::m_size: size of area used by this Buffer in its BufferData structure

ok , so from this point onward i have NO idea how to make the buffer hold the 10 lines of string that I have in my file.

Please help. I have been stuck for 3 days