diff --git a/src/common/chunk.h b/src/common/chunk.h index d2c638938..9aa025f96 100644 --- a/src/common/chunk.h +++ b/src/common/chunk.h @@ -28,17 +28,6 @@ namespace ns3 { -/** - * \brief Protocol header and trailer serialization and deserialization. - * - * Every Protocol header or trailer which needs to be inserted and removed - * from a Packet instance must derive from this abstract base class - * and implement the private pure virtual methods listed below: - * - ns3::Chunk::SerializeTo - * - ns3::Chunk::DeserializeFrom - * - ns3::Chunk::GetSerializedSize - * - ns3::Chunk::PrintTo - */ class Chunk { public: Chunk (); @@ -49,31 +38,9 @@ public: void Serialize (Buffer::Iterator start) const; uint32_t Deserialize (Buffer::Iterator start); private: - /** - * \param os the std output stream in which this - * protocol header must print itself. - */ virtual void PrintTo (std::ostream &os) const = 0; - - /** - * \returns the size of the serialized Header. - */ virtual uint32_t GetSerializedSize (void) const = 0; - - /** - * \param i the buffer iterator in which the protocol header - * must serialize itself. If this is a trailer, the index - * identifies the end of the buffer. If this is a header, - * the index identifies the start of the buffer. - */ virtual void SerializeTo (Buffer::Iterator i) const = 0; - /** - * \param i the buffer iterator from which the protocol header must - * deserialize itself. If this is a trailer, the index - * identifies the end of the buffer. If this is a header, - * the index identifies the start of the buffer. - * \returns the number of bytes read from the buffer - */ virtual uint32_t DeserializeFrom (Buffer::Iterator i) = 0; }; diff --git a/src/common/header.h b/src/common/header.h index a1f7c14bb..f8d4f84e4 100644 --- a/src/common/header.h +++ b/src/common/header.h @@ -26,9 +26,45 @@ namespace ns3 { +/** + * \brief Protocol header serialization and deserialization. + * + * Every Protocol header which needs to be inserted or removed + * from a Packet instance must derive from this abstract base class + * and implement the private pure virtual methods listed below: + * - ns3::Header::SerializeTo + * - ns3::Header::DeserializeFrom + * - ns3::Header::GetSerializedSize + * - ns3::Header::PrintTo + */ class Header : public Chunk { public: virtual ~Header (); +private: + /** + * \param os the std output stream in which this + * protocol header must print itself. + */ + virtual void PrintTo (std::ostream &os) const = 0; + + /** + * \returns the size of the serialized Header. + */ + virtual uint32_t GetSerializedSize (void) const = 0; + + /** + * \param i the buffer iterator in which the protocol header + * must serialize itself. This iterator identifies + * the start of the buffer. + */ + virtual void SerializeTo (Buffer::Iterator i) const = 0; + /** + * \param i the buffer iterator from which the protocol header must + * deserialize itself. This iterator identifies + * the start of the buffer. + * \returns the number of bytes read from the buffer + */ + virtual uint32_t DeserializeFrom (Buffer::Iterator i) = 0; }; }; // namespace ns3 diff --git a/src/common/trailer.h b/src/common/trailer.h index ce363eebc..ee2c435bc 100644 --- a/src/common/trailer.h +++ b/src/common/trailer.h @@ -26,9 +26,45 @@ namespace ns3 { +/** + * \brief Protocol trailer serialization and deserialization. + * + * Every Protocol trailer which needs to be inserted or removed + * from a Packet instance must derive from this abstract base class + * and implement the private pure virtual methods listed below: + * - ns3::Trailer::SerializeTo + * - ns3::Trailer::DeserializeFrom + * - ns3::Trailer::GetSerializedSize + * - ns3::Trailer::PrintTo + */ class Trailer : public Chunk { public: virtual ~Trailer (); +private: + /** + * \param os the std output stream in which this + * protocol trailer must print itself. + */ + virtual void PrintTo (std::ostream &os) const = 0; + + /** + * \returns the size of the serialized Trailer. + */ + virtual uint32_t GetSerializedSize (void) const = 0; + + /** + * \param i the buffer iterator in which the protocol trailer + * must serialize itself. This iterator identifies + * the end of the buffer. + */ + virtual void SerializeTo (Buffer::Iterator i) const = 0; + /** + * \param i the buffer iterator from which the protocol trailer must + * deserialize itself. This iterator identifies + * the end of the buffer. + * \returns the number of bytes read from the buffer + */ + virtual uint32_t DeserializeFrom (Buffer::Iterator i) = 0; }; }; // namespace ns3