StormByte C++ Library: Network module 1.1.0
StormByte-Network is the C++26 networking module of the StormByte suite.
Loading...
Searching...
No Matches
Namespaces | Typedefs | Enumerations | Functions
StormByte::Network::Connection Namespace Reference

Connection types of the Network module. More...

Namespaces

namespace  Read
 Read-side result codes.
 
namespace  Write
 Write-side result codes.
 

Typedefs

using HandlerType = int
 Native socket handle (POSIX)
 

Enumerations

enum class  Protocol : int { IPv4 = AF_INET , IPv6 = AF_INET6 }
 Address family for sockets. More...
 
enum class  Status : unsigned short {
  Connected , Disconnected , Connecting , Disconnecting ,
  Negotiating , Rejected , PeerClosed , Error
}
 Lifecycle of a connection or listener. More...
 

Functions

constexpr std::string ProtocolString (const Protocol &protocol) noexcept
 Protocol as text.
 
constexpr int ProtocolInt (const Protocol &protocol) noexcept
 Protocol as AF_* integer.
 
constexpr std::string ToString (const StormByte::Network::Connection::Read::Result &result) noexcept
 Read result as text.
 
constexpr std::string ToString (const StormByte::Network::Connection::Write::Result &result) noexcept
 Write result as text.
 
constexpr std::string StatusToString (const Status &status)
 Status as text.
 
constexpr bool IsConnected (const Status &status) noexcept
 Whether the connection is usable for I/O (Connected or Negotiating).
 

Detailed Description

Connection types of the Network module.

Typedef Documentation

◆ HandlerType

Native socket handle (POSIX)

Enumeration Type Documentation

◆ Protocol

Address family for sockets.

Enumerator
IPv4 

IPv4 (AF_INET)

IPv6 

IPv6 (AF_INET6)

◆ Status

enum class StormByte::Network::Connection::Status : unsigned short
strong

Lifecycle of a connection or listener.

Enumerator
Connected 

Connection established.

Disconnected 

Closed / idle.

Connecting 

Connect or listen in progress.

Disconnecting 

Shutdown in progress.

Negotiating 

Application-level handshake.

Rejected 

Peer or local rejection.

PeerClosed 

Peer closed the connection.

Error 

Error state.

Function Documentation

◆ IsConnected()

constexpr bool StormByte::Network::Connection::IsConnected ( const Status status)
constexprnoexcept

Whether the connection is usable for I/O (Connected or Negotiating).

Parameters
statusStatus value.
Returns
true if usable.

◆ ProtocolInt()

constexpr int StormByte::Network::Connection::ProtocolInt ( const Protocol protocol)
constexprnoexcept

Protocol as AF_* integer.

Parameters
protocolProtocol value.
Returns
AF_INET or AF_INET6.

◆ ProtocolString()

constexpr std::string StormByte::Network::Connection::ProtocolString ( const Protocol protocol)
constexprnoexcept

Protocol as text.

Parameters
protocolProtocol value.
Returns
"IPv4", "IPv6", or "Unknown".

◆ StatusToString()

constexpr std::string StormByte::Network::Connection::StatusToString ( const Status status)
constexpr

Status as text.

Parameters
statusStatus value.
Returns
Human-readable name.

◆ ToString() [1/2]

constexpr std::string StormByte::Network::Connection::ToString ( const StormByte::Network::Connection::Read::Result result)
constexprnoexcept

Read result as text.

Parameters
resultRead result.
Returns
Human-readable name.

◆ ToString() [2/2]

constexpr std::string StormByte::Network::Connection::ToString ( const StormByte::Network::Connection::Write::Result result)
constexprnoexcept

Write result as text.

Parameters
resultWrite result.
Returns
Human-readable name.