Flow 1.0.0
Flow project: Public API.
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
flow::net_flow Namespace Reference

Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream protocol that uses UDP as underlying transport. More...

Namespaces

namespace  asio
 Contains classes that add boost.asio integration to the main Flow-protocol classes such as net_flow::Node and net_flow::Peer_socket, so that net_flow sockets can be easily used in boost.asio-driven event loops, e.g., ones also performing TCP networking and scheduling timers.
 
namespace  error
 Namespace containing the net_flow module's extension of boost.system error conventions, so that Flow network protocol API can return codes/messages from within its own new set of error codes/messages.
 

Classes

class  Event_set
 A user-set collection of sockets and desired conditions on those sockets (such as: "socket has data to read"), with the ability to wait for those conditions to become true and signal the user when so. More...
 
class  Net_env_simulator
 Objects of this class can be fed to Node to make it internally simulate network conditions like loss, latency, and data duplication. More...
 
class  Node
 An object of this class is a single Flow-protocol networking node, in the sense that: (1) it has a distinct IP address and UDP port; and (2) it speaks the Flow protocol over a UDP transport layer. More...
 
struct  Node_options
 A set of low-level options affecting a single Flow Node, including Peer_socket objects and other objects subsequently generated by that Flow Node. More...
 
class  Peer_socket
 A peer (non-server) socket operating over the Flow network protocol, with optional stream-of-bytes and reliability support. More...
 
struct  Peer_socket_info
 A data store that keeps stats about the a Peer_socket connection. More...
 
struct  Peer_socket_options
 A set of low-level options affecting a single Peer_socket. More...
 
struct  Peer_socket_receive_stats
 A data store that keeps stats about the incoming direction of a Peer_socket connection to another Flow-protocol Peer_socket. More...
 
class  Peer_socket_send_stats
 A data store that keeps stats about the outgoing direction of a Peer_socket connection to another Flow-protocol Peer_socket. More...
 
struct  Remote_endpoint
 Represents the remote endpoint of a Flow-protocol connection; identifies the UDP endpoint of the remote Node and the logical Flow-protocol port within that Node. More...
 
class  Server_socket
 A server socket able to listen on a single Flow port for incoming connections and return peer sockets (Peer_socket objects) to the local user once such connections are established. More...
 

Typedefs

using flow_port_t = uint16_t
 Logical Flow port type (analogous to a UDP/TCP port in spirit but in no way relevant to UDP/TCP).
 

Enumerations

enum class  Xfer_op_result { S_FULLY_XFERRED , S_PARTIALLY_XFERRED , S_ERROR }
 Result of a send or receive operation, used at least in stat reporting. More...
 

Functions

bool operator== (const Remote_endpoint &lhs, const Remote_endpoint &rhs)
 Whether lhs is equal to rhs. More...
 
std::ostream & operator<< (std::ostream &os, const Remote_endpoint &endpoint)
 Prints string representation of the given Remote_endpoint to the given ostream. More...
 
size_t hash_value (const Remote_endpoint &remote_endpoint)
 Free function that returns remote_endpoint.hash(); has to be a free function named hash_value for boost.hash to pick it up. More...
 
std::ostream & operator<< (std::ostream &os, Event_set::State state)
 Prints string representation of given Event_set state to given standard ostream and returns the latter. More...
 
std::ostream & operator<< (std::ostream &os, Event_set::Event_type ev_type)
 Prints string representation of given event type to given standard ostream and returns the latter. More...
 
std::ostream & operator<< (std::ostream &os, const Peer_socket_receive_stats &stats)
 Prints string representation of the stats in the given stats object to the standard ostream and returns the latter. More...
 
std::ostream & operator<< (std::ostream &os, const Peer_socket_send_stats &stats)
 Prints string representation of the stats in the given stats object to the standard ostream and returns the latter. More...
 
std::ostream & operator<< (std::ostream &os, const Peer_socket_info &stats)
 Prints string representation of the stats in the given stats object to the standard ostream and returns the latter. More...
 
std::ostream & operator<< (std::ostream &os, const Peer_socket *sock)
 Prints string representation of given socket to given standard ostream and returns the latter. More...
 
std::ostream & operator<< (std::ostream &os, const Server_socket *serv)
 Prints string representation of given socket to given standard ostream and returns the latter. More...
 
std::ostream & operator<< (std::ostream &os, const Node_options &opts)
 Prints the name of each option in the given Node_options, along with its current value, to the given ostream. More...
 
std::ostream & operator<< (std::ostream &os, const Peer_socket_options &opts)
 Prints the name of each option in the given Peer_socket_options, along with its current value, to the given ostream. More...
 
std::istream & operator>> (std::istream &is, Peer_socket_options::Congestion_control_strategy_choice &strategy_choice)
 Deserializes a Peer_socket_options::Congestion_control_strategy_choice enum from a standard input stream. More...
 
std::ostream & operator<< (std::ostream &os, const Peer_socket_options::Congestion_control_strategy_choice &strategy_choice)
 Serializes a Peer_socket_options::Congestion_control_strategy_choice enum to a standard ostream – the reverse of operator>>(). More...
 
std::ostream & operator<< (std::ostream &os, Server_socket::State state)
 Prints string representation of given socket state to given standard ostream and returns the latter. More...
 

Variables

const flow_port_t S_PORT_ANY
 Special Flow port value used to indicate "invalid port" or "please pick a random available ephemeral port," depending on the context. More...
 

Detailed Description

Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream protocol that uses UDP as underlying transport.

See the large doc header on class net_flow::Node for the "root" of all documentation w/r/t net_flow, beyond the present brief sentences.

Historical note

Historically, the Flow project only existed in the first place to deliver the functionality now in this namespace flow::net_flow. However, since then, net_flow has become merely one of several Flow modules, each providing functionality independent of the others'. In the past, all/most net_flow{} contents resided directly in namespace flow, but now it has been segregated into its own namespace.

net_flow may still be, by volume, the largest module (hence also perhaps the largest user of general-use modules like flow::log and flow::util). Nevertheless, it is no longer "special."

See also
Main class net_flow::Node.

Enumeration Type Documentation

◆ Xfer_op_result

enum class flow::net_flow::Xfer_op_result
strong

Result of a send or receive operation, used at least in stat reporting.

Enumerator
S_FULLY_XFERRED 

Bytes transferred equals bytes expected.

S_PARTIALLY_XFERRED 

Bytes transferred less than bytes expected.

S_ERROR 

Error occurred – probably no bytes transferred.

Function Documentation

◆ hash_value()

size_t hash_value ( const Remote_endpoint remote_endpoint)

Free function that returns remote_endpoint.hash(); has to be a free function named hash_value for boost.hash to pick it up.

Parameters
remote_endpointObject to hash.
Returns
remote_endpoint.hash().

◆ operator<<() [1/12]

std::ostream & flow::net_flow::operator<< ( std::ostream &  os,
const Node_options opts 
)

Prints the name of each option in the given Node_options, along with its current value, to the given ostream.

Parameters
osStream to which to serialize.
optsObject to serialize.
Returns
os.

◆ operator<<() [2/12]

std::ostream & flow::net_flow::operator<< ( std::ostream &  os,
const Peer_socket sock 
)

Prints string representation of given socket to given standard ostream and returns the latter.

The representation includes the local and remote endpoints and the hex pointer value.

Note
shared_ptr forwards ostream output to the underlying pointer type, so this will affect Ptr output as well.
Parameters
osStream to print to.
sockObject to serialize. May be null.
Returns
os.

◆ operator<<() [3/12]

std::ostream & operator<< ( std::ostream &  os,
const Peer_socket_info stats 
)

Prints string representation of the stats in the given stats object to the standard ostream and returns the latter.

The representation is multi-line but ends in no newline.

Parameters
osStream to which to print.
statsValue to serialize.
Returns
os.

◆ operator<<() [4/12]

std::ostream & flow::net_flow::operator<< ( std::ostream &  os,
const Peer_socket_options opts 
)

Prints the name of each option in the given Peer_socket_options, along with its current value, to the given ostream.

Parameters
osStream to which to serialize.
optsObject to serialize.
Returns
os.

◆ operator<<() [5/12]

std::ostream & operator<< ( std::ostream &  os,
const Peer_socket_options::Congestion_control_strategy_choice strategy_choice 
)

Serializes a Peer_socket_options::Congestion_control_strategy_choice enum to a standard ostream – the reverse of operator>>().

Writes a space-less token to the given stream based on the given strategy enum value. This enables a few key things to work, including output of defaults and values in the help via Peer_socket_options, and conversion to string via boost::lexical_cast.

Parameters
osStream to which to serialize.
strategy_choiceValue to serialize.
Returns
os.

◆ operator<<() [6/12]

std::ostream & operator<< ( std::ostream &  os,
const Peer_socket_receive_stats stats 
)

Prints string representation of the stats in the given stats object to the standard ostream and returns the latter.

The representation is multi-line but ends in no newline.

Parameters
osStream to which to print.
statsValue to serialize.
Returns
os.

◆ operator<<() [7/12]

std::ostream & operator<< ( std::ostream &  os,
const Peer_socket_send_stats stats 
)

Prints string representation of the stats in the given stats object to the standard ostream and returns the latter.

The representation is multi-line but ends in no newline.

Parameters
osStream to which to print.
statsValue to serialize.
Returns
os.

◆ operator<<() [8/12]

std::ostream & operator<< ( std::ostream &  os,
const Remote_endpoint endpoint 
)

Prints string representation of the given Remote_endpoint to the given ostream.

Parameters
osStream to which to write.
endpointEndpoint to serialize.
Returns
os.

◆ operator<<() [9/12]

std::ostream & flow::net_flow::operator<< ( std::ostream &  os,
const Server_socket serv 
)

Prints string representation of given socket to given standard ostream and returns the latter.

The representation includes the local endpoint and the hex pointer value.

Note
shared_ptr forwards ostream output to the underlying pointer type, so this will affect Ptr output as well.
Parameters
osStream to print to.
servObject to serialize. May be null.
Returns
os.

◆ operator<<() [10/12]

std::ostream & operator<< ( std::ostream &  os,
Event_set::Event_type  ev_type 
)

Prints string representation of given event type to given standard ostream and returns the latter.

Parameters
osStream to print to.
ev_typeValue to serialize.
Returns
os.

◆ operator<<() [11/12]

std::ostream & operator<< ( std::ostream &  os,
Event_set::State  state 
)

Prints string representation of given Event_set state to given standard ostream and returns the latter.

Parameters
osStream to print to.
stateValue to serialize.
Returns
os.

◆ operator<<() [12/12]

std::ostream & operator<< ( std::ostream &  os,
Server_socket::State  state 
)

Prints string representation of given socket state to given standard ostream and returns the latter.

Parameters
osStream to print to.
stateValue to serialize.
Returns
os.

◆ operator==()

bool operator== ( const Remote_endpoint lhs,
const Remote_endpoint rhs 
)

Whether lhs is equal to rhs.

Parameters
lhsObject to compare.
rhsObject to compare.
Returns
See above.

◆ operator>>()

std::istream & operator>> ( std::istream &  is,
Peer_socket_options::Congestion_control_strategy_choice strategy_choice 
)

Deserializes a Peer_socket_options::Congestion_control_strategy_choice enum from a standard input stream.

Reads a single space-delimited token from the given stream. Maps that token to an aforementioned enumeration value. If the token is not recognized or cannot be read, some reasonable default strategy is chosen. This enables a few key things to work, including parsing from config file/command line via and conversion from string via boost::lexical_cast.

Parameters
isStream from which to deserialize.
strategy_choiceReference to enum value which to set to the mapped strategy.
Returns
is.

Variable Documentation

◆ S_PORT_ANY

const flow_port_t flow::net_flow::S_PORT_ANY
extern

Special Flow port value used to indicate "invalid port" or "please pick a random available ephemeral port," depending on the context.

This is spiritually equivalent to TCP's port 0.