mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +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:
@@ -334,7 +334,7 @@ private:
|
||||
uint32_t target_ip_address;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
arp_header header_;
|
||||
};
|
||||
|
||||
@@ -332,7 +332,7 @@ protected:
|
||||
*/
|
||||
vend_type& vend() { return vend_; }
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* Struct that represents the Bootp datagram.
|
||||
|
||||
@@ -509,7 +509,7 @@ public:
|
||||
private:
|
||||
static const uint32_t MAX_DHCP_SIZE;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
template <typename T>
|
||||
T search_and_convert(OptionTypes opt) const {
|
||||
|
||||
@@ -890,7 +890,7 @@ public:
|
||||
return new DHCPv6(*this);
|
||||
}
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
void write_option(const option& option, Memory::OutputMemoryStream& stream) const;
|
||||
options_type::const_iterator search_option_iterator(OptionTypes type) const;
|
||||
options_type::iterator search_option_iterator(OptionTypes type);
|
||||
|
||||
@@ -1030,7 +1030,7 @@ private:
|
||||
uint8_t* update_dname(uint8_t* ptr, uint32_t threshold, uint32_t offset);
|
||||
static void inline_convert_v4(uint32_t value, char* output);
|
||||
static bool contains_dname(uint16_t type);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
void add_record(const resource& resource, const sections_type& sections);
|
||||
|
||||
dns_header header_;
|
||||
|
||||
@@ -554,7 +554,7 @@ private:
|
||||
Dot11(const dot11_header* header_ptr);
|
||||
|
||||
void internal_add_option(const option& opt);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
options_type::const_iterator search_option_iterator(OptionTypes type) const;
|
||||
options_type::iterator search_option_iterator(OptionTypes type);
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ public:
|
||||
*/
|
||||
bool matches_response(const uint8_t* ptr, uint32_t total_sz) const;
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
TINS_BEGIN_PACK
|
||||
struct dot1q_header {
|
||||
|
||||
@@ -199,7 +199,7 @@ private:
|
||||
uint16_t length;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
dot3_header header_;
|
||||
};
|
||||
|
||||
@@ -185,13 +185,7 @@ protected:
|
||||
*/
|
||||
virtual void write_body(Memory::OutputMemoryStream& stream) = 0;
|
||||
private:
|
||||
/**
|
||||
* \brief Serialices this EAPOL PDU.
|
||||
* \param buffer The buffer in which the PDU will be serialized.
|
||||
* \param total_sz The size available in the buffer.
|
||||
* \param parent The PDU that's one level below this one on the stack.
|
||||
*/
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
eapol_header header_;
|
||||
};
|
||||
|
||||
@@ -208,7 +208,7 @@ private:
|
||||
uint16_t payload_type;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
ethernet_header header_;
|
||||
};
|
||||
|
||||
@@ -493,15 +493,8 @@ private:
|
||||
} un;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void checksum(uint16_t new_check);
|
||||
|
||||
/** \brief Serialices this ICMP PDU.
|
||||
* \param buffer The buffer in which the PDU will be serialized.
|
||||
* \param total_sz The size available in the buffer.
|
||||
* \param parent The PDU that's one level below this one on the stack.
|
||||
*/
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
|
||||
void checksum(uint16_t new_check);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
uint32_t get_adjusted_inner_pdu_size() const;
|
||||
void try_parse_extensions(Memory::InputMemoryStream& stream);
|
||||
bool are_extensions_allowed() const;
|
||||
|
||||
@@ -1559,7 +1559,7 @@ private:
|
||||
} TINS_END_PACK;
|
||||
|
||||
void internal_add_option(const option& option);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
bool has_options() const;
|
||||
void write_option(const option& opt, Memory::OutputMemoryStream& stream);
|
||||
void parse_options(Memory::InputMemoryStream& stream);
|
||||
|
||||
@@ -756,10 +756,10 @@ private:
|
||||
void head_len(small_uint<4> new_head_len);
|
||||
void tot_len(uint16_t new_tot_len);
|
||||
|
||||
void prepare_for_serialize(const PDU* parent);
|
||||
void prepare_for_serialize();
|
||||
void internal_add_option(const option& option);
|
||||
void init_ip_fields();
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
void write_option(const option& opt, Memory::OutputMemoryStream& stream);
|
||||
void add_route_option(option_identifier id, const generic_route_option_type& data);
|
||||
generic_route_option_type search_route_option(option_identifier id) const;
|
||||
|
||||
@@ -168,7 +168,7 @@ private:
|
||||
uint32_t spi, seq_number;
|
||||
};
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
ipsec_header header_;
|
||||
byte_array icv_;
|
||||
@@ -258,7 +258,7 @@ private:
|
||||
uint32_t spi, seq_number;
|
||||
};
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
ipsec_header header_;
|
||||
};
|
||||
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
*/
|
||||
const ext_header* search_header(ExtensionHeader id) const;
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
void set_last_next_header(uint8_t value);
|
||||
static void write_header(const ext_header& header, Memory::OutputMemoryStream& stream);
|
||||
static bool is_extension_header(uint8_t header_id);
|
||||
|
||||
@@ -401,7 +401,7 @@ private:
|
||||
typedef std::vector<uint8_t> field_type;
|
||||
typedef std::list<field_type> field_list;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
llchdr header_;
|
||||
uint8_t control_field_length_;
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
void send(PacketSender& sender, const NetworkInterface& iface);
|
||||
#endif // BSD
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
uint32_t family_;
|
||||
};
|
||||
|
||||
@@ -147,7 +147,7 @@ private:
|
||||
uint8_t ttl;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
mpls_header header_;
|
||||
};
|
||||
|
||||
@@ -494,19 +494,16 @@ protected:
|
||||
* is calculated.
|
||||
*
|
||||
* By default, this method does nothing
|
||||
*
|
||||
* \param parent The parent PDU.
|
||||
*/
|
||||
virtual void prepare_for_serialize(const PDU* parent);
|
||||
virtual void prepare_for_serialize();
|
||||
|
||||
/**
|
||||
* \brief Serializes this PDU and propagates this action to child PDUs.
|
||||
*
|
||||
* \param buffer The buffer in which to store this PDU's serialization.
|
||||
* \param total_sz The total size of the buffer.
|
||||
* \param parent The parent PDU. Will be 0 if there's the parent does not exist.
|
||||
*/
|
||||
void serialize(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void serialize(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* \brief Serializes this TCP PDU.
|
||||
@@ -515,9 +512,8 @@ protected:
|
||||
* serialization.
|
||||
* \param buffer The buffer in which the PDU will be serialized.
|
||||
* \param total_sz The size available in the buffer.
|
||||
* \param parent The PDU that's one level below this one on the stack. Might be 0.
|
||||
*/
|
||||
virtual void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) = 0;
|
||||
virtual void write_serialization(uint8_t* buffer, uint32_t total_sz) = 0;
|
||||
private:
|
||||
void parent_pdu(PDU* parent);
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
return cached_.pdu_type();
|
||||
}
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz) {
|
||||
if (cached_serialization_.size() != total_sz) {
|
||||
cached_serialization_ = cached_.serialize();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
uint8_t ecommand[20];
|
||||
};
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
pktap_header header_;
|
||||
};
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
return new PPI(*this);
|
||||
}
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
void parse_80211(const uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
struct ppi_header {
|
||||
|
||||
@@ -390,7 +390,7 @@ public:
|
||||
*/
|
||||
std::string generic_error() const;
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
template<typename T>
|
||||
void add_tag_iterable(TagTypes id, const T& data) {
|
||||
|
||||
@@ -486,7 +486,7 @@ private:
|
||||
} TINS_END_PACK;
|
||||
|
||||
void init();
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
uint32_t find_extra_flag_fields_size(const uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
template <size_t n>
|
||||
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
return new RawPDU(*this);
|
||||
}
|
||||
private:
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
payload_type payload_;
|
||||
};
|
||||
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
uint16_t protocol;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
sll_header header_;
|
||||
};
|
||||
|
||||
@@ -177,7 +177,7 @@ private:
|
||||
uint16_t eth_type;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
snap_header snap_;
|
||||
};
|
||||
|
||||
@@ -305,7 +305,7 @@ private:
|
||||
static bpdu_id_type convert(const pvt_bpdu_id& id);
|
||||
static pvt_bpdu_id convert(const bpdu_id_type& id);
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
stp_header header_;
|
||||
};
|
||||
|
||||
@@ -610,7 +610,7 @@ private:
|
||||
}
|
||||
|
||||
void internal_add_option(const option& option);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
void checksum(uint16_t new_check);
|
||||
void update_options_size();
|
||||
options_type::const_iterator search_option_iterator(OptionTypes type) const;
|
||||
|
||||
@@ -191,7 +191,7 @@ private:
|
||||
uint16_t check;
|
||||
} TINS_END_PACK;
|
||||
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent);
|
||||
void write_serialization(uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
udp_header header_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user