1
0
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:
Santiago Alessandri
2011-09-08 10:43:29 -03:00
7 changed files with 44 additions and 51 deletions

View File

@@ -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));
}

View File

@@ -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.");

View File

@@ -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;
}

View File

@@ -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;
}