I need help for my simulation.
Provided first is the initial statement to create a network packet in my main.cc file.
Ptr<Name> nameWithSequence = Create<Name> (m_interestName); //create value /prefix
nameWithSequence->appendSeqNum (seq); //append sequence number to /prefix,eg - 0
Ptr<Interest> interest = Create<Interest> (); //create packet
interest->SetName (nameWithSequence); //create name of packet as /prefix0
I wanted to set the network packet to have two values which is consist of name /prefix0 and /prefix1 in one packet so ~ believe array suited well.
Here are the changes that I made
Ptr<Name> nameWithSequence = Create<Name> (m_interestName); //create value /prefix
nameWithSequence->appendSeqNum (seq); //append sequence number to /prefix,eg - 0
Ptr<Name> nameWithNextSequence = Create<Name> (m_interestName); //create value /prefix
nameWithNextSequence->appendSeqNum ((seq)+1)); //append next sequence number to /prefix,eg - 1
Ptr<Interest> interest = Create<Interest> (); //create packet
interest->SetName [0] (nameWithSequence); //create name of packet as /prefix0
interest->SetName [1] (nameWithNextSequence); //create name of packet as /prefix1
it refer to header file as follows:
/**
* \brief Set interest name
*
* @param name smart pointer to Name
*
**/
void
SetName (Ptr<Name> name);
/**
* \brief Another variant to set interest name
*
* @param name const reference to Name object
*
**/
void
SetName (const Name &name);
the code below is extracted from cc file
Interest::Interest (Ptr<Packet> payload/* = Create<Packet> ()*/)
: m_name ()
Interest::Interest (const Interest &interest)
: m_name (Create<Name> (interest.GetName ()))
void
Interest::SetName (Ptr<Name> name)
{
m_name = name;
m_wire = 0;
}
void
Interest::SetName (const Name &name)
{
m_name = Create<Name> (name);
m_wire = 0;
}
I believe I should declare the array first but I have no idea where should I put the declaration, is it in cc or header or both and how? I think the array name is SetName [2].
Please advise on how to do that.