Flow 1.0.1
Flow project: Full implementation reference.
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Friends | List of all members
flow::net_flow::Syn_packet Struct Reference

Internal net_flow struct that encapsulates the Flow-protocol low-level SYN packet. More...

#include <low_lvl_packet.hpp>

Inheritance diagram for flow::net_flow::Syn_packet:
[legend]
Collaboration diagram for flow::net_flow::Syn_packet:
[legend]

Public Member Functions

size_t serialize_to_raw_data (Const_buffer_sequence *raw_bufs) const override
 Implements Low_lvl_packet API. More...
 
- Public Member Functions inherited from flow::net_flow::Low_lvl_packet
virtual size_t serialize_to_raw_data (Const_buffer_sequence *raw_bufs) const =0
 Serializes the current logical packet data from *this into the given Const_buffer_sequence, which is a sequence of pointers and lengths of existing scattered areas in memory, presumably for transmission over the wire to a compatible serializing Node. More...
 
size_t serialize_to_raw_data_and_log (Const_buffer_sequence *raw_bufs) const
 Identical to serialize_to_raw_data() but adds log-level-appropriate logging after the operation. More...
 
- Public Member Functions inherited from flow::util::Null_interface
virtual ~Null_interface ()=0
 Boring virtual destructor. More...
 
- Public Member Functions inherited from flow::log::Log_context
 Log_context (Logger *logger=0)
 Constructs Log_context by storing the given pointer to a Logger and a null Component. More...
 
template<typename Component_payload >
 Log_context (Logger *logger, Component_payload component_payload)
 Constructs Log_context by storing the given pointer to a Logger and a new Component storing the specified generically typed payload (an enum value). More...
 
 Log_context (const Log_context &src)
 Copy constructor that stores equal Logger* and Component values as the source. More...
 
 Log_context (Log_context &&src)
 Move constructor that makes this equal to src, while the latter becomes as-if default-constructed. More...
 
Log_contextoperator= (const Log_context &src)
 Assignment operator that behaves similarly to the copy constructor. More...
 
Log_contextoperator= (Log_context &&src)
 Move assignment operator that behaves similarly to the move constructor. More...
 
void swap (Log_context &other)
 Swaps Logger pointers and Component objects held by *this and other. More...
 
Loggerget_logger () const
 Returns the stored Logger pointer, particularly as many FLOW_LOG_*() macros expect. More...
 
const Componentget_log_component () const
 Returns reference to the stored Component object, particularly as many FLOW_LOG_*() macros expect. More...
 

Public Attributes

Sequence_number m_init_seq_num
 The Initial Sequence Number (ISN) of the sequence number line that the sender of this SYN will be using in Data_packets over this connection, if it succeeds. More...
 
util::Blob m_serialized_metadata
 Arbitrary serialized user-supplied metadata to send in SYN, where it can be deserialized by the user on the other side. More...
 
- Public Attributes inherited from flow::net_flow::Low_lvl_packet
bool m_opt_rexmit_on
 Option indicating whether this connection is using retransmission or not. More...
 
struct {
   flow_port_t   m_src_port
 Flow-protocol port # of socket in sending Node. More...
 
   flow_port_t   m_dst_port
 Flow-protocol port # of socket in receiving Node. More...
 
m_packed
 Packed group affected by #pragma pack.
 
const Function< std::ostream &(std::ostream &)> m_type_ostream_manip
 ostream manipulator (argument to ostream <<) that will output packet's type ("ACK", "RST", etc.). More...
 
const Function< std::ostream &(std::ostream &)> m_verbose_ostream_manip
 ostream manipulator (argument to ostream <<) that will output packet info suitable for DATA log level. More...
 
const Function< std::ostream &(std::ostream &)> m_concise_ostream_manip
 ostream manipulator (argument to ostream <<) that will output packet info suitable for TRACE log level. More...
 

Static Public Attributes

static const uint8_t S_RAW_TYPE_ID
 In serialized packet, the type ID byte identifying this as a SYN packet. Must not equal any other packet type's. More...
 

Private Member Functions

 Syn_packet (log::Logger *logger_ptr)
 The implementation of Low_lvl_packet::create_uninit_packet() for this sub-type of Low_lvl_packet. More...
 
std::ostream & to_ostream (std::ostream &os, bool verbose) const override
 Implements Low_lvl_packet API. More...
 
bool deserialize_type_specific_data_from_raw_data_packet (Const_buffer *raw_buf, bool prefer_no_move, util::Blob *raw_packet) override
 Implements Low_lvl_packet API. More...
 

Friends

boost::shared_ptr< Syn_packetLow_lvl_packet::create_uninit_packet (log::Logger *)
 Friend of Syn_packet: For access to private constructor Syn_packet(Logger*).
 

Additional Inherited Members

- Public Types inherited from flow::net_flow::Low_lvl_packet
using Const_buffer = boost::asio::const_buffer
 Short-hand for boost.asio immutable buffer, which essentially is a pointer to and length of a memory area. More...
 
using Const_buffer_sequence = std::vector< Const_buffer >
 Short-hand for sequence of immutable buffers; i.e., a sequence of 1 or more scattered areas in memory. More...
 
using security_token_t = uint64_t
 Type used for m_security_token member of a couple different packet types. More...
 
using rexmit_id_t = uint8_t
 Type used to store the retransmission count in DATA and ACK packets. More...
 
using rcv_wnd_t = uint32_t
 Type used to store the size of m_rcv_wnd member in a couple of different packet types. More...
 
- Public Types inherited from flow::util::Shared_ptr_alias_holder< boost::shared_ptr< Low_lvl_packet > >
using Ptr = boost::shared_ptr< Low_lvl_packet >
 Short-hand for ref-counted pointer to mutable values of type Target_type::element_type (a-la T*). More...
 
using Const_ptr = Const_target_ptr
 Short-hand for ref-counted pointer to immutable values of type Target_type::element_type (a-la T const *). More...
 
- Static Public Member Functions inherited from flow::net_flow::Low_lvl_packet
template<typename Low_lvl_packet_sub >
static boost::shared_ptr< Low_lvl_packet_sub > create_uninit_packet (log::Logger *logger_ptr)
 Constructs packet with uninitialized (essentially random) values, of the Low_lvl_packet sub-type specified as the template parameter (Ack_packet, Rst_packet, etc.). More...
 
template<typename Low_lvl_packet_sub >
static Ptr create_uninit_packet_base (log::Logger *logger_ptr)
 A simple convenience method that casts the result of create_uninit_packet() from shared_ptr<T>, where T is a sub-type of Low_lvl_packet, to shared_ptr<Low_lvl_packet> a/k/a Ptr. More...
 
static Ptr create_from_raw_data_packet (log::Logger *logger_ptr, util::Blob *raw_packet, bool prefer_no_move)
 Constructs packet on the heap with values determined by the given raw binary data as presumably received from the wire and originally serialized by a compatible serializing Node. More...
 
static const std::string & type_id_to_str (const std::type_index &type_id)
 Returns a brief (a few characters) string description of the given packet type given as type_index(typeid(p)), where p is a reference to an instance of a concrete Low_lvl_packet sub-type. More...
 
- Static Public Member Functions inherited from flow::util::Shared_ptr_alias_holder< boost::shared_ptr< Low_lvl_packet > >
static Ptr ptr_cast (const From_ptr &ptr_to_cast)
 Provides syntactic-sugary way to perform a static_pointer_cast<> from a compatible smart pointer type From_ptr, typically From_ptr::element_type being in the same class hierarchy as Target_ptr::element_type. More...
 
static Const_ptr const_ptr_cast (const From_ptr &ptr_to_cast)
 Identical to ptr_cast() but adds const-ness (immutability) to the pointed-to type. More...
 
static Ptr dynamic_ptr_cast (const From_ptr &ptr_to_cast)
 Equivalent to ptr_cast() but a dynamic_pointer_cast instead of static. More...
 
static Const_ptr dynamic_const_ptr_cast (const From_ptr &ptr_to_cast)
 Identical to const_ptr_cast() but a dynamic_pointer_cast instead of static. More...
 
- Protected Member Functions inherited from flow::net_flow::Low_lvl_packet
 Low_lvl_packet (log::Logger *logger_ptr)
 Constructs packet with uninitialized (essentially random) values. More...
 
size_t serialize_common_header_to_raw_data (Const_buffer_sequence *raw_bufs) const
 Helper for serialize_to_raw_data() implementations in sub-types that encodes the header common to all packet types, starting with the packet type ID leading that header. More...
 
virtual std::ostream & to_ostream (std::ostream &os, bool verbose=false) const
 Writes a multi-line representation of *this to an output stream. More...
 
- Static Protected Member Functions inherited from flow::net_flow::Low_lvl_packet
static constexpr bool native_is_big_endian ()
 Returns true, at compile time, if and only if the native memory representation is big-endian, meaning, for example, the value uint32_t(1) is stored as the bytes, in order, 0x00 0x00 0x00 0x01, and not the reverse. More...
 

Detailed Description

Internal net_flow struct that encapsulates the Flow-protocol low-level SYN packet.

See Low_lvl_packet doc header for information common to all low-level packets including this one.

A SYN packet is sent by the actively connecting peer to a passively listening server socket. Thus a SYN arises from the Node that performs Node::connect...(). In response, a Syn_ack_packet is expected.

Definition at line 582 of file low_lvl_packet.hpp.

Constructor & Destructor Documentation

◆ Syn_packet()

flow::net_flow::Syn_packet::Syn_packet ( log::Logger logger_ptr)
explicitprivate

The implementation of Low_lvl_packet::create_uninit_packet() for this sub-type of Low_lvl_packet.

Parameters
logger_ptrLogger to use subsequently.

Definition at line 69 of file low_lvl_packet.cpp.

Member Function Documentation

◆ deserialize_type_specific_data_from_raw_data_packet()

bool flow::net_flow::Syn_packet::deserialize_type_specific_data_from_raw_data_packet ( Const_buffer raw_buf,
bool  prefer_no_move,
util::Blob raw_packet 
)
overrideprivatevirtual

◆ serialize_to_raw_data()

size_t flow::net_flow::Syn_packet::serialize_to_raw_data ( Const_buffer_sequence raw_bufs) const
overridevirtual

Implements Low_lvl_packet API.

See that super-method's doc header.

Parameters
raw_bufsSee Low_lvl_packet::serialize_to_raw_data().
Returns
See Low_lvl_packet::serialize_to_raw_data().

Implements flow::net_flow::Low_lvl_packet.

Definition at line 199 of file low_lvl_packet.cpp.

◆ to_ostream()

std::ostream & flow::net_flow::Syn_packet::to_ostream ( std::ostream &  os,
bool  verbose 
) const
overrideprivatevirtual

Implements Low_lvl_packet API.

See that super-method's doc header.

Parameters
osSee Low_lvl_packet::to_ostream().
verboseSee Low_lvl_packet::to_ostream().
Returns
os.

Reimplemented from flow::net_flow::Low_lvl_packet.

Definition at line 925 of file low_lvl_packet.cpp.

References flow::util::buffers_to_ostream(), and flow::net_flow::Low_lvl_packet::to_ostream().

Here is the call graph for this function:

Member Data Documentation

◆ m_init_seq_num

Sequence_number flow::net_flow::Syn_packet::m_init_seq_num

The Initial Sequence Number (ISN) of the sequence number line that the sender of this SYN will be using in Data_packets over this connection, if it succeeds.

All bytes actually sent by the SYN sender will start with this ISN + 1 and increment by 1 for each byte in the stream further. A retransmission of a given datum starting with sequence number S will still start with sequence number S.

Definition at line 593 of file low_lvl_packet.hpp.

Referenced by deserialize_type_specific_data_from_raw_data_packet().

◆ m_serialized_metadata

util::Blob flow::net_flow::Syn_packet::m_serialized_metadata

Arbitrary serialized user-supplied metadata to send in SYN, where it can be deserialized by the user on the other side.

Todo:
Possibly eliminate this, since NetFlow is reliable; the metadata can just be sent explicitly by the user once the connection is established. However, for now reliability is optional.

Definition at line 602 of file low_lvl_packet.hpp.

Referenced by deserialize_type_specific_data_from_raw_data_packet().

◆ S_RAW_TYPE_ID

const uint8_t flow::net_flow::Syn_packet::S_RAW_TYPE_ID
static

In serialized packet, the type ID byte identifying this as a SYN packet. Must not equal any other packet type's.

Definition at line 610 of file low_lvl_packet.hpp.


The documentation for this struct was generated from the following files: