PcapPlusPlus
19.12
|
#include <IcmpLayer.h>
Represents an ICMP protocol layer (for IPv4 only)
pcpp::IcmpLayer::IcmpLayer | ( | ) |
An empty constructor that creates a new layer with an empty ICMP header without setting the ICMP type or ICMP data. Call the set*Data() methods to set ICMP type and data
|
virtual |
Calculate ICMP checksum field
Implements pcpp::Layer.
icmp_address_mask_reply* pcpp::IcmpLayer::getAddressMaskReplyData | ( | ) |
icmp_address_mask_request* pcpp::IcmpLayer::getAddressMaskRequestData | ( | ) |
icmp_destination_unreachable* pcpp::IcmpLayer::getDestUnreachableData | ( | ) |
icmp_echo_reply* pcpp::IcmpLayer::getEchoReplyData | ( | ) |
icmp_echo_request* pcpp::IcmpLayer::getEchoRequestData | ( | ) |
|
virtual |
Implements pcpp::Layer.
|
inline |
Get a pointer to the basic ICMP header. Notice this points directly to the data, so every change will change the actual packet data
icmp_info_reply* pcpp::IcmpLayer::getInfoReplyData | ( | ) |
icmp_info_request* pcpp::IcmpLayer::getInfoRequestData | ( | ) |
IcmpMessageType pcpp::IcmpLayer::getMessageType | ( | ) | const |
|
inlinevirtual |
Implements pcpp::Layer.
icmp_param_problem* pcpp::IcmpLayer::getParamProblemData | ( | ) |
icmp_redirect* pcpp::IcmpLayer::getRedirectData | ( | ) |
icmp_router_advertisement* pcpp::IcmpLayer::getRouterAdvertisementData | ( | ) | const |
icmp_router_solicitation* pcpp::IcmpLayer::getRouterSolicitationData | ( | ) |
icmp_source_quench* pcpp::IcmpLayer::getSourceQuenchdata | ( | ) |
icmp_time_exceeded* pcpp::IcmpLayer::getTimeExceededData | ( | ) |
icmp_timestamp_reply* pcpp::IcmpLayer::getTimestampReplyData | ( | ) |
icmp_timestamp_request* pcpp::IcmpLayer::getTimestampRequestData | ( | ) |
bool pcpp::IcmpLayer::isMessageOfType | ( | IcmpMessageType | type | ) | const |
[in] | type | Type to check |
|
virtual |
ICMP messages of types: ICMP_DEST_UNREACHABLE, ICMP_SOURCE_QUENCH, ICMP_TIME_EXCEEDED, ICMP_REDIRECT, ICMP_PARAM_PROBLEM have data that contains IPv4 header and some L4 header (TCP/UDP/ICMP). This method parses these headers as separate layers on top of the ICMP layer
Implements pcpp::Layer.
icmp_address_mask_reply* pcpp::IcmpLayer::setAddressMaskReplyData | ( | uint16_t | id, |
uint16_t | sequence, | ||
IPv4Address | mask | ||
) |
Set address mask reply message data
[in] | id | Address mask reply identifier |
[in] | sequence | Address mask reply sequence |
[in] | mask | The subnet mask of the requesting host |
icmp_address_mask_request* pcpp::IcmpLayer::setAddressMaskRequestData | ( | uint16_t | id, |
uint16_t | sequence, | ||
IPv4Address | mask | ||
) |
Set address mask request message data
[in] | id | Address mask request identifier |
[in] | sequence | Address mask request sequence |
[in] | mask | The subnet mask of the requesting host |
icmp_destination_unreachable* pcpp::IcmpLayer::setDestUnreachableData | ( | IcmpDestUnreachableCodes | code, |
uint16_t | nextHopMTU, | ||
IPv4Layer * | ipHeader, | ||
Layer * | l4Header | ||
) |
Set destination unreachable message data. This method only works if IcmpLayer is already part of a packet (not a standalone layer). The reason is the Internet and L4 headers given as parameters are added as separate layers and need a packet to be added to
[in] | code | Destination unreachable code |
[in] | nextHopMTU | The MTU of the next-hop network if a code 4 error occurs |
[in] | ipHeader | The Internet header of the original data. This layer is added as a separate layer on the packet |
[in] | l4Header | The L4 header of the original data. This layer is added as a separate layer on the packet |
icmp_echo_reply* pcpp::IcmpLayer::setEchoReplyData | ( | uint16_t | id, |
uint16_t | sequence, | ||
uint64_t | timestamp, | ||
const uint8_t * | data, | ||
size_t | dataLen | ||
) |
Set echo (ping) reply message data
[in] | id | Echo (ping) reply identifier |
[in] | sequence | Echo (ping) reply sequence |
[in] | timestamp | Echo (ping) reply timestamp |
[in] | data | A pointer to echo (ping) reply payload to set |
[in] | dataLen | The length of the echo (ping) reply payload |
icmp_echo_request* pcpp::IcmpLayer::setEchoRequestData | ( | uint16_t | id, |
uint16_t | sequence, | ||
uint64_t | timestamp, | ||
const uint8_t * | data, | ||
size_t | dataLen | ||
) |
Set echo (ping) request message data
[in] | id | Echo (ping) request identifier |
[in] | sequence | Echo (ping) request sequence |
[in] | timestamp | Echo (ping) request timestamp |
[in] | data | A pointer to echo (ping) request payload to set |
[in] | dataLen | The length of the echo (ping) request payload |
icmp_info_reply* pcpp::IcmpLayer::setInfoReplyData | ( | uint16_t | id, |
uint16_t | sequence | ||
) |
Set information reply message data
[in] | id | Information reply identifier |
[in] | sequence | Information reply sequence |
icmp_info_request* pcpp::IcmpLayer::setInfoRequestData | ( | uint16_t | id, |
uint16_t | sequence | ||
) |
Set information request message data
[in] | id | Information request identifier |
[in] | sequence | Information request sequence |
icmp_param_problem* pcpp::IcmpLayer::setParamProblemData | ( | uint8_t | code, |
uint8_t | errorOctetPointer, | ||
IPv4Layer * | ipHeader, | ||
Layer * | l4Header | ||
) |
Set parameter problem message data. This method only works if IcmpLayer is already part of a packet (not a standalone layer). The reason is the Internet and L4 headers given as parameters are added as separate layers and need a packet to be added to
[in] | code | Parameter problem message code. Only code between 0 and 2 are legal, the rest will fail the method |
[in] | errorOctetPointer | In the case of an invalid IP header (Code 0), indicate the byte offset of the error in the header |
[in] | ipHeader | The Internet header of the original data. This layer is added as a separate layer on the packet |
[in] | l4Header | The L4 header of the original data. This layer is added as a separate layer on the packet |
icmp_redirect* pcpp::IcmpLayer::setRedirectData | ( | uint8_t | code, |
IPv4Address | gatewayAddress, | ||
IPv4Layer * | ipHeader, | ||
Layer * | l4Header | ||
) |
Set redirect message data. This method only works if IcmpLayer is already part of a packet (not a standalone layer). The reason is the Internet and L4 headers given as parameters are added as separate layers and need a packet to be added to
[in] | code | The redirect message code. Only values between 0 and 3 are legal, the rest will cause the method to fail |
[in] | gatewayAddress | An IPv4 address of the gateway to which the redirection should be sent |
[in] | ipHeader | The Internet header of the original data. This layer is added as a separate layer on the packet |
[in] | l4Header | The L4 header of the original data. This layer is added as a separate layer on the packet |
icmp_router_advertisement* pcpp::IcmpLayer::setRouterAdvertisementData | ( | uint8_t | code, |
uint16_t | lifetimeInSeconds, | ||
const std::vector< icmp_router_address_structure > & | routerAddresses | ||
) |
Set router advertisement message data
[in] | code | The router advertisement message code. Only codes 0 or 16 are legal, the rest will fail the method |
[in] | lifetimeInSeconds | The maximum number of seconds that the router addresses in this list may be considered valid |
[in] | routerAddresses | A vector of router advertisements to set |
icmp_router_solicitation* pcpp::IcmpLayer::setRouterSolicitationData | ( | ) |
Set router solicitation message data. This message accepts no parameters as there are no parameters to this type of message (code is always zero)
icmp_source_quench* pcpp::IcmpLayer::setSourceQuenchdata | ( | IPv4Layer * | ipHeader, |
Layer * | l4Header | ||
) |
Set source quench message data. This method only works if IcmpLayer is already part of a packet (not a standalone layer). The reason is the Internet and L4 headers given as parameters are added as separate layers and need a packet to be added to
[in] | ipHeader | The Internet header of the original data. This layer is added as a separate layer on the packet |
[in] | l4Header | The L4 header of the original data. This layer is added as a separate layer on the packet |
icmp_time_exceeded* pcpp::IcmpLayer::setTimeExceededData | ( | uint8_t | code, |
IPv4Layer * | ipHeader, | ||
Layer * | l4Header | ||
) |
Set time-to-live exceeded message data. This method only works if IcmpLayer is already part of a packet (not a standalone layer). The reason is the Internet and L4 headers given as parameters are added as separate layers and need a packet to be added to
[in] | code | Time-to-live exceeded message code. Only codes 0 or 1 are legal, the rest will fail the method |
[in] | ipHeader | The Internet header of the original data. This layer is added as a separate layer on the packet |
[in] | l4Header | The L4 header of the original data. This layer is added as a separate layer on the packet |
icmp_timestamp_reply* pcpp::IcmpLayer::setTimestampReplyData | ( | uint16_t | id, |
uint16_t | sequence, | ||
timeval | originateTimestamp, | ||
timeval | receiveTimestamp, | ||
timeval | transmitTimestamp | ||
) |
Set timestamp reply message data
[in] | id | Timestamp reply identifier |
[in] | sequence | Timestamp reply sequence |
[in] | originateTimestamp | Time (in milliseconds since midnight) the sender last touched the packet |
[in] | receiveTimestamp | The time the echoer first touched it on receipt |
[in] | transmitTimestamp | The time the echoer last touched the message on sending it |
icmp_timestamp_request* pcpp::IcmpLayer::setTimestampRequestData | ( | uint16_t | id, |
uint16_t | sequence, | ||
timeval | originateTimestamp | ||
) |
Set timestamp request message data
[in] | id | Timestamp request identifier |
[in] | sequence | Timestamp request sequence |
[in] | originateTimestamp | Time (in milliseconds since midnight) the sender last touched the packet |
|
virtual |
Implements pcpp::Layer.