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:
10
src/pdu.cpp
10
src/pdu.cpp
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user