6 #define FICMPV4FRAME_H 1
10 #include "../endian_conversion.h"
13 #include "../fframe.h"
14 #include "../caddress.h"
34 } __attribute__((packed));
43 } __attribute__((packed));
50 ICMP_TYPE_DESTINATION_UNREACHABLE = 3,
51 ICMP_TYPE_ECHO_REPLY = 0,
52 ICMP_TYPE_ECHO_REQUEST = 8,
56 ICMP_CODE_HOST_UNREACHABLE = 1,
57 ICMP_CODE_NO_CODE = 0,
58 ICMP_CODE_DATAGRAM_TOO_BIG = 4,
61 #define DEFAULT_ICMPV4_FRAME_SIZE sizeof(struct icmpv4_hdr_t)
78 size_t len = DEFAULT_ICMPV4_FRAME_SIZE);
111 validate(uint16_t total_len = 0)
const;
124 uint8_t *data,
size_t datalen)
throw (eFrameOutOfRange);
130 payload()
const throw (eFrameNoPayload);
144 get_icmp_code() const;
150 set_icmp_code(uint8_t code);
156 get_icmp_type() const;
162 set_icmp_type(uint8_t type);
167 struct icmpv4_hdr_t *icmp_hdr;
178 operator<< (std::ostream& os,
ficmpv4frame const& frame) {
179 os << dynamic_cast<fframe const&>( frame );
180 os << indent(2) <<
"<ficmpv4frame ";
181 os <<
"code:" << (int)frame.get_icmp_code() <<
" ";
182 os <<
"type:" << (int)frame.get_icmp_type() <<
" ";
183 os <<
">" << std::endl;
virtual void payload_insert(uint8_t *data, size_t datalen)
Definition: ficmpv4frame.cc:81
virtual void validate(uint16_t total_len=0) const
Definition: ficmpv4frame.cc:115
virtual size_t payloadlen() const
Definition: ficmpv4frame.cc:105
Definition: ficmpv4frame.h:20
virtual bool complete() const
Definition: ficmpv4frame.cc:56
Definition: ficmpv4frame.h:19
virtual size_t need_bytes() const
Definition: ficmpv4frame.cc:68
virtual uint8_t * payload() const
Definition: ficmpv4frame.cc:95
Definition: ficmpv4frame.h:37
Definition: ficmpv4frame.h:29
virtual ~ficmpv4frame()
Definition: ficmpv4frame.cc:31
Definition: ficmpv4frame.h:21
Definition: ficmpv4frame.h:25
ficmpv4frame(uint8_t *data, size_t datalen)
Definition: ficmpv4frame.cc:9
virtual void initialize()
Definition: ficmpv4frame.cc:39
void icmpv4_calc_checksum(uint16_t length)
Definition: ficmpv4frame.cc:130