A Discrete-Event Network Simulator
API
ipv6-option-header.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2009 Strasbourg University
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: David Gross <gdavid.devel@gmail.com>
18  */
19 
20 #ifndef IPV6_OPTION_HEADER_H
21 #define IPV6_OPTION_HEADER_H
22 
23 #include "ns3/header.h"
24 
25 #include <ostream>
26 
27 namespace ns3
28 {
29 
35 class Ipv6OptionHeader : public Header
36 {
37  public:
45  struct Alignment
46  {
47  uint8_t factor;
48  uint8_t offset;
49  };
50 
55  static TypeId GetTypeId();
56 
61  TypeId GetInstanceTypeId() const override;
62 
67 
71  ~Ipv6OptionHeader() override;
72 
77  void SetType(uint8_t type);
78 
83  uint8_t GetType() const;
84 
89  void SetLength(uint8_t length);
90 
95  uint8_t GetLength() const;
96 
101  void Print(std::ostream& os) const override;
102 
107  uint32_t GetSerializedSize() const override;
108 
113  void Serialize(Buffer::Iterator start) const override;
114 
120  uint32_t Deserialize(Buffer::Iterator start) override;
121 
129  virtual Alignment GetAlignment() const;
130 
131  private:
135  uint8_t m_type;
136 
140  uint8_t m_length;
141 
146 };
147 
154 {
155  public:
160  static TypeId GetTypeId();
161 
166  TypeId GetInstanceTypeId() const override;
167 
172 
176  ~Ipv6OptionPad1Header() override;
177 
182  void Print(std::ostream& os) const override;
183 
188  uint32_t GetSerializedSize() const override;
189 
194  void Serialize(Buffer::Iterator start) const override;
195 
201  uint32_t Deserialize(Buffer::Iterator start) override;
202 };
203 
210 {
211  public:
216  static TypeId GetTypeId();
217 
222  TypeId GetInstanceTypeId() const override;
223 
228  Ipv6OptionPadnHeader(uint32_t pad = 2);
229 
233  ~Ipv6OptionPadnHeader() override;
234 
239  void Print(std::ostream& os) const override;
240 
245  uint32_t GetSerializedSize() const override;
246 
251  void Serialize(Buffer::Iterator start) const override;
252 
258  uint32_t Deserialize(Buffer::Iterator start) override;
259 };
260 
267 {
268  public:
273  static TypeId GetTypeId();
274 
279  TypeId GetInstanceTypeId() const override;
280 
285 
289  ~Ipv6OptionJumbogramHeader() override;
290 
295  void SetDataLength(uint32_t dataLength);
296 
301  uint32_t GetDataLength() const;
302 
307  void Print(std::ostream& os) const override;
308 
313  uint32_t GetSerializedSize() const override;
314 
319  void Serialize(Buffer::Iterator start) const override;
320 
326  uint32_t Deserialize(Buffer::Iterator start) override;
327 
332  Alignment GetAlignment() const override;
333 
334  private:
338  uint32_t m_dataLength;
339 };
340 
347 {
348  public:
353  static TypeId GetTypeId();
354 
359  TypeId GetInstanceTypeId() const override;
360 
365 
369  ~Ipv6OptionRouterAlertHeader() override;
370 
375  void SetValue(uint16_t value);
376 
381  uint16_t GetValue() const;
382 
387  void Print(std::ostream& os) const override;
388 
393  uint32_t GetSerializedSize() const override;
394 
399  void Serialize(Buffer::Iterator start) const override;
400 
406  uint32_t Deserialize(Buffer::Iterator start) override;
407 
412  Alignment GetAlignment() const override;
413 
414  private:
418  uint16_t m_value;
419 };
420 
421 } // namespace ns3
422 
423 #endif /* IPV6_OPTION_HEADER_H */
iterator in a Buffer instance
Definition: buffer.h:100
automatically resized byte buffer
Definition: buffer.h:94
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
Header for IPv6 Option.
Ipv6OptionHeader()
Constructor.
uint8_t GetLength() const
Get the option length.
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.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void Print(std::ostream &os) const override
Print some information about the packet.
uint8_t GetType() const
Get the type of the option.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
uint8_t m_length
The option length.
~Ipv6OptionHeader() override
Destructor.
static TypeId GetTypeId()
Get the type identificator.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Buffer m_data
The anonymous data of this option.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Header of IPv6 Option Jumbogram.
static TypeId GetTypeId()
Get the type identificator.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Alignment GetAlignment() const override
Get the Alignment requirement of this option header.
~Ipv6OptionJumbogramHeader() override
Destructor.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void SetDataLength(uint32_t dataLength)
Set the data length.
uint32_t m_dataLength
The data length.
void Print(std::ostream &os) const override
Print some information about the packet.
uint32_t GetDataLength() const
Get the data length.
Header of IPv6 Option Pad1.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Print(std::ostream &os) const override
Print some information about the packet.
static TypeId GetTypeId()
Get the type identificator.
~Ipv6OptionPad1Header() override
Destructor.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Header of IPv6 Option Padn.
static TypeId GetTypeId()
Get the type identificator.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Ipv6OptionPadnHeader(uint32_t pad=2)
Constructor.
void Print(std::ostream &os) const override
Print some information about the packet.
~Ipv6OptionPadnHeader() override
Destructor.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Header of IPv6 Option Router Alert.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void SetValue(uint16_t value)
Set the field "value".
TypeId GetInstanceTypeId() const override
Get the instance type ID.
static TypeId GetTypeId()
Get the type identificator.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Alignment GetAlignment() const override
Get the Alignment requirement of this option header.
uint16_t GetValue() const
Get the field "value".
void Print(std::ostream &os) const override
Print some information about the packet.
~Ipv6OptionRouterAlertHeader() override
Destructor.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
represents the alignment requirements of an option header