mirror of
https://github.com/mfontanini/libtins
synced 2026-01-28 12:44:25 +01:00
Refactored DNS and UDP class.
This commit is contained in:
17
src/udp.cpp
17
src/udp.cpp
@@ -43,16 +43,6 @@ Tins::UDP::UDP(const uint8_t *buffer, uint32_t total_sz) : PDU(Constants::IP::PR
|
||||
inner_pdu(new RawPDU(buffer + sizeof(udphdr), total_sz));
|
||||
}
|
||||
|
||||
Tins::UDP::UDP(const UDP &other) : PDU(other) {
|
||||
copy_fields(&other);
|
||||
}
|
||||
|
||||
Tins::UDP &Tins::UDP::operator= (const UDP& other) {
|
||||
copy_fields(&other);
|
||||
copy_inner_pdu(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Tins::UDP::payload(uint8_t *new_payload, uint32_t new_payload_size) {
|
||||
inner_pdu(new RawPDU(new_payload, new_payload_size));
|
||||
}
|
||||
@@ -92,10 +82,3 @@ void Tins::UDP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PD
|
||||
void Tins::UDP::copy_fields(const UDP *other) {
|
||||
std::memcpy(&_udp, &other->_udp, sizeof(_udp));
|
||||
}
|
||||
|
||||
Tins::PDU *Tins::UDP::clone_pdu() const {
|
||||
UDP *new_pdu = new UDP();
|
||||
new_pdu->copy_fields(this);
|
||||
new_pdu->copy_inner_pdu(*this);
|
||||
return new_pdu;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user