OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Network2Address Class Reference

#include <C4Network2Address.h>

Public Member Functions

 C4Network2Address ()
 
 C4Network2Address (C4NetIO::addr_t addr, C4Network2IOProtocol eProtocol)
 
 C4Network2Address (const C4Network2Address &addr)
 
void operator= (const C4Network2Address &addr)
 
bool operator== (const C4Network2Address &addr) const
 
const C4NetIO::addr_tgetAddr () const
 
C4NetIO::addr_tgetAddr ()
 
bool isIPNull () const
 
uint16_t getPort () const
 
C4Network2IOProtocol getProtocol () const
 
StdStrBuf toString () const
 
void SetAddr (C4NetIO::addr_t naddr)
 
void SetIP (C4NetIO::addr_t ip)
 
void SetPort (uint16_t iPort)
 
void SetProtocol (C4Network2IOProtocol enProtocol)
 
void CompileFunc (StdCompiler *pComp)
 

Protected Attributes

C4NetIO::addr_t addr
 
C4Network2IOProtocol eProtocol
 

Detailed Description

Definition at line 22 of file C4Network2Address.h.

Constructor & Destructor Documentation

C4Network2Address::C4Network2Address ( )
inline

Definition at line 25 of file C4Network2Address.h.

26  : eProtocol(P_NONE)
27  { }
C4Network2IOProtocol eProtocol
C4Network2Address::C4Network2Address ( C4NetIO::addr_t  addr,
C4Network2IOProtocol  eProtocol 
)
inline

Definition at line 29 of file C4Network2Address.h.

30  : addr(addr.AsIPv4()), eProtocol(eProtocol)
31  { }
C4Network2IOProtocol eProtocol
EndpointAddress AsIPv4() const
Definition: C4NetIO.cpp:347
C4NetIO::addr_t addr
C4Network2Address::C4Network2Address ( const C4Network2Address addr)
inline

Definition at line 33 of file C4Network2Address.h.

34  : addr(addr.getAddr()), eProtocol(addr.getProtocol())
35  { }
C4Network2IOProtocol eProtocol
C4Network2IOProtocol getProtocol() const
const C4NetIO::addr_t & getAddr() const
C4NetIO::addr_t addr

Member Function Documentation

void C4Network2Address::CompileFunc ( StdCompiler pComp)

Definition at line 29 of file C4Network2Address.cpp.

References addr, C4NetIO::EndpointAddress::Clear(), eProtocol, StdCompiler::isDeserializer(), mkDefaultAdapt(), P_NONE, P_TCP, P_UDP, StdCompiler::SEP_PART2, StdCompiler::Separator(), and StdCompiler::Value().

30 {
31  // Clear
32  if (pComp->isDeserializer())
33  {
34  addr.Clear();
35  }
36 
37  // Write protocol
39  {
40  { "UDP", P_UDP },
41  { "TCP", P_TCP },
42 
43  { nullptr, P_NONE },
44  };
45  pComp->Value(mkEnumAdaptT<uint8_t>(eProtocol, Protocols));
46  pComp->Separator(StdCompiler::SEP_PART2); // ':'
47 
49 }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
Definition: StdAdaptors.h:760
C4Network2IOProtocol eProtocol
void Value(const T &rStruct)
Definition: StdCompiler.h:171
virtual bool isDeserializer()
Definition: StdCompiler.h:63
StdDefaultAdapt< T, D > mkDefaultAdapt(T &&rValue, const D &rDefault)
Definition: StdAdaptors.h:65
C4NetIO::addr_t addr

Here is the call graph for this function:

const C4NetIO::addr_t& C4Network2Address::getAddr ( ) const
inline

Definition at line 47 of file C4Network2Address.h.

References addr.

Referenced by C4Network2Client::DoConnectAttempt(), C4Network2ClientList::HandlePacket(), operator=(), operator==(), and C4Network2Client::SendAddresses().

47 { return addr; }
C4NetIO::addr_t addr

Here is the caller graph for this function:

C4NetIO::addr_t& C4Network2Address::getAddr ( )
inline

Definition at line 48 of file C4Network2Address.h.

References addr.

48 { return addr; }
C4NetIO::addr_t addr
uint16_t C4Network2Address::getPort ( ) const
inline

Definition at line 51 of file C4Network2Address.h.

References C4NetIO::EndpointAddress::GetPort().

51 { return addr.GetPort(); }
uint16_t GetPort() const
Definition: C4NetIO.cpp:548
C4NetIO::addr_t addr

Here is the call graph for this function:

C4Network2IOProtocol C4Network2Address::getProtocol ( ) const
inline

Definition at line 52 of file C4Network2Address.h.

References eProtocol.

Referenced by C4Network2Client::DoConnectAttempt(), operator=(), and operator==().

52 { return eProtocol; }
C4Network2IOProtocol eProtocol

Here is the caller graph for this function:

bool C4Network2Address::isIPNull ( ) const
inline

Definition at line 50 of file C4Network2Address.h.

References C4NetIO::EndpointAddress::IsNull().

Referenced by C4Network2ClientList::HandlePacket().

50 { return addr.IsNull(); }
bool IsNull() const
Definition: C4NetIO.cpp:509
C4NetIO::addr_t addr

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Network2Address::operator= ( const C4Network2Address addr)
inline

Definition at line 37 of file C4Network2Address.h.

References getAddr(), getProtocol(), SetAddr(), and SetProtocol().

38  { SetAddr(addr.getAddr()); SetProtocol(addr.getProtocol()); }
void SetProtocol(C4Network2IOProtocol enProtocol)
C4Network2IOProtocol getProtocol() const
void SetAddr(C4NetIO::addr_t naddr)
const C4NetIO::addr_t & getAddr() const

Here is the call graph for this function:

bool C4Network2Address::operator== ( const C4Network2Address addr) const

Definition at line 61 of file C4Network2Address.cpp.

References addr, eProtocol, getAddr(), and getProtocol().

62 {
63  return eProtocol == addr2.getProtocol() && addr == addr2.getAddr();
64 }
C4Network2IOProtocol eProtocol
const C4NetIO::addr_t & getAddr() const

Here is the call graph for this function:

void C4Network2Address::SetAddr ( C4NetIO::addr_t  naddr)
inline

Definition at line 56 of file C4Network2Address.h.

References C4NetIO::EndpointAddress::AsIPv4().

Referenced by operator=(), and C4Network2Reference::SetSourceAddress().

56 { addr = naddr.AsIPv4(); }
EndpointAddress AsIPv4() const
Definition: C4NetIO.cpp:347
C4NetIO::addr_t addr

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Network2Address::SetIP ( C4NetIO::addr_t  ip)
inline

Definition at line 58 of file C4Network2Address.h.

References C4NetIO::EndpointAddress::AsIPv4(), and C4NetIO::EndpointAddress::SetAddress().

Referenced by C4Network2ClientList::HandlePacket().

58 { addr.SetAddress(ip.AsIPv4()); }
void SetAddress(const sockaddr *addr)
Definition: C4NetIO.cpp:370
EndpointAddress AsIPv4() const
Definition: C4NetIO.cpp:347
C4NetIO::addr_t addr

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Network2Address::SetPort ( uint16_t  iPort)
inline

Definition at line 59 of file C4Network2Address.h.

References C4NetIO::EndpointAddress::SetPort().

59 { addr.SetPort(iPort); }
void SetPort(uint16_t port)
Definition: C4NetIO.cpp:532
C4NetIO::addr_t addr

Here is the call graph for this function:

void C4Network2Address::SetProtocol ( C4Network2IOProtocol  enProtocol)
inline

Definition at line 60 of file C4Network2Address.h.

Referenced by operator=().

60 { eProtocol = enProtocol; }
C4Network2IOProtocol eProtocol

Here is the caller graph for this function:

StdStrBuf C4Network2Address::toString ( ) const

Definition at line 51 of file C4Network2Address.cpp.

References addr, eProtocol, FormatString(), StdStrBuf::getData(), P_TCP, P_UDP, and C4NetIO::EndpointAddress::ToString().

Referenced by C4StartupNetListEntry::SetReference(), and C4Network2ClientDlg::UpdateText().

52 {
53  switch (eProtocol)
54  {
55  case P_UDP: return FormatString("UDP:%s", addr.ToString().getData());
56  case P_TCP: return FormatString("TCP:%s", addr.ToString().getData());
57  default: return StdStrBuf("INVALID");
58  }
59 }
const char * getData() const
Definition: StdBuf.h:450
C4Network2IOProtocol eProtocol
StdStrBuf ToString(int flags=0) const
Definition: C4NetIO.cpp:605
C4NetIO::addr_t addr
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

C4NetIO::addr_t C4Network2Address::addr
protected

Definition at line 43 of file C4Network2Address.h.

Referenced by CompileFunc(), getAddr(), operator==(), and toString().

C4Network2IOProtocol C4Network2Address::eProtocol
protected

Definition at line 44 of file C4Network2Address.h.

Referenced by CompileFunc(), getProtocol(), operator==(), and toString().


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