A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ipv6-header.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-2008 Louis Pasteur 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: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19  */
20 
21 #ifndef IPV6_HEADER_H
22 #define IPV6_HEADER_H
23 
24 #include "ns3/header.h"
25 #include "ns3/ipv6-address.h"
26 
27 namespace ns3 {
28 
33 class Ipv6Header : public Header
34 {
35 public:
41  {
43  IPV6_IPV4 = 4,
44  IPV6_TCP = 6,
45  IPV6_UDP = 17,
46  IPV6_IPV6 = 41,
54  IPV6_SCTP = 135,
57  };
58 
63  static TypeId GetTypeId (void);
64 
69  virtual TypeId GetInstanceTypeId (void) const;
70 
74  Ipv6Header (void);
75 
80  void SetTrafficClass (uint8_t traffic);
81 
86  uint8_t GetTrafficClass (void) const;
87 
92  void SetFlowLabel (uint32_t flow);
93 
98  uint32_t GetFlowLabel (void) const;
99 
104  void SetPayloadLength (uint16_t len);
105 
110  uint16_t GetPayloadLength (void) const;
111 
116  void SetNextHeader (uint8_t next);
117 
122  uint8_t GetNextHeader (void) const;
123 
128  void SetHopLimit (uint8_t limit);
129 
134  uint8_t GetHopLimit (void) const;
135 
140  void SetSourceAddress (Ipv6Address src);
141 
146  Ipv6Address GetSourceAddress (void) const;
147 
153 
158  Ipv6Address GetDestinationAddress (void) const;
159 
165  virtual void Print (std::ostream& os) const;
166 
171  virtual uint32_t GetSerializedSize (void) const;
172 
177  virtual void Serialize (Buffer::Iterator start) const;
178 
184  virtual uint32_t Deserialize (Buffer::Iterator start);
185 
186 private:
190  uint32_t m_version : 4;
194  uint32_t m_trafficClass : 8;
195 
200  uint32_t m_flowLabel : 20;
201 
205  uint16_t m_payloadLength;
206 
210  uint8_t m_nextHeader;
211 
215  uint8_t m_hopLimit;
216 
221 
226 };
227 
228 } /* namespace ns3 */
229 
230 #endif /* IPV6_HEADER_H */
231