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

Added an overload of add_option that takes an rvalue-ref in IP, TCP, DHCP, ICMPv6 and Dot11.

This commit is contained in:
Matias Fontanini
2013-03-24 00:08:53 -03:00
parent 584fe81f04
commit d7dd1e131f
12 changed files with 386 additions and 113 deletions

View File

@@ -41,6 +41,7 @@
#include "endianness.h"
#include "small_uint.h"
#include "pdu_option.h"
#include "cxxstd.h"
namespace Tins {
/**
@@ -355,11 +356,32 @@ namespace Tins {
/**
* \brief Adds a TCP option.
*
* \deprecated This function is deprecated. The overloads taking
* tcp_option should be used.
*
* \param option The option type flag to be set.
* \param length The length of this option(optional).
* \param data Pointer to this option's data(optional).
*/
void add_option(Option option, uint8_t length = 0, const uint8_t *data = 0);
TINS_DEPRECATED(void add_option(Option option, uint8_t length = 0, const uint8_t *data = 0));
/**
* \brief Adds a TCP option.
*
* \param option The option to be added.
*/
void add_option(const tcp_option &option);
#if TINS_IS_CXX11
/**
* \brief Adds a TCP option.
*
* This move-constructs the option.
*
* \param option The option to be added.
*/
void add_option(tcp_option &&option);
#endif
/**
* \brief Returns the header size.
@@ -437,7 +459,8 @@ namespace Tins {
return *(const T*)(&option->data_ptr()[0]);
throw option_not_found();
}
void internal_add_option(const tcp_option &option);
void write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *parent);
uint8_t *write_option(const tcp_option &opt, uint8_t *buffer);