A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ipv6-extension-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_EXTENSION_HEADER_H
22 #define IPV6_EXTENSION_HEADER_H
23 
24 #include <vector>
25 #include <list>
26 #include <ostream>
27 
28 #include "ns3/header.h"
29 #include "ns3/ipv6-address.h"
30 #include "ipv6-option-header.h"
31 
32 namespace ns3
33 {
34 
39 class Ipv6ExtensionHeader : public Header
40 {
41 public:
46  static TypeId GetTypeId ();
47 
52  virtual TypeId GetInstanceTypeId () const;
53 
58 
62  virtual ~Ipv6ExtensionHeader ();
63 
68  void SetNextHeader (uint8_t nextHeader);
69 
74  uint8_t GetNextHeader () const;
75 
80  void SetLength (uint16_t length);
81 
86  uint16_t GetLength () const;
87 
93  virtual void Print (std::ostream &os) const;
94 
99  virtual uint32_t GetSerializedSize () const;
100 
105  virtual void Serialize (Buffer::Iterator start) const;
106 
112  virtual uint32_t Deserialize (Buffer::Iterator start);
113 
114 private:
118  uint8_t m_nextHeader;
119 
123  uint8_t m_length;
124 
129 };
130 
142 {
143 public:
148  OptionField (uint32_t optionsOffset);
149 
153  ~OptionField ();
154 
159  uint32_t GetSerializedSize () const;
160 
165  void Serialize (Buffer::Iterator start) const;
166 
173  uint32_t Deserialize (Buffer::Iterator start, uint32_t length);
174 
179  void AddOption (Ipv6OptionHeader const& option);
180 
186  uint32_t GetOptionsOffset ();
187 
193 
194 private:
195 
200  uint32_t CalculatePad (Ipv6OptionHeader::Alignment alignment) const;
201 
206 
210  uint32_t m_optionsOffset;
211 };
212 
218 {
219 public:
224  static TypeId GetTypeId ();
225 
230  virtual TypeId GetInstanceTypeId () const;
231 
236 
240  virtual ~Ipv6ExtensionHopByHopHeader ();
241 
247  virtual void Print (std::ostream &os) const;
248 
253  virtual uint32_t GetSerializedSize () const;
254 
259  virtual void Serialize (Buffer::Iterator start) const;
260 
266  virtual uint32_t Deserialize (Buffer::Iterator start);
267 };
268 
274 {
275 public:
280  static TypeId GetTypeId ();
281 
286  virtual TypeId GetInstanceTypeId () const;
287 
292 
297 
303  virtual void Print (std::ostream &os) const;
304 
309  virtual uint32_t GetSerializedSize () const;
310 
315  virtual void Serialize (Buffer::Iterator start) const;
316 
322  virtual uint32_t Deserialize (Buffer::Iterator start);
323 };
324 
330 {
331 public:
336  static TypeId GetTypeId ();
337 
342  virtual TypeId GetInstanceTypeId () const;
343 
348 
352  virtual ~Ipv6ExtensionFragmentHeader ();
353 
358  void SetOffset (uint16_t offset);
359 
364  uint16_t GetOffset () const;
365 
370  void SetMoreFragment (bool moreFragment);
371 
376  bool GetMoreFragment () const;
377 
382  void SetIdentification (uint32_t identification);
383 
388  uint32_t GetIdentification () const;
389 
395  virtual void Print (std::ostream &os) const;
396 
401  virtual uint32_t GetSerializedSize () const;
402 
407  virtual void Serialize (Buffer::Iterator start) const;
408 
414  virtual uint32_t Deserialize (Buffer::Iterator start);
415 
416 private:
420  uint16_t m_offset;
421 
426 };
427 
433 {
434 public:
439  static TypeId GetTypeId ();
440 
445  virtual TypeId GetInstanceTypeId () const;
446 
451 
455  virtual ~Ipv6ExtensionRoutingHeader ();
456 
461  void SetTypeRouting (uint8_t typeRouting);
462 
467  uint8_t GetTypeRouting () const;
468 
473  void SetSegmentsLeft (uint8_t segmentsLeft);
474 
479  uint8_t GetSegmentsLeft () const;
480 
486  virtual void Print (std::ostream &os) const;
487 
492  virtual uint32_t GetSerializedSize () const;
493 
498  virtual void Serialize (Buffer::Iterator start) const;
499 
505  virtual uint32_t Deserialize (Buffer::Iterator start);
506 
507 private:
511  uint8_t m_typeRouting;
512 
516  uint8_t m_segmentsLeft;
517 };
518 
524 {
525 public:
530  static TypeId GetTypeId ();
531 
536  virtual TypeId GetInstanceTypeId () const;
537 
542 
547 
552  void SetNumberAddress (uint8_t n);
553 
558  void SetRoutersAddress (std::vector<Ipv6Address> routersAddress);
559 
564  std::vector<Ipv6Address> GetRoutersAddress () const;
565 
571  void SetRouterAddress (uint8_t index, Ipv6Address addr);
572 
578  Ipv6Address GetRouterAddress (uint8_t index) const;
579 
585  virtual void Print (std::ostream &os) const;
586 
591  virtual uint32_t GetSerializedSize () const;
592 
597  virtual void Serialize (Buffer::Iterator start) const;
598 
604  virtual uint32_t Deserialize (Buffer::Iterator start);
605 
606 private:
610  typedef std::vector<Ipv6Address> VectorIpv6Address_t;
611 
616 };
617 
623 {
624 public:
629  static TypeId GetTypeId ();
630 
635  virtual TypeId GetInstanceTypeId () const;
636 
641 
645  virtual ~Ipv6ExtensionESPHeader ();
646 
652  virtual void Print (std::ostream &os) const;
653 
658  virtual uint32_t GetSerializedSize () const;
659 
664  virtual void Serialize (Buffer::Iterator start) const;
665 
671  virtual uint32_t Deserialize (Buffer::Iterator start);
672 };
673 
679 {
680 public:
685  static TypeId GetTypeId ();
686 
691  virtual TypeId GetInstanceTypeId () const;
692 
697 
701  virtual ~Ipv6ExtensionAHHeader ();
702 
708  virtual void Print (std::ostream &os) const;
709 
714  virtual uint32_t GetSerializedSize () const;
715 
720  virtual void Serialize (Buffer::Iterator start) const;
721 
727  virtual uint32_t Deserialize (Buffer::Iterator start);
728 };
729 
730 } // namespace ns3
731 
732 #endif /* IPV6_EXTENSION_HEADER_H */
733