src/routing/aodv/aodv-packet.h
changeset 5597 8e4c7f2aaead
parent 5591 e0448da5da14
child 5599 5069c4c46ddb
equal deleted inserted replaced
5596:49fbeaaa0006 5597:8e4c7f2aaead
    62   void Serialize (Buffer::Iterator start) const;
    62   void Serialize (Buffer::Iterator start) const;
    63   uint32_t Deserialize (Buffer::Iterator start);
    63   uint32_t Deserialize (Buffer::Iterator start);
    64   void Print (std::ostream &os) const;
    64   void Print (std::ostream &os) const;
    65   //\}
    65   //\}
    66 
    66 
    67   uint8_t Get() const { return type; }
    67   uint8_t Get() const { return m_type; }
    68   bool IsValid() const { return valid; }
    68   bool IsValid() const { return m_valid; }
    69   bool operator==(TypeHeader const & o) const;
    69   bool operator==(TypeHeader const & o) const;
    70 private:
    70 private:
    71   uint8_t type;
    71   uint8_t m_type;
    72   bool valid;
    72   bool m_valid;
    73 };
    73 };
    74 
    74 
    75 std::ostream & operator<<(std::ostream & os, TypeHeader const & h);
    75 std::ostream & operator<<(std::ostream & os, TypeHeader const & h);
    76 
    76 
    77 /**
    77 /**
   109   void Print (std::ostream &os) const;
   109   void Print (std::ostream &os) const;
   110   //\}
   110   //\}
   111 
   111 
   112   ///\name Fields
   112   ///\name Fields
   113   //\{
   113   //\{
   114   void SetHopCount (uint8_t count) { rq_hop_count = count; }
   114   void SetHopCount (uint8_t count) { m_hopCount = count; }
   115   uint8_t GetHopCount () const { return rq_hop_count; }
   115   uint8_t GetHopCount () const { return m_hopCount; }
   116   void SetId (uint32_t id) { rq_bcast_id = id; }
   116   void SetId (uint32_t id) { m_broadcastID = id; }
   117   uint8_t GetId () const { return rq_bcast_id; }  
   117   uint8_t GetId () const { return m_broadcastID; }
   118   void SetDst (Ipv4Address a) { rq_dst = a; }
   118   void SetDst (Ipv4Address a) { m_dst = a; }
   119   Ipv4Address GetDst () const { return rq_dst; }
   119   Ipv4Address GetDst () const { return m_dst; }
   120   void SetDstSeqno (uint32_t s) { rq_dst_seqno = s; }
   120   void SetDstSeqno (uint32_t s) { m_dstSeqNo = s; }
   121   uint32_t GetDstSeqno () const { return rq_dst_seqno; }
   121   uint32_t GetDstSeqno () const { return m_dstSeqNo; }
   122   void SetOrigin (Ipv4Address a) { rq_src = a; }
   122   void SetOrigin (Ipv4Address a) { m_src = a; }
   123   Ipv4Address GetOrigin () const { return rq_src; }
   123   Ipv4Address GetOrigin () const { return m_src; }
   124   void SetOriginSeqno (uint32_t s) { rq_src_seqno = s; }
   124   void SetOriginSeqno (uint32_t s) { m_srcSeqNo = s; }
   125   uint32_t GetOriginSeqno () const { return rq_src_seqno; }
   125   uint32_t GetOriginSeqno () const { return m_srcSeqNo; }
   126   //\}
   126   //\}
   127 
   127 
   128   ///\name Flags
   128   ///\name Flags
   129   //\{
   129   //\{
   130   void SetGratiousRrep (bool f);
   130   void SetGratiousRrep (bool f);
   135   bool GetUnknownSeqno () const;
   135   bool GetUnknownSeqno () const;
   136   //\}
   136   //\}
   137 
   137 
   138   bool operator==(RreqHeader const & o) const;
   138   bool operator==(RreqHeader const & o) const;
   139 private:
   139 private:
   140   uint8_t        rq_flags;       ///< |J|R|G|D|U| bit flags, see RFC
   140   uint8_t        m_flags;          ///< |J|R|G|D|U| bit flags, see RFC
   141   uint8_t        reserved;       ///< Not used
   141   uint8_t        m_reserved;       ///< Not used
   142   uint8_t        rq_hop_count;   ///< Hop Count
   142   uint8_t        m_hopCount;       ///< Hop Count
   143   uint32_t       rq_bcast_id;    ///< RREQ ID
   143   uint32_t       m_broadcastID;    ///< RREQ ID
   144   Ipv4Address    rq_dst;         ///< Destination IP Address
   144   Ipv4Address    m_dst;            ///< Destination IP Address
   145   uint32_t       rq_dst_seqno;   ///< Destination Sequence Number
   145   uint32_t       m_dstSeqNo;       ///< Destination Sequence Number
   146   Ipv4Address    rq_src;         ///< Source IP Address
   146   Ipv4Address    m_src;            ///< Source IP Address
   147   uint32_t       rq_src_seqno;   ///< Source Sequence Number
   147   uint32_t       m_srcSeqNo;       ///< Source Sequence Number
   148 };
   148 };
   149 
   149 
   150 std::ostream & operator<<(std::ostream & os, RreqHeader const &);
   150 std::ostream & operator<<(std::ostream & os, RreqHeader const &);
   151 
   151 
   152 /**
   152 /**
   181   void Print (std::ostream &os) const;
   181   void Print (std::ostream &os) const;
   182   //\}
   182   //\}
   183 
   183 
   184   ///\name Fields
   184   ///\name Fields
   185   //\{
   185   //\{
   186   void SetHopCount (uint8_t count) { rp_hop_count = count; }
   186   void SetHopCount (uint8_t count) { m_hopCount = count; }
   187   uint8_t GetHopCount () const { return rp_hop_count; }
   187   uint8_t GetHopCount () const { return m_hopCount; }
   188   void SetDst (Ipv4Address a) { rp_dst = a; }
   188   void SetDst (Ipv4Address a) { m_dst = a; }
   189   Ipv4Address GetDst () const { return rp_dst; }
   189   Ipv4Address GetDst () const { return m_dst; }
   190   void SetDstSeqno (uint32_t s) { rp_dst_seqno = s; }
   190   void SetDstSeqno (uint32_t s) { m_dstSeqNo = s; }
   191   uint32_t GetDstSeqno () const { return rp_dst_seqno; }
   191   uint32_t GetDstSeqno () const { return m_dstSeqNo; }
   192   void SetOrigin (Ipv4Address a) { rp_src = a; }
   192   void SetOrigin (Ipv4Address a) { m_src = a; }
   193   Ipv4Address GetOrigin () const { return rp_src; }
   193   Ipv4Address GetOrigin () const { return m_src; }
   194   void SetLifeTime (Time t);
   194   void SetLifeTime (Time t);
   195   Time GetLifeTime () const;
   195   Time GetLifeTime () const;
   196   //\}
   196   //\}
   197 
   197 
   198   ///\name Flags
   198   ///\name Flags
   206   /// Configure RREP to be a Hello message
   206   /// Configure RREP to be a Hello message
   207   void SetHello(Ipv4Address src, uint32_t srcSeqNo, Time lifetime);
   207   void SetHello(Ipv4Address src, uint32_t srcSeqNo, Time lifetime);
   208 
   208 
   209   bool operator==(RrepHeader const & o) const;
   209   bool operator==(RrepHeader const & o) const;
   210 private:
   210 private:
   211   uint8_t       rp_flags;	    ///< A - acknowledgment required flag
   211   uint8_t       m_flags;	        ///< A - acknowledgment required flag
   212   uint8_t       prefixSize;	    ///< Prefix Size
   212   uint8_t       m_prefixSize;	    ///< Prefix Size
   213   uint8_t	rp_hop_count;       ///< Hop Count
   213   uint8_t	    m_hopCount;         ///< Hop Count
   214   Ipv4Address   rp_dst;             ///< Destination IP Address
   214   Ipv4Address   m_dst;              ///< Destination IP Address
   215   uint32_t      rp_dst_seqno;       ///< Destination Sequence Number
   215   uint32_t      m_dstSeqNo;         ///< Destination Sequence Number
   216   Ipv4Address	rp_src;             ///< Source IP Address
   216   Ipv4Address	m_src;              ///< Source IP Address
   217   uint32_t      rp_lifetime;        ///< Lifetime
   217   uint32_t      m_lifeTime;         ///< Lifetime
   218 };
   218 };
   219 
   219 
   220 std::ostream & operator<<(std::ostream & os, RrepHeader const &);
   220 std::ostream & operator<<(std::ostream & os, RrepHeader const &);
   221 
   221 
   222 /**
   222 /**
   244   void Print (std::ostream &os) const;
   244   void Print (std::ostream &os) const;
   245   //\}
   245   //\}
   246 
   246 
   247   bool operator==(RrepAckHeader const & o) const;
   247   bool operator==(RrepAckHeader const & o) const;
   248 private:
   248 private:
   249   uint8_t       reserved;
   249   uint8_t       m_reserved;
   250 };
   250 };
   251 std::ostream & operator<<(std::ostream & os, RrepAckHeader const &);
   251 std::ostream & operator<<(std::ostream & os, RrepAckHeader const &);
   252 
   252 
   253 
   253 
   254 /**
   254 /**
   289   void SetNoDelete(bool f);
   289   void SetNoDelete(bool f);
   290   bool GetNoDelete() const;
   290   bool GetNoDelete() const;
   291   //\}
   291   //\}
   292 
   292 
   293   bool AddUnDestination(Ipv4Address dst, uint32_t seqNo);
   293   bool AddUnDestination(Ipv4Address dst, uint32_t seqNo);
   294   uint8_t GetDestCount() const { return (uint8_t)unreachable_dst.size(); }
   294   uint8_t GetDestCount() const { return (uint8_t)m_unreacheableDstSeqNo.size(); }
   295   bool operator==(RerrHeader const & o) const;
   295   bool operator==(RerrHeader const & o) const;
   296 private:
   296 private:
   297   uint8_t er_flag;        ///< No delete flag
   297   uint8_t m_flag;            ///< No delete flag
   298   uint8_t reserved;       ///< Not used
   298   uint8_t m_reserved;        ///< Not used
   299 
   299 
   300   /// List of Unreachable destination IP addresses and sequence numbers
   300   /// List of Unreachable destination IP addresses and sequence numbers
   301   std::map<Ipv4Address, uint32_t> unreachable_dst;
   301   std::map<Ipv4Address, uint32_t> m_unreacheableDstSeqNo;
   302 };
   302 };
   303 
   303 
   304 std::ostream & operator<<(std::ostream & os, RerrHeader const &);
   304 std::ostream & operator<<(std::ostream & os, RerrHeader const &);
   305 }
   305 }
   306 }
   306 }