Commit | Line | Data |
---|---|---|
fd40cca9 GMF |
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 | ||
5d9d2808 | 14 | #include "ip/ipheader.h" |
fd40cca9 GMF |
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 | * | | | | | | |
2c8e193f | 33 | * | payload length in bytes | next header | hop limit | | |
fd40cca9 GMF |
34 | * | | | | | |
35 | * +---------------+---------------+--------------+---------------+ | | |
36 | * | | | | |
37 | * | | | | |
38 | * | | | | |
39 | * | | | | |
40 | * | | | | |
41 | * | source IPv6 address | | | |
8b4161a5 | 42 | * | | 40 bytes |
fd40cca9 GMF |
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 | */ | |
5d9d2808 | 64 | class Ipv6Header : public IpHeader |
fd40cca9 GMF |
65 | { |
66 | public: | |
67 | Ipv6Header(); | |
68 | ||
69 | uint8_t get_version() const; | |
01e517ff | 70 | uint8_t get_differentiated_services() const; |
fd40cca9 GMF |
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 | ||
fc921308 | 77 | uint16_t get_header_length() const; |
5d9d2808 | 78 | |
fc921308 | 79 | uint16_t get_total_length() const; |
5d9d2808 CH |
80 | |
81 | // in IPv6, this corresponds to the "HOP limit" | |
fc921308 | 82 | uint8_t get_time_to_live() const; |
5d9d2808 CH |
83 | |
84 | boost::asio::ip::address get_source_address() const; | |
85 | boost::asio::ip::address get_destination_address() const; | |
fd40cca9 GMF |
86 | |
87 | friend std::istream &operator>>( | |
88 | std::istream &is, | |
89 | Ipv6Header &header | |
90 | ); | |
91 | ||
fd40cca9 GMF |
92 | }; |
93 | ||
94 | #endif // IPV6_HEADER_H |