There are many options to circunvent this issue and use packet
payloads. Some more elegant, some less elegant.

A more elegant is to use a new class inherited from AppData, ready to
manipulate a real payload, and more, ready to manipulate real objects,
or everything you want. (you must implement a virtual copy() and a
virtual destructor of this class to use inheritance. So, the packet
may be copied and destructed).

A less elegant is use a pointer in the packet's header (a new packet
type for your app). This pointer will be "your packet payload", so it
may carry what you want.

You may use a buffer of payloads as a onipresent entity (like in
BitTorrent.patch from Kolja Eger).

Many options, but you'll not carry a real packet payload (with
everything you want) in a standard NS-2.

Sidney Doria
UFCG / BRAZIL


2010/4/6 MiLo_TUD <mike.lor...@mailbox.tu-dresden.de>:
>
>
> Oh, sorry. You used PacketData.
> But how did you wrote your payload to your packet ?
>
> I see, there's a problem. setdata(..) want a pointer to the class AppData.
> And you don't have direct access to the unsigned char* data_ of PacketData.
> So you can't create a new object with data inside. It is only possible to
> create an empty packet or copy an existing packet of type PacketData.
> So you have to derive a class from class PacketData or change the the class
> PacketData.
>
>
> --
> View this message in context: 
> http://old.nabble.com/Help%3A-accessing-contents-of-data-payload-in-NS2-tp28115846p28153305.html
> Sent from the ns-users mailing list archive at Nabble.com.
>
>



-- 
Sidney Doria
Redes ad hoc móveis
Doutorado em Computação
UFCG
Brasil

"Nessa jornada, o conhecimento será o seu escudo..."
(Mestre dos Magos no episódio do grimoire de ouro)

Reply via email to