A Discrete-Event Network Simulator
API
dsdv-packet.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2010 Hemanth Narra
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Hemanth Narra <hemanth@ittc.ku.com>
19 *
20 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
21 * ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
22 * Information and Telecommunication Technology Center (ITTC)
23 * and Department of Electrical Engineering and Computer Science
24 * The University of Kansas Lawrence, KS USA.
25 *
26 * Work supported in part by NSF FIND (Future Internet Design) Program
27 * under grant CNS-0626918 (Postmodern Internet Architecture),
28 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
29 * US Department of Defense (DoD), and ITTC at The University of Kansas.
30 */
31
32#ifndef DSDV_PACKET_H
33#define DSDV_PACKET_H
34
35#include <iostream>
36#include "ns3/header.h"
37#include "ns3/ipv4-address.h"
38#include "ns3/nstime.h"
39
40namespace ns3 {
41namespace dsdv {
58class DsdvHeader : public Header
59{
60public:
68 DsdvHeader (Ipv4Address dst = Ipv4Address (), uint32_t hopcount = 0, uint32_t dstSeqNo = 0);
69 virtual ~DsdvHeader ();
74 static TypeId GetTypeId (void);
75 virtual TypeId GetInstanceTypeId (void) const;
76 virtual uint32_t GetSerializedSize () const;
77 virtual void Serialize (Buffer::Iterator start) const;
79 virtual void Print (std::ostream &os) const;
80
85 void
86 SetDst (Ipv4Address destination)
87 {
88 m_dst = destination;
89 }
95 GetDst () const
96 {
97 return m_dst;
98 }
103 void
105 {
106 m_hopCount = hopCount;
107 }
113 GetHopCount () const
114 {
115 return m_hopCount;
116 }
121 void
122 SetDstSeqno (uint32_t sequenceNumber)
123 {
124 m_dstSeqNo = sequenceNumber;
125 }
131 GetDstSeqno () const
132 {
133 return m_dstSeqNo;
134 }
135private:
139};
140static inline std::ostream & operator<< (std::ostream& os, const DsdvHeader & packet)
141{
142 packet.Print (os);
143 return os;
144}
145}
146}
147
148#endif /* DSDV_PACKET_H */
iterator in a Buffer instance
Definition: buffer.h:99
Protocol header serialization and deserialization.
Definition: header.h:43
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
a unique identifier for an interface.
Definition: type-id.h:59
DSDV Update Packet Format.
Definition: dsdv-packet.h:59
uint32_t m_hopCount
Number of Hops.
Definition: dsdv-packet.h:137
virtual uint32_t GetSerializedSize() const
Definition: dsdv-packet.cc:68
DsdvHeader(Ipv4Address dst=Ipv4Address(), uint32_t hopcount=0, uint32_t dstSeqNo=0)
Constructor.
Definition: dsdv-packet.cc:40
Ipv4Address GetDst() const
Get destination address.
Definition: dsdv-packet.h:95
static TypeId GetTypeId(void)
Get the type ID.
Definition: dsdv-packet.cc:52
void SetDstSeqno(uint32_t sequenceNumber)
Set destination sequence number.
Definition: dsdv-packet.h:122
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: dsdv-packet.cc:62
uint32_t GetHopCount() const
Get hop count.
Definition: dsdv-packet.h:113
Ipv4Address m_dst
Destination IP Address.
Definition: dsdv-packet.h:136
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: dsdv-packet.cc:83
uint32_t GetDstSeqno() const
Get destination sequence number.
Definition: dsdv-packet.h:131
void SetDst(Ipv4Address destination)
Set destination address.
Definition: dsdv-packet.h:86
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition: dsdv-packet.h:138
virtual void Print(std::ostream &os) const
Definition: dsdv-packet.cc:97
virtual void Serialize(Buffer::Iterator start) const
Definition: dsdv-packet.cc:74
void SetHopCount(uint32_t hopCount)
Set hop count.
Definition: dsdv-packet.h:104
static std::ostream & operator<<(std::ostream &os, const DsdvHeader &packet)
Definition: dsdv-packet.h:140
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1853