1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added copy constructor and copy assignment operator to all PDUs.

This commit is contained in:
Matias Fontanini
2011-09-03 18:58:57 -03:00
parent fdcefd2132
commit 3178c217b3
22 changed files with 615 additions and 22 deletions

View File

@@ -29,10 +29,20 @@ Tins::PDU::PDU(uint32_t flag, PDU *next_pdu) : _flag(flag), _inner_pdu(next_pdu)
}
Tins::PDU::PDU(const PDU &other) : _inner_pdu(0) {
_flag = other.flag();
copy_inner_pdu(other);
}
Tins::PDU::~PDU() {
delete _inner_pdu;
}
void Tins::PDU::copy_inner_pdu(const PDU &pdu) {
if(pdu.inner_pdu())
inner_pdu(pdu.inner_pdu()->clone_pdu());
}
uint32_t Tins::PDU::size() const {
uint32_t sz = header_size() + trailer_size();
const PDU *ptr(_inner_pdu);