extended ICMP packet dumping to parts after packet creation
[pingcheck] / src / ip / ipv6header.h
1 // Copyright (c) 2003-2010 Christopher M. Kohlhoff
2 // Modifications (c) 2011 by Guilherme Maciel Ferreira / Intra2net AG
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 //    (See accompanying file LICENSE_1_0.txt or copy at
6 //          http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef IPV6_HEADER_H
8 #define IPV6_HEADER_H
9
10 #include <stdint.h>
11
12 #include <boost/asio/ip/address_v6.hpp>
13
14 #include "ip/ipheader.h"
15
16 //-----------------------------------------------------------------------------
17 // Ipv6Header
18 //-----------------------------------------------------------------------------
19
20 /**
21  * @brief This class represents the IP version 6 Packet Header.
22  *
23  * The IPv6 header format is:
24  *
25  * @code
26  * 0      3 4            11 12   15 16          23 24            31
27  * +-------+---------------+--------------------------------------+      ---
28  * |       |               |                                      |       ^
29  * |version| traffic class |              flow label              |       |
30  * |  (6)  |               |                                      |       |
31  * +-------+---------------+-------+--------------+---------------+       |
32  * |                               |              |               |       |
33  * |    payload length in bytes    | next header  |   hop limit   |       |
34  * |                               |              |               |       |
35  * +---------------+---------------+--------------+---------------+       |
36  * |                                                              |       |
37  * |                                                              |       |
38  * |                                                              |       |
39  * |                                                              |       |
40  * |                                                              |       |
41  * |                      source IPv6 address                     |       |
42  * |                                                              |   40 bytes
43  * |                                                              |       |
44  * |                                                              |       |
45  * |                                                              |       |
46  * |                                                              |       |
47  * |                                                              |       |
48  * +--------------------------------------------------------------+       |
49  * |                                                              |       |
50  * |                                                              |       |
51  * |                                                              |       |
52  * |                                                              |       |
53  * |                                                              |       |
54  * |                   destination IPv6 address                   |       |
55  * |                                                              |       |
56  * |                                                              |       |
57  * |                                                              |       |
58  * |                                                              |       |
59  * |                                                              |       |
60  * |                                                              |       v
61  * +--------------------------------------------------------------+      ---
62  * @endcode
63  */
64 class Ipv6Header : public IpHeader
65 {
66 public:
67     Ipv6Header();
68
69     uint8_t get_version() const;
70     uint8_t get_differentiated_services() const;
71     uint32_t get_flow_label() const;
72
73     uint16_t get_payload_length() const;
74     uint8_t get_next_header() const;
75     uint8_t get_hop_limit() const;
76
77     uint16_t get_header_length() const;
78
79     uint16_t get_total_length() const;
80
81     // in IPv6, this corresponds to the "HOP limit"
82     uint8_t get_time_to_live() const;
83
84     boost::asio::ip::address get_source_address() const;
85     boost::asio::ip::address get_destination_address() const;
86
87     friend std::istream &operator>>(
88             std::istream &is,
89             Ipv6Header &header
90     );
91
92 };
93
94 #endif // IPV6_HEADER_H