36 #ifdef TIMESTAMP_REQUEST
37 #undef TIMESTAMP_REQUEST
40 #ifdef TIMESTAMP_REPLY
41 #undef TIMESTAMP_REPLY
45#include <tins/macros.h>
47#include <tins/endianness.h>
48#include <tins/ip_address.h>
49#include <tins/icmp_extension.h>
54class InputMemoryStream;
87 TIMESTAMP_REQUEST = 13,
91 ADDRESS_MASK_REQUEST = 17,
92 ADDRESS_MASK_REPLY = 18,
93 EXTENDED_ECHO_REQUEST = 42,
94 EXTENDED_ECHO_REPLY = 43
111 ICMP(Flags flag = ECHO_REQUEST);
137 void type(Flags type);
158 void gateway(address_type
new_gw);
200 void address_mask(address_type
new_mask);
237 void set_dest_unreachable();
261 void set_source_quench();
278 return (
Flags)header_.type;
296 return Endian::be_to_host(header_.check);
305 return Endian::be_to_host(header_.un.echo.id);
314 return Endian::be_to_host(header_.un.echo.sequence);
332 return header_.un.rfc4884.pointer;
341 return header_.un.rfc4884.length;
350 return Endian::be_to_host(header_.un.frag.mtu);
359 return Endian::be_to_host(orig_timestamp_or_address_mask_);
368 return Endian::be_to_host(recv_timestamp_);
377 return Endian::be_to_host(trans_timestamp_);
439 return !extensions_.extensions().empty();
457 void use_length_field(
bool value);
472 return new ICMP(*
this);
498 void checksum(uint16_t new_check);
499 void write_serialization(uint8_t* buffer, uint32_t total_sz);
500 uint32_t get_adjusted_inner_pdu_size()
const;
501 void try_parse_extensions(Memory::InputMemoryStream& stream);
502 bool are_extensions_allowed()
const;
505 uint32_t orig_timestamp_or_address_mask_;
506 uint32_t recv_timestamp_;
507 uint32_t trans_timestamp_;
508 ICMPExtensionsStructure extensions_;
Represents a range of addresses.
Definition address_range.h:167
Class that represents an ICMP extensions structure.
Definition icmp_extension.h:161
Class that represents an ICMP PDU.
Definition icmp.h:65
uint16_t id() const
Getter for the echo id.
Definition icmp.h:304
uint16_t sequence() const
Getter for the echo sequence number.
Definition icmp.h:313
uint16_t mtu() const
Getter for the mtu field.
Definition icmp.h:349
uint32_t receive_timestamp() const
Getter for the receive timestamp field.
Definition icmp.h:367
uint8_t length() const
Getter for the length field.
Definition icmp.h:340
const ICMPExtensionsStructure & extensions() const
Getter for the extensions field.
Definition icmp.h:422
uint32_t transmit_timestamp() const
Getter for the transmit timestamp field.
Definition icmp.h:376
uint16_t checksum() const
Getter for the checksum field.
Definition icmp.h:295
bool has_extensions() const
Indicates whether this object contains ICMP extensions.
Definition icmp.h:438
uint8_t pointer() const
Getter for the pointer field.
Definition icmp.h:331
Flags type() const
Getter for the ICMP type flag.
Definition icmp.h:277
uint8_t code() const
Getter for the ICMP code flag.
Definition icmp.h:286
address_type address_mask() const
Getter for the address mask field.
Definition icmp.h:385
address_type gateway() const
Getter for the gateway field.
Definition icmp.h:322
PDUType pdu_type() const
Getter for the PDU's type.
Definition icmp.h:464
Flags
ICMP flags.
Definition icmp.h:79
uint32_t original_timestamp() const
Getter for the original timestamp field.
Definition icmp.h:358
IPv4Address address_type
Definition icmp.h:75
ICMPExtensionsStructure & extensions()
Getter for the extensions field.
Definition icmp.h:431
ICMP * clone() const
Definition icmp.h:471
Abstraction of an IPv4 address.
Definition ip_address.h:45
Base class for protocol data units.
Definition pdu.h:107
PDUType
Enum which identifies each type of PDU.
Definition pdu.h:127
The Tins namespace.
Definition address_range.h:38