ddc
Public Member Functions | Public Attributes | List of all members
CSocketAddr Struct Reference

#include <string_socket.h>

Public Member Functions

 CSocketAddr (SocketTypeEnum sockType=stUnknown, const string &sockAddr="", int sockPort=-1)
 
 CSocketAddr (const CSocketAddr &X)
 
 CSocketAddr (const string &Str, bool parsePort=true)
 
CSocketAddroperator= (const CSocketAddr &X)
 
void Clear ()
 
bool IsValid () const
 
 operator bool () const
 
void ParseSocketAddr (const string &Str, bool parsePort=true)
 
void ParseAddrPort ()
 
string toString () const
 

Public Attributes

SocketTypeEnum m_Type
 socket domain More...
 
string m_Addr
 unix:filesystem path, tcp:host address More...
 
int m_Port
 unix:filler, tcp:port number More...
 

Detailed Description

wrapper structure for abstract socket address parameters

Constructor & Destructor Documentation

◆ CSocketAddr() [1/3]

CSocketAddr::CSocketAddr ( SocketTypeEnum  sockType = stUnknown,
const string &  sockAddr = "",
int  sockPort = -1 
)
inline

default constructor

◆ CSocketAddr() [2/3]

CSocketAddr::CSocketAddr ( const CSocketAddr X)
inline

copy constructor

◆ CSocketAddr() [3/3]

CSocketAddr::CSocketAddr ( const string &  Str,
bool  parsePort = true 
)
inline

constructor from string

References ParseSocketAddr().

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

CSocketAddr& CSocketAddr::operator= ( const CSocketAddr X)
inline

assignment operator

References Clear(), IsValid(), m_Addr, m_Port, and m_Type.

Here is the call graph for this function:

◆ Clear()

void CSocketAddr::Clear ( )

clear address parameters

References m_Addr, m_Port, m_Type, and stUnknown.

Referenced by operator=(), and CHost::ReadFromString().

Here is the caller graph for this function:

◆ IsValid()

bool CSocketAddr::IsValid ( ) const

does this address look kosher?

References m_Addr, m_Port, m_Type, stINET, and stUNIX.

Referenced by CHost::CheckValidAddr(), operator bool(), and operator=().

Here is the caller graph for this function:

◆ operator bool()

CSocketAddr::operator bool ( ) const
inline

◆ ParseSocketAddr()

void CSocketAddr::ParseSocketAddr ( const string &  Str,
bool  parsePort = true 
)

parse m_Type and m_Addr from Str. Implicitly calls ParseSocketPort() if parsePort is true. Supported notation:

  • ADDR - INET socket on ADDR
  • tcp://ADDR_PORT - INET socket on ADDR, with explicit scheme
  • /PATH - UNIX socket on absolute path /PATH
  • unix://PATH - UNIX socket on PATH
  • unix:PATH - ditto

References m_Addr, m_Type, ParseAddrPort(), StartsWith(), stINET, stolower(), and stUNIX.

Referenced by CSocketAddr(), operator bool(), and CHost::ReadFromString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseAddrPort()

void CSocketAddr::ParseAddrPort ( )

extract m_Port from m_Addr. Supported notation:

  • ADDR:PORT - INET socket on ADDR:PORT
  • ADDR PORT - same

References m_Addr, m_Port, and TrimRight().

Referenced by operator bool(), and ParseSocketAddr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

string CSocketAddr::toString ( void  ) const

return a URL-style string representation of this address

References Format(), m_Addr, m_Port, m_Type, stINET, and stUNIX.

Referenced by CHost::GetAddressStr(), and operator bool().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_Type

SocketTypeEnum CSocketAddr::m_Type

◆ m_Addr

string CSocketAddr::m_Addr

◆ m_Port

int CSocketAddr::m_Port

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