1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added RawPDU class. Removed payload member from TCP and UDP. They're not represented by RawPDUs.

This commit is contained in:
Matias
2011-08-13 17:22:01 -03:00
parent 398ba31111
commit 759139da3f
6 changed files with 161 additions and 36 deletions

View File

@@ -111,10 +111,6 @@ namespace Tins {
*/
inline uint16_t urg_ptr() const { return _tcp.urg_ptr; }
/** \brief Returns the payload.
*/
inline const uint8_t *payload() const { return _payload; }
/** \brief Set the destination port.
* \param new_dport New destination port.
*/
@@ -153,7 +149,10 @@ namespace Tins {
/** \brief Set the payload.
*
* Payload is NOT copied. Therefore, pointers provided as
* payloads must be freed manually by the user.
* payloads must be freed manually by the user. This actually
* creates a RawPDU that holds the payload, and sets it as the
* inner_pdu. Therefore, if an inner_pdu was set previously,
* a call to TCP::payload will delete it.
* \param new_payload New payload.
* \param new_payload_size New payload's size
*/
@@ -247,8 +246,7 @@ namespace Tins {
tcphdr _tcp;
std::vector<TCPOption> _options;
uint8_t *_payload;
uint32_t _payload_size, _options_size, _total_options_size;
uint32_t _options_size, _total_options_size;
};
};