1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-26 03:51:35 +01:00

Marked PDU::clone_packet as deprecated.

This commit is contained in:
Matias Fontanini
2013-03-24 16:08:09 -03:00
parent d7dd1e131f
commit 8be0c4c23c
16 changed files with 90 additions and 67 deletions

View File

@@ -436,19 +436,6 @@ bool IP::matches_response(uint8_t *ptr, uint32_t total_sz) {
}
PDU *IP::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
if(total_sz < sizeof(iphdr))
return 0;
const iphdr *ip_ptr = (iphdr*)ptr;
uint32_t sz = ip_ptr->ihl * sizeof(uint32_t);
if(total_sz < sz)
return 0;
PDU *child = 0, *cloned;
if(total_sz > sz) {
if((child = PDU::clone_inner_pdu(ptr + sizeof(_ip), total_sz - sizeof(_ip))) == 0)
return 0;
}
cloned = new IP(ptr, std::min(total_sz, (uint32_t)(Endian::be_to_host(ip_ptr->tot_len) * sizeof(uint32_t))));
cloned->inner_pdu(child);
return cloned;
return new IP(ptr, total_sz);
}
}