1.1 --- a/src/common/packet.h Tue May 06 14:54:44 2008 -0700
1.2 +++ b/src/common/packet.h Tue May 06 14:54:52 2008 -0700
1.3 @@ -98,7 +98,7 @@
1.4 /**
1.5 * \brief network packets
1.6 *
1.7 - * Each network packet contains a byte buffer, a list of tags, and
1.8 + * Each network packet contains a byte buffer, a set of tags, and
1.9 * metadata.
1.10 *
1.11 * - The byte buffer stores the serialized content of the headers and trailers
1.12 @@ -107,13 +107,10 @@
1.13 * forces you to do this) which means that the content of a packet buffer
1.14 * is expected to be that of a real packet.
1.15 *
1.16 - * - The list of tags stores an arbitrarily large set of arbitrary
1.17 - * user-provided data structures in the packet: only one instance of
1.18 - * each type of data structure is allowed in a list of tags.
1.19 - * These tags typically contain per-packet cross-layer information or
1.20 - * flow identifiers. Each tag stored in the tag list can be at most
1.21 - * 16 bytes big. Trying to attach bigger data structures will trigger
1.22 - * crashes at runtime.
1.23 + * - Each tag tags a subset of the bytes in the packet byte buffer with the
1.24 + * information stored in the tag. A classic example of a tag is a FlowIdTag
1.25 + * which contains a flow id: the set of bytes tagged by this tag implicitely
1.26 + * belong to the attached flow id.
1.27 *
1.28 * - The metadata describes the type of the headers and trailers which
1.29 * were serialized in the byte buffer. The maintenance of metadata is
2.1 --- a/src/common/tag-buffer.h Tue May 06 14:54:44 2008 -0700
2.2 +++ b/src/common/tag-buffer.h Tue May 06 14:54:52 2008 -0700
2.3 @@ -5,6 +5,12 @@
2.4
2.5 namespace ns3 {
2.6
2.7 +/**
2.8 + * \brief read and write tag data
2.9 + *
2.10 + * This class allows subclasses of the ns3::Tag base class
2.11 + * to serialize and deserialize their data.
2.12 + */
2.13 class TagBuffer
2.14 {
2.15 public:
3.1 --- a/src/common/tag.h Tue May 06 14:54:44 2008 -0700
3.2 +++ b/src/common/tag.h Tue May 06 14:54:52 2008 -0700
3.3 @@ -7,13 +7,34 @@
3.4
3.5 namespace ns3 {
3.6
3.7 +/**
3.8 + * \brief tag a set of bytes in a packet
3.9 + *
3.10 + * New kinds of tags can be created by subclassing this base class.
3.11 + */
3.12 class Tag : public ObjectBase
3.13 {
3.14 public:
3.15 static TypeId GetTypeId (void);
3.16
3.17 + /**
3.18 + * \returns the number of bytes required to serialize the data of the tag.
3.19 + *
3.20 + * This method is typically invoked by Packet::AddTag just prior to calling
3.21 + * Tag::Serialize.
3.22 + */
3.23 virtual uint32_t GetSerializedSize (void) const = 0;
3.24 + /**
3.25 + * \param i the buffer to write data into.
3.26 + *
3.27 + * Write the content of the tag in the provided tag buffer.
3.28 + */
3.29 virtual void Serialize (TagBuffer i) const = 0;
3.30 + /**
3.31 + * \param i the buffer to read data from.
3.32 + *
3.33 + * Read the content of the tag from the provided tag buffer.
3.34 + */
3.35 virtual void Deserialize (TagBuffer i) = 0;
3.36 };
3.37