A Discrete-Event Network Simulator
API
ipv6-option-header.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008-2009 Strasbourg University
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: David Gross <gdavid.devel@gmail.com>
19  */
20 
21 #ifndef IPV6_OPTION_HEADER_H
22 #define IPV6_OPTION_HEADER_H
23 
24 #include <ostream>
25 
26 #include "ns3/header.h"
27 
28 namespace ns3
29 {
30 
36 class Ipv6OptionHeader : public Header
37 {
38 public:
39 
47  struct Alignment
48  {
49  uint8_t factor;
50  uint8_t offset;
51  };
52 
57  static TypeId GetTypeId ();
58 
63  virtual TypeId GetInstanceTypeId () const;
64 
69 
73  virtual ~Ipv6OptionHeader ();
74 
79  void SetType (uint8_t type);
80 
85  uint8_t GetType () const;
86 
91  void SetLength (uint8_t length);
92 
97  uint8_t GetLength () const;
98 
103  virtual void Print (std::ostream &os) const;
104 
109  virtual uint32_t GetSerializedSize () const;
110 
115  virtual void Serialize (Buffer::Iterator start) const;
116 
122  virtual uint32_t Deserialize (Buffer::Iterator start);
123 
131  virtual Alignment GetAlignment () const;
132 
133 private:
137  uint8_t m_type;
138 
142  uint8_t m_length;
143 
148 };
149 
156 {
157 public:
162  static TypeId GetTypeId ();
163 
168  virtual TypeId GetInstanceTypeId () const;
169 
174 
178  virtual ~Ipv6OptionPad1Header ();
179 
184  virtual void Print (std::ostream &os) const;
185 
190  virtual uint32_t GetSerializedSize () const;
191 
196  virtual void Serialize (Buffer::Iterator start) const;
197 
203  virtual uint32_t Deserialize (Buffer::Iterator start);
204 };
205 
212 {
213 public:
218  static TypeId GetTypeId ();
219 
224  virtual TypeId GetInstanceTypeId () const;
225 
230  Ipv6OptionPadnHeader (uint32_t pad = 2);
231 
235  virtual ~Ipv6OptionPadnHeader ();
236 
241  virtual void Print (std::ostream &os) const;
242 
247  virtual uint32_t GetSerializedSize () const;
248 
253  virtual void Serialize (Buffer::Iterator start) const;
254 
260  virtual uint32_t Deserialize (Buffer::Iterator start);
261 };
262 
269 {
270 public:
275  static TypeId GetTypeId ();
276 
281  virtual TypeId GetInstanceTypeId () const;
282 
287 
291  virtual ~Ipv6OptionJumbogramHeader ();
292 
297  void SetDataLength (uint32_t dataLength);
298 
303  uint32_t GetDataLength () const;
304 
309  virtual void Print (std::ostream &os) const;
310 
315  virtual uint32_t GetSerializedSize () const;
316 
321  virtual void Serialize (Buffer::Iterator start) const;
322 
328  virtual uint32_t Deserialize (Buffer::Iterator start);
329 
334  virtual Alignment GetAlignment () const;
335 
336 private:
340  uint32_t m_dataLength;
341 };
342 
349 {
350 public:
355  static TypeId GetTypeId ();
356 
361  virtual TypeId GetInstanceTypeId () const;
362 
367 
371  virtual ~Ipv6OptionRouterAlertHeader ();
372 
377  void SetValue (uint16_t value);
378 
383  uint16_t GetValue () const;
384 
389  virtual void Print (std::ostream &os) const;
390 
395  virtual uint32_t GetSerializedSize () const;
396 
401  virtual void Serialize (Buffer::Iterator start) const;
402 
408  virtual uint32_t Deserialize (Buffer::Iterator start);
409 
414  virtual Alignment GetAlignment () const;
415 
416 private:
420  uint16_t m_value;
421 };
422 
423 } // namespace ns3
424 
425 #endif /* IPV6_OPTION_HEADER_H */
426 
iterator in a Buffer instance
Definition: buffer.h:99
automatically resized byte buffer
Definition: buffer.h:93
Protocol header serialization and deserialization.
Definition: header.h:43
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
Header for IPv6 Option.
Ipv6OptionHeader()
Constructor.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
uint8_t GetLength() const
Get the option length.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
uint8_t m_type
The type of the option.
void SetLength(uint8_t length)
Set the option length.
void SetType(uint8_t type)
Set the type of the option.
uint8_t GetType() const
Get the type of the option.
virtual ~Ipv6OptionHeader()
Destructor.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
uint8_t m_length
The option length.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual void Print(std::ostream &os) const
Print some information about the packet.
static TypeId GetTypeId()
Get the type identificator.
Buffer m_data
The anonymous data of this option.
Header of IPv6 Option Jumbogram.
static TypeId GetTypeId()
Get the type identificator.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
void SetDataLength(uint32_t dataLength)
Set the data length.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
uint32_t m_dataLength
The data length.
virtual ~Ipv6OptionJumbogramHeader()
Destructor.
uint32_t GetDataLength() const
Get the data length.
Header of IPv6 Option Pad1.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual ~Ipv6OptionPad1Header()
Destructor.
static TypeId GetTypeId()
Get the type identificator.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual void Print(std::ostream &os) const
Print some information about the packet.
Header of IPv6 Option Padn.
static TypeId GetTypeId()
Get the type identificator.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Ipv6OptionPadnHeader(uint32_t pad=2)
Constructor.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual ~Ipv6OptionPadnHeader()
Destructor.
Header of IPv6 Option Router Alert.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
void SetValue(uint16_t value)
Set the field "value".
virtual ~Ipv6OptionRouterAlertHeader()
Destructor.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
static TypeId GetTypeId()
Get the type identificator.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual void Print(std::ostream &os) const
Print some information about the packet.
uint16_t GetValue() const
Get the field "value".
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1853
represents the alignment requirements of an option header