neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize > Class Template Reference

#include <packet_stream.hpp>

Inheritance diagram for neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >:
neolib::lifetime< Base > neolib::i_basic_packet_connection_owner< PacketType::character_type > neolib::i_lifetime

Public Types

typedef PacketType packet_type
 
typedef Protocol protocol_type
 
typedef std::unique_ptr< packet_streampointer
 
typedef i_basic_packet< typename packet_type::character_type > generic_packet_type
 
typedef packet_type::clone_pointer packet_clone_pointer
 
typedef basic_packet_connection< typename packet_type::character_type, Protocol, ReceiveBufferSizeconnection_type
 
typedef std::unique_ptr< packet_typequeue_item
 
typedef std::unique_ptr< packet_typeorphaned_queue_item
 
typedef std::vector< queue_itemsend_queue
 
- Public Types inherited from neolib::lifetime< Base >
typedef neolib::destroyed_flag destroyed_flag
 

Public Member Functions

 define_event (ConnectionEstablished, connection_established) define_event(ConnectionFailure
 
const boost::system::error_code & define_event (PacketSent, packet_sent, const packet_type &) define_event(PacketArrived
 
const boost::system::error_code const packet_typedefine_event (TransferFailure, transfer_failure, const boost::system::error_code &) define_event(ConnectionClosed
 
 packet_stream (i_async_task &aIoTask, bool aSecure=false, protocol_family aProtocolFamily=IPv4)
 
 packet_stream (i_async_task &aIoTask, const std::string &aHostName, unsigned short aPort, bool aSecure=false, protocol_family aProtocolFamily=IPv4)
 
 ~packet_stream ()
 
 packet_stream (const packet_stream &aRhs)=delete
 
packet_streamoperator= (const packet_stream &aRhs)=delete
 
bool open (const std::string &aRemoteHostName, unsigned short aRemotePort, bool aSecure=false, protocol_family aProtocolFamily=IPv4)
 
bool opened () const
 
void close ()
 
void send_packet (const packet_type &aPacket, bool aHighPriority=false)
 
bool connected () const
 
bool closed () const
 
bool has_error () const
 
std::string error () const
 
int error_code () const
 
const connection_typeconnection () const
 
connection_typeconnection ()
 
bool underflow () const
 
- Public Member Functions inherited from neolib::lifetime< Base >
 lifetime (lifetime_state aState=lifetime_state::Alive)
 
virtual ~lifetime ()
 
lifetime_state object_state () const final
 
std::shared_ptr< std::atomic< lifetime_state > > object_state_ptr () const final
 
bool is_creating () const final
 
bool is_alive () const final
 
bool is_destroying () const final
 
bool is_destroyed () const final
 
void set_alive () override
 
void set_destroying () override
 
void set_destroyed () override
 
- Public Member Functions inherited from neolib::i_lifetime
virtual ~i_lifetime ()=default
 

Public Attributes

 connection_failure
 
const boost::system::error_code packet_arrived
 

Detailed Description

template<typename PacketType, typename Protocol, size_t ReceiveBufferSize = 1024>
class neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >

Definition at line 52 of file packet_stream.hpp.

Member Typedef Documentation

◆ connection_type

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
typedef basic_packet_connection<typename packet_type::character_type, Protocol, ReceiveBufferSize> neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::connection_type

Definition at line 61 of file packet_stream.hpp.

◆ generic_packet_type

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
typedef i_basic_packet<typename packet_type::character_type> neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::generic_packet_type

Definition at line 59 of file packet_stream.hpp.

◆ orphaned_queue_item

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
typedef std::unique_ptr<packet_type> neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::orphaned_queue_item

Definition at line 63 of file packet_stream.hpp.

◆ packet_clone_pointer

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
typedef packet_type::clone_pointer neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::packet_clone_pointer

Definition at line 60 of file packet_stream.hpp.

◆ packet_type

Definition at line 56 of file packet_stream.hpp.

◆ pointer

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
typedef std::unique_ptr<packet_stream> neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::pointer

Definition at line 58 of file packet_stream.hpp.

◆ protocol_type

Definition at line 57 of file packet_stream.hpp.

◆ queue_item

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
typedef std::unique_ptr<packet_type> neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::queue_item

Definition at line 62 of file packet_stream.hpp.

◆ send_queue

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
typedef std::vector<queue_item> neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::send_queue

Definition at line 64 of file packet_stream.hpp.

Constructor & Destructor Documentation

◆ packet_stream() [1/3]

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::packet_stream ( i_async_task aIoTask,
bool  aSecure = false,
protocol_family  aProtocolFamily = IPv4 
)
inline

Definition at line 77 of file packet_stream.hpp.

◆ packet_stream() [2/3]

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::packet_stream ( i_async_task aIoTask,
const std::string &  aHostName,
unsigned short  aPort,
bool  aSecure = false,
protocol_family  aProtocolFamily = IPv4 
)
inline

Definition at line 81 of file packet_stream.hpp.

◆ ~packet_stream()

Definition at line 85 of file packet_stream.hpp.

◆ packet_stream() [3/3]

Member Function Documentation

◆ close()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
void neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::close ( )
inline

Definition at line 102 of file packet_stream.hpp.

◆ closed()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
bool neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::closed ( ) const
inline

Definition at line 116 of file packet_stream.hpp.

◆ connected()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
bool neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::connected ( ) const
inline

Definition at line 112 of file packet_stream.hpp.

◆ connection() [1/2]

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
connection_type & neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::connection ( )
inline

Definition at line 136 of file packet_stream.hpp.

◆ connection() [2/2]

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
const connection_type & neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::connection ( ) const
inline

Definition at line 132 of file packet_stream.hpp.

◆ define_event() [1/3]

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::define_event ( ConnectionEstablished  ,
connection_established   
)

◆ define_event() [2/3]

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
const boost::system::error_code & neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::define_event ( PacketSent  ,
packet_sent  ,
const packet_type  
)

◆ define_event() [3/3]

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
const boost::system::error_code const packet_type & neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::define_event ( TransferFailure  ,
transfer_failure  ,
const boost::system::error_code &   
)

◆ error()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
std::string neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::error ( ) const
inline

Definition at line 124 of file packet_stream.hpp.

◆ error_code()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
int neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::error_code ( ) const
inline

Definition at line 128 of file packet_stream.hpp.

◆ has_error()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
bool neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::has_error ( ) const
inline

Definition at line 120 of file packet_stream.hpp.

◆ open()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
bool neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::open ( const std::string &  aRemoteHostName,
unsigned short  aRemotePort,
bool  aSecure = false,
protocol_family  aProtocolFamily = IPv4 
)
inline

Definition at line 94 of file packet_stream.hpp.

◆ opened()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
bool neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::opened ( ) const
inline

Definition at line 98 of file packet_stream.hpp.

◆ operator=()

◆ send_packet()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
void neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::send_packet ( const packet_type aPacket,
bool  aHighPriority = false 
)
inline

Definition at line 107 of file packet_stream.hpp.

◆ underflow()

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
bool neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::underflow ( ) const
inline

Definition at line 140 of file packet_stream.hpp.

Member Data Documentation

◆ connection_failure

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::connection_failure

Definition at line 69 of file packet_stream.hpp.

◆ packet_arrived

template<typename PacketType , typename Protocol , size_t ReceiveBufferSize = 1024>
const boost::system::error_code neolib::packet_stream< PacketType, Protocol, ReceiveBufferSize >::packet_arrived

Definition at line 71 of file packet_stream.hpp.


The documentation for this class was generated from the following file: