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 
104  virtual void Print (std::ostream &os) const;
105 
110  virtual uint32_t GetSerializedSize () const;
111 
116  virtual void Serialize (Buffer::Iterator start) const;
117 
123  virtual uint32_t Deserialize (Buffer::Iterator start);
124 
132  virtual Alignment GetAlignment () const;
133 
134 private:
138  uint8_t m_type;
139 
143  uint8_t m_length;
144 
149 };
150 
157 {
158 public:
163  static TypeId GetTypeId ();
164 
169  virtual TypeId GetInstanceTypeId () const;
170 
175 
179  virtual ~Ipv6OptionPad1Header ();
180 
186  virtual void Print (std::ostream &os) const;
187 
192  virtual uint32_t GetSerializedSize () const;
193 
198  virtual void Serialize (Buffer::Iterator start) const;
199 
205  virtual uint32_t Deserialize (Buffer::Iterator start);
206 };
207 
214 {
215 public:
220  static TypeId GetTypeId ();
221 
226  virtual TypeId GetInstanceTypeId () const;
227 
232  Ipv6OptionPadnHeader (uint32_t pad = 2);
233 
237  virtual ~Ipv6OptionPadnHeader ();
238 
244  virtual void Print (std::ostream &os) const;
245 
250  virtual uint32_t GetSerializedSize () const;
251 
256  virtual void Serialize (Buffer::Iterator start) const;
257 
263  virtual uint32_t Deserialize (Buffer::Iterator start);
264 };
265 
272 {
273 public:
278  static TypeId GetTypeId ();
279 
284  virtual TypeId GetInstanceTypeId () const;
285 
290 
294  virtual ~Ipv6OptionJumbogramHeader ();
295 
300  void SetDataLength (uint32_t dataLength);
301 
306  uint32_t GetDataLength () const;
307 
313  virtual void Print (std::ostream &os) const;
314 
319  virtual uint32_t GetSerializedSize () const;
320 
325  virtual void Serialize (Buffer::Iterator start) const;
326 
332  virtual uint32_t Deserialize (Buffer::Iterator start);
333 
338  virtual Alignment GetAlignment () const;
339 
340 private:
344  uint32_t m_dataLength;
345 };
346 
353 {
354 public:
359  static TypeId GetTypeId ();
360 
365  virtual TypeId GetInstanceTypeId () const;
366 
371 
375  virtual ~Ipv6OptionRouterAlertHeader ();
376 
380  void SetValue (uint16_t value);
381 
386  uint16_t GetValue () const;
387 
393  virtual void Print (std::ostream &os) const;
394 
399  virtual uint32_t GetSerializedSize () const;
400 
405  virtual void Serialize (Buffer::Iterator start) const;
406 
412  virtual uint32_t Deserialize (Buffer::Iterator start);
413 
418  virtual Alignment GetAlignment () const;
419 
420 private:
424  uint16_t m_value;
425 };
426 
427 } // namespace ns3
428 
429 #endif /* IPV6_OPTION_HEADER_H */
430 
Protocol header serialization and deserialization.
Definition: header.h:42
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
void SetType(uint8_t type)
Set the type of the option.
Header for IPv6 Option.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual ~Ipv6OptionPad1Header()
Destructor.
Ipv6OptionPadnHeader(uint32_t pad=2)
Constructor.
automatically resized byte buffer
Definition: buffer.h:92
def start()
Definition: core.py:1482
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
static TypeId GetTypeId()
Get the type identificator.
virtual void Print(std::ostream &os) const
Print some informations about the packet.
uint8_t m_type
The type of the option.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Header of IPv6 Option Pad1.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
uint8_t GetType() const
Get the type of the option.
static TypeId GetTypeId()
Get the type identificator.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
represents the alignment requirements of an option header
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
iterator in a Buffer instance
Definition: buffer.h:98
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual void Print(std::ostream &os) const
Print some informations about the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual ~Ipv6OptionHeader()
Destructor.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
static TypeId GetTypeId()
Get the type identificator.
virtual void Print(std::ostream &os) const
Print some informations about the packet.
virtual ~Ipv6OptionJumbogramHeader()
Destructor.
Buffer m_data
The anonymous data of this option.
Header of IPv6 Option Jumbogram.
virtual ~Ipv6OptionRouterAlertHeader()
Destructor.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
void SetDataLength(uint32_t dataLength)
Set the data length.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual ~Ipv6OptionPadnHeader()
Destructor.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
void SetValue(uint16_t value)
Set the field "value".
uint32_t GetDataLength() const
Get the data length.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
static TypeId GetTypeId()
Get the type identificator.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
uint8_t GetLength() const
Get the option length.
Header of IPv6 Option Router Alert.
uint16_t GetValue() const
Get the field "value".
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
uint8_t m_length
The option length.
static TypeId GetTypeId()
Get the type identificator.
a unique identifier for an interface.
Definition: type-id.h:58
void SetLength(uint8_t length)
Set the option length.
Header of IPv6 Option Padn.
virtual void Print(std::ostream &os) const
Print some informations about the packet.
virtual void Print(std::ostream &os) const
Print some informations about the packet.
uint32_t m_dataLength
The data length.
Ipv6OptionHeader()
Constructor.