2 The software in this package is distributed under the GNU General
3 Public License version 2 (with a special exception described below).
5 A copy of GNU General Public License (GPL) is included in this distribution,
6 in the file COPYING.GPL.
8 As a special exception, if other files instantiate templates or use macros
9 or inline functions from this file, or you compile this file and link it
10 with other works to produce a work based on this file, this file
11 does not by itself cause the resulting work to be covered
12 by the GNU General Public License.
14 However the source code for this file must still be made available
15 in accordance with section (3) of the GNU General Public License.
17 This exception does not invalidate any other reasons why a work based
18 on this file might be covered by the GNU General Public License.
20 Christian Herdtweck, Intra2net AG 2015
21 Based on an example in Boost Documentation (by Christopher M. Kohlhoff)
22 and adaptation by Guilherme M. Ferreira
26 #ifndef ICMP_DATA_PING_FAIL_REPLY_H
27 #define ICMP_DATA_PING_FAIL_REPLY_H
30 #include "icmp/icmpdata.h"
33 * structure of DestinationUnreachable or TimeExceeded or Source Quench packets
34 * if originated from an ICMP request:
35 * +---------------------------+
36 * | reply IP header | 20/40 bytes --> not contained in here
37 * +---------------------------+
38 * | reply ICMP header: |
39 * | type | code | checksum | 4 byte --> not contained in here !
40 * | 4 uninteresting bytes | 4 byte --> contained in here!
41 * +---------------------------+
42 * | request | 20 / 40 bytes
43 * | IP header | for IP v4 / v6
44 * +---------------------------+
45 * | request ICMP packet: |
46 * | type | code | checksum | 1+1+2 byte
47 * | identifier | seq. number | 2+2 byte
50 * +---------------------------+
51 * (where "in here" means in variable raw_data of class
52 * IcmpData_PingFailReply)
54 * see also: https://tools.ietf.org/html/rfc792 (ICMP v4)
55 * https://tools.ietf.org/html/rfc4443 (ICMP v6)
56 * http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol
57 * http://en.wikipedia.org/wiki/ICMPv6
61 * contains the request IP and ICMP header and possibly more data from request
63 class IcmpData_PingFailReply : public IcmpData
66 IcmpData_PingFailReply(const std::size_t size_arg);
68 bool match_echo_reply(const uint16_t identifier,
69 const uint16_t sequence_number) const;
71 // not implementing match_destination_unreachable nor match_time_exceeded
73 uint16_t get_icmp_identifier() const;
75 uint16_t get_icmp_sequence_number() const;
77 uint8_t get_ip_ttl() const;
79 int get_icmp_data_offset() const;
81 // not implementing print nor to_string
84 uint16_t get_icmp_request_data(const int icmp_start_byte) const;
85 bool match_ping_request(const uint16_t identifier,
86 const uint16_t sequence_number) const;
92 // (created using vim -- the world's best text editor)