1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 04:11:35 +01:00

Refactored several classes.

This commit is contained in:
Matias Fontanini
2012-08-03 13:08:24 -03:00
parent c4a92d2b96
commit c5fce38c3a
18 changed files with 204 additions and 306 deletions

View File

@@ -57,10 +57,6 @@ Tins::ICMP::ICMP(const uint8_t *buffer, uint32_t total_sz) : PDU(IPPROTO_ICMP) {
inner_pdu(new RawPDU(buffer + sizeof(icmphdr), total_sz));
}
Tins::ICMP::ICMP(const ICMP &other) : PDU(other) {
copy_fields(&other);
}
void Tins::ICMP::code(uint8_t new_code) {
_icmp.code = new_code;
}
@@ -203,14 +199,3 @@ Tins::PDU *Tins::ICMP::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
cloned->inner_pdu(child);
return cloned;
}
void Tins::ICMP::copy_fields(const ICMP *other) {
std::memcpy(&_icmp, &other->_icmp, sizeof(_icmp));
}
Tins::PDU *Tins::ICMP::clone_pdu() const {
ICMP *new_pdu = new ICMP();
new_pdu->copy_fields(this);
new_pdu->copy_inner_pdu(*this);
return new_pdu;
}