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 
381  void SetValue (uint16_t value);
382 
387  uint16_t GetValue () const;
388 
394  virtual void Print (std::ostream &os) const;
395 
400  virtual uint32_t GetSerializedSize () const;
401 
406  virtual void Serialize (Buffer::Iterator start) const;
407 
413  virtual uint32_t Deserialize (Buffer::Iterator start);
414 
419  virtual Alignment GetAlignment () const;
420 
421 private:
425  uint16_t m_value;
426 };
427 
428 } // namespace ns3
429 
430 #endif /* IPV6_OPTION_HEADER_H */
431 
Protocol header serialization and deserialization.
Definition: header.h:42
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual void Print(std::ostream &os) const
Print some information about the packet.
uint16_t GetValue() const
Get the field "value".
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
void SetType(uint8_t type)
Set the type of the option.
Header for IPv6 Option.
virtual ~Ipv6OptionPad1Header()
Destructor.
Ipv6OptionPadnHeader(uint32_t pad=2)
Constructor.
automatically resized byte buffer
Definition: buffer.h:92
def start()
Definition: core.py:1844
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
static TypeId GetTypeId()
Get the type identificator.
uint8_t m_type
The type of the option.
Header of IPv6 Option Pad1.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
static TypeId GetTypeId()
Get the type identificator.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
represents the alignment requirements of an option header
virtual void Print(std::ostream &os) const
Print some information about the packet.
uint8_t GetLength() const
Get the option length.
iterator in a Buffer instance
Definition: buffer.h:98
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual ~Ipv6OptionHeader()
Destructor.
static TypeId GetTypeId()
Get the type identificator.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual ~Ipv6OptionJumbogramHeader()
Destructor.
Buffer m_data
The anonymous data of this option.
Header of IPv6 Option Jumbogram.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual ~Ipv6OptionRouterAlertHeader()
Destructor.
uint8_t GetType() const
Get the type of the option.
void SetDataLength(uint32_t dataLength)
Set the data length.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
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 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".
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
static TypeId GetTypeId()
Get the type identificator.
uint32_t GetDataLength() const
Get the data length.
Header of IPv6 Option Router Alert.
virtual void Print(std::ostream &os) const
Print some information about 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 Serialize(Buffer::Iterator start) const
Serialize the packet.
uint32_t m_dataLength
The data length.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Ipv6OptionHeader()
Constructor.