mirror of
https://github.com/mfontanini/libtins
synced 2026-01-28 04:34:27 +01:00
Remove parent parameter from write_serialization
This is no longer needed as each PDU knows its parent PDU already
This commit is contained in:
10
src/ip.cpp
10
src/ip.cpp
@@ -418,14 +418,14 @@ PDU* IP::recv_response(PacketSender& sender, const NetworkInterface &) {
|
||||
return sender.recv_l3(*this, 0, sizeof(link_addr), type);
|
||||
}
|
||||
|
||||
void IP::prepare_for_serialize(const PDU* parent) {
|
||||
if (!parent && header_.saddr == 0) {
|
||||
void IP::prepare_for_serialize() {
|
||||
if (!parent_pdu()&& header_.saddr == 0) {
|
||||
NetworkInterface iface(dst_addr());
|
||||
src_addr(iface.addresses().ip_addr);
|
||||
}
|
||||
}
|
||||
|
||||
void IP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
|
||||
void IP::write_serialization(uint8_t* buffer, uint32_t total_sz) {
|
||||
OutputMemoryStream stream(buffer, total_sz);
|
||||
checksum(0);
|
||||
if (inner_pdu()) {
|
||||
@@ -446,12 +446,10 @@ void IP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* pare
|
||||
uint16_t original_frag_off = header_.frag_off;
|
||||
|
||||
#if __FreeBSD__ || defined(__FreeBSD_kernel__) || __APPLE__
|
||||
if (!parent) {
|
||||
if (!parent_pdu()) {
|
||||
total_sz = Endian::host_to_be<uint16_t>(total_sz);
|
||||
header_.frag_off = Endian::be_to_host(header_.frag_off);
|
||||
}
|
||||
#else
|
||||
Internals::unused(parent);
|
||||
#endif
|
||||
tot_len(total_sz);
|
||||
head_len(static_cast<uint8_t>(header_size() / sizeof(uint32_t)));
|
||||
|
||||
Reference in New Issue
Block a user