mirror of
https://github.com/mfontanini/libtins
synced 2026-01-28 12:44:25 +01:00
PDU::matches_response is now const.
This commit is contained in:
@@ -112,10 +112,10 @@ void ARP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *) {
|
||||
memcpy(buffer, &_arp, sizeof(arphdr));
|
||||
}
|
||||
|
||||
bool ARP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool ARP::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(arphdr))
|
||||
return false;
|
||||
arphdr *arp_ptr = (arphdr*)ptr;
|
||||
const arphdr *arp_ptr = (const arphdr*)ptr;
|
||||
return arp_ptr->ar_sip == _arp.ar_tip && arp_ptr->ar_tip == _arp.ar_sip;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void BootP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *p
|
||||
std::copy(_vend.begin(), _vend.end(), buffer + sizeof(bootphdr));
|
||||
}
|
||||
|
||||
bool BootP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool BootP::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(bootphdr))
|
||||
return false;
|
||||
const bootphdr *bootp_ptr = (const bootphdr *)ptr;
|
||||
|
||||
@@ -131,7 +131,7 @@ uint32_t DHCPv6::header_size() const {
|
||||
return (is_relay_message() ? (2 + ipaddress_type::address_size * 2) : 4) + options_size;
|
||||
}
|
||||
|
||||
bool DHCPv6::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool DHCPv6::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(!is_relay_message()) {
|
||||
if(total_sz < 4 || (ptr[0] == 12 || ptr[0] == 13))
|
||||
return false;
|
||||
|
||||
@@ -481,7 +481,7 @@ DNS::resources_type DNS::answers() const {
|
||||
return res;
|
||||
}
|
||||
|
||||
bool DNS::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool DNS::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(dnshdr))
|
||||
return false;
|
||||
const dnshdr *hdr = (const dnshdr*)ptr;
|
||||
|
||||
@@ -129,7 +129,7 @@ void Dot1Q::append_padding(bool value) {
|
||||
_append_padding = value;
|
||||
}
|
||||
|
||||
bool Dot1Q::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool Dot1Q::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(_header))
|
||||
return false;
|
||||
const dot1q_hdr *dot1q_ptr = (const dot1q_hdr*)ptr;
|
||||
|
||||
@@ -110,7 +110,7 @@ void Dot3::send(PacketSender &sender, const NetworkInterface &iface) {
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
bool Dot3::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool Dot3::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(ethhdr))
|
||||
return false;
|
||||
const size_t addr_sz = address_type::address_size;
|
||||
|
||||
@@ -122,7 +122,7 @@ void EthernetII::send(PacketSender &sender, const NetworkInterface &iface) {
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
bool EthernetII::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool EthernetII::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(ethhdr))
|
||||
return false;
|
||||
const size_t addr_sz = address_type::address_size;
|
||||
|
||||
@@ -160,7 +160,7 @@ void ICMP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *)
|
||||
_icmp.check = 0;
|
||||
}
|
||||
|
||||
bool ICMP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool ICMP::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(icmphdr))
|
||||
return false;
|
||||
const icmphdr *icmp_ptr = (const icmphdr*)ptr;
|
||||
|
||||
@@ -181,7 +181,7 @@ uint32_t ICMPv6::header_size() const {
|
||||
(has_dest_addr() ? ipaddress_type::address_size : 0);
|
||||
}
|
||||
|
||||
bool ICMPv6::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool ICMPv6::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(icmp6hdr))
|
||||
return false;
|
||||
const icmp6hdr *hdr_ptr = (const icmp6hdr*)ptr;
|
||||
|
||||
@@ -429,7 +429,7 @@ void IP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU* pare
|
||||
}
|
||||
}
|
||||
|
||||
bool IP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool IP::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(iphdr))
|
||||
return false;
|
||||
const iphdr *ip_ptr = (const iphdr*)ptr;
|
||||
|
||||
@@ -162,7 +162,7 @@ uint32_t IPv6::header_size() const {
|
||||
return sizeof(_header) + headers_size;
|
||||
}
|
||||
|
||||
bool IPv6::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool IPv6::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(ipv6_header))
|
||||
return false;
|
||||
const ipv6_header *hdr_ptr = (const ipv6_header*)ptr;
|
||||
|
||||
@@ -263,7 +263,7 @@ void RadioTap::send(PacketSender &sender, const NetworkInterface &iface) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool RadioTap::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool RadioTap::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(sizeof(_radio) < total_sz)
|
||||
return false;
|
||||
const radiotap_hdr *radio_ptr = (const radiotap_hdr*)ptr;
|
||||
|
||||
@@ -57,7 +57,7 @@ void RawPDU::payload(const payload_type &pload) {
|
||||
_payload = pload;
|
||||
}
|
||||
|
||||
bool RawPDU::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool RawPDU::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ void TCP::internal_add_option(const option &opt) {
|
||||
_total_options_size = (padding) ? _options_size - padding + 4 : _options_size;
|
||||
}
|
||||
|
||||
bool TCP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool TCP::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(tcphdr))
|
||||
return false;
|
||||
const tcphdr *tcp_ptr = (const tcphdr*)ptr;
|
||||
|
||||
@@ -98,7 +98,7 @@ void UDP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *par
|
||||
}
|
||||
}
|
||||
|
||||
bool UDP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool UDP::matches_response(const uint8_t *ptr, uint32_t total_sz) const {
|
||||
if(total_sz < sizeof(udphdr))
|
||||
return false;
|
||||
const udphdr *udp_ptr = (const udphdr*)ptr;
|
||||
|
||||
Reference in New Issue
Block a user