RREP_ACK header

This commit is contained in:
Borovkova Elena
2009-07-06 22:57:10 +04:00
parent 7bee848ad0
commit 736fbc07e6
2 changed files with 87 additions and 0 deletions

View File

@@ -322,5 +322,62 @@ bool RrepHeaderTest::RunTests ()
}
#endif
//-----------------------------------------------------------------------------
// RREP-ACK
//-----------------------------------------------------------------------------
RrepAckHader::RrepAckHader () : reserved(0)
{
}
TypeId
RrepAckHader::GetInstanceTypeId() const
{
return TypeId();
}
uint32_t
RrepAckHader::GetSerializedSize () const
{
return 2;
}
void
RrepAckHader::Serialize (Buffer::Iterator i) const
{
i.WriteU8(type());
i.WriteU8(reserved);
}
uint32_t
RrepAckHader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
uint8_t t = i.ReadU8 ();
NS_ASSERT (t == type());
reserved = i.ReadU8 ();
uint32_t dist = i.GetDistanceFrom (start);
NS_ASSERT (dist == GetSerializedSize ());
return dist;
}
void
RrepAckHader::Print (std::ostream &os) const
{
// TODO
}
bool
RrepAckHader::operator==(RrepAckHader const & o) const
{
return reserved == o.reserved;
}
std::ostream & operator<<(std::ostream & os, RrepAckHader const & h)
{
h.Print(os);
return os;
}
}}

View File

@@ -188,6 +188,36 @@ private:
std::ostream & operator<<(std::ostream & os, RrepHeader const &);
/**
* \ingroup aodv
* \brief Route Reply Acknowledgment (RREP-ACK) Message Format
* 0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
class RrepAckHader : public Header
{
public:
RrepAckHader ();
///\name Header serialization/deserialization
//\{
TypeId GetInstanceTypeId() const;
uint32_t GetSerializedSize () const;
void Serialize (Buffer::Iterator start) const;
uint32_t Deserialize (Buffer::Iterator start);
void Print (std::ostream &os) const;
//\}
bool operator==(RrepAckHader const & o) const;
private:
static MessageType type() { return AODVTYPE_RREP_ACK; }
uint8_t reserved;
};
std::ostream & operator<<(std::ostream & os, RrepAckHader const &);
}
}