mirror of
https://github.com/mfontanini/libtins
synced 2026-01-28 20:44:26 +01:00
Merge branch 'master' of ssh://git.code.sf.net/p/libtins/code
This commit is contained in:
10
src/arp.cpp
10
src/arp.cpp
@@ -55,16 +55,6 @@ Tins::ARP::ARP(const uint8_t *buffer, uint32_t total_sz) : PDU(0x0608) {
|
||||
inner_pdu(new RawPDU(buffer + sizeof(arphdr), total_sz));
|
||||
}
|
||||
|
||||
Tins::ARP::ARP(const ARP &other) : PDU(other) {
|
||||
copy_fields(&other);
|
||||
}
|
||||
|
||||
Tins::ARP &Tins::ARP::operator= (const ARP &other) {
|
||||
copy_fields(&other);
|
||||
copy_inner_pdu(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Tins::ARP::ARP(const arphdr *arp_ptr) : PDU(Utils::net_to_host_s(0x0806)) {
|
||||
memcpy(&_arp, arp_ptr, sizeof(arphdr));
|
||||
}
|
||||
|
||||
10
src/icmp.cpp
10
src/icmp.cpp
@@ -48,16 +48,6 @@ Tins::ICMP::ICMP(Flags flag) : PDU(IPPROTO_ICMP) {
|
||||
};
|
||||
}
|
||||
|
||||
Tins::ICMP::ICMP(const ICMP &other) : PDU(other) {
|
||||
copy_fields(&other);
|
||||
}
|
||||
|
||||
Tins::ICMP &Tins::ICMP::operator= (const ICMP &other) {
|
||||
copy_fields(&other);
|
||||
copy_inner_pdu(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Tins::ICMP::ICMP(const uint8_t *buffer, uint32_t total_sz) : PDU(IPPROTO_ICMP) {
|
||||
if(total_sz < sizeof(icmphdr))
|
||||
throw std::runtime_error("Not enough size for an ICMP header in the buffer.");
|
||||
|
||||
@@ -34,6 +34,12 @@ Tins::PDU::PDU(const PDU &other) : _inner_pdu(0) {
|
||||
copy_inner_pdu(other);
|
||||
}
|
||||
|
||||
Tins::PDU &Tins::PDU::operator=(const PDU &other) {
|
||||
_flag = other.flag();
|
||||
copy_inner_pdu(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Tins::PDU::~PDU() {
|
||||
delete _inner_pdu;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ Tins::TCP::TCP(const TCP &other) : PDU(other) {
|
||||
}
|
||||
|
||||
Tins::TCP &Tins::TCP::operator= (const TCP &other) {
|
||||
PDU::operator=(other);
|
||||
copy_fields(&other);
|
||||
copy_inner_pdu(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user