#include <C4Network2IO.h>
Classes | |
struct | PacketLogEntry |
Public Member Functions | |
C4Network2IOConnection () | |
~C4Network2IOConnection () | |
C4NetIO * | getNetClass () const |
C4Network2IOProtocol | getProtocol () const |
const C4NetIO::addr_t & | getPeerAddr () const |
const C4NetIO::addr_t & | getConnectAddr () const |
uint32_t | getID () const |
uint32_t | getRemoteID () const |
time_t | getTimestamp () const |
const C4ClientCore & | getCCore () const |
CStdCSec & | getCCoreCSec () |
int | getClientID () const |
bool | isHost () const |
int | getPingTime () const |
int | getLag () const |
int | getIRate () const |
int | getORate () const |
int | getPacketLoss () const |
const char * | getPassword () const |
bool | isConnSent () const |
uint32_t | getInPacketCounter () const |
uint32_t | getOutPacketCounter () const |
bool | isConnecting () const |
bool | isOpen () const |
bool | isHalfAccepted () const |
bool | isAccepted () const |
bool | isClosed () const |
bool | isAutoAccepted () const |
bool | isBroadcastTarget () const |
bool | isFailed () const |
void | SetHalfAccepted () |
void | SetAccepted () |
void | SetCCore (const C4ClientCore &nCCore) |
void | ResetAutoAccepted () |
void | SetConnSent () |
bool | Connect () |
void | Close () |
bool | Send (const C4NetIOPacket &rPkt) |
void | SetBroadcastTarget (bool fSet) |
void | DoStatistics (int iInterval, int *pIRateSum, int *pORateSum) |
void | AddRef () |
void | DelRef () |
bool | CreatePostMortem (class C4PacketPostMortem *pPkt) |
Protected Member Functions | |
void | Set (C4NetIO *pnNetClass, C4Network2IOProtocol eProt, const C4NetIO::addr_t &nPeerAddr, const C4NetIO::addr_t &nConnectAddr, C4Network2IOConnStatus nStatus, const char *szPassword, uint32_t iID) |
void | SetSocket (std::unique_ptr< C4NetIOTCP::Socket > socket) |
void | SetRemoteID (uint32_t iRemoteID) |
void | SetPeerAddr (const C4NetIO::addr_t &nPeerAddr) |
void | OnPing () |
void | SetPingTime (int iPingTime) |
void | SetStatus (C4Network2IOConnStatus nStatus) |
void | SetAutoAccepted () |
void | OnPacketReceived (uint8_t iPacketType) |
void | ClearPacketLog (uint32_t iStartNumber=~0) |
Protected Attributes | |
class C4NetIO * | pNetClass {nullptr} |
C4Network2IOProtocol | eProt |
C4NetIO::addr_t | PeerAddr |
C4NetIO::addr_t | ConnectAddr |
std::unique_ptr< C4NetIOTCP::Socket > | TcpSimOpenSocket |
C4Network2IOConnStatus | Status |
uint32_t | iID |
uint32_t | iRemoteID |
bool | fAutoAccept {false} |
bool | fBroadcastTarget {false} |
time_t | iTimestamp {0} |
int | iPingTime {-1} |
C4TimeMilliseconds | tLastPing |
C4TimeMilliseconds | tLastPong |
C4ClientCore | CCore |
CStdCSec | CCoreCSec |
int | iIRate |
int | iORate |
int | iPacketLoss |
StdCopyStrBuf | Password |
bool | fConnSent {false} |
bool | fPostMortemSent {false} |
uint32_t | iOutPacketCounter {0} |
uint32_t | iInPacketCounter {0} |
PacketLogEntry * | pPacketLog {nullptr} |
CStdCSec | PacketLogCSec |
C4Network2IOConnection * | pNext {nullptr} |
std::atomic_long | iRefCnt |
Friends | |
class | C4Network2IO |
Definition at line 214 of file C4Network2IO.h.
struct C4Network2IOConnection::PacketLogEntry |
Definition at line 248 of file C4Network2IO.h.
Class Members | ||
---|---|---|
PacketLogEntry * | Next | |
uint32_t | Number | |
C4NetIOPacket | Pkt |
C4Network2IOConnection::C4Network2IOConnection | ( | ) |
Definition at line 1291 of file C4Network2IO.cpp.
C4Network2IOConnection::~C4Network2IOConnection | ( | ) |
Definition at line 1301 of file C4Network2IO.cpp.
References ClearPacketLog(), Close(), iRefCnt, isClosed(), and pNetClass.
void C4Network2IOConnection::AddRef | ( | ) |
Definition at line 1538 of file C4Network2IO.cpp.
References iRefCnt.
Referenced by C4Network2IO::AddConnection(), C4Network2IO::GetDataConnection(), C4Network2IO::GetMsgConnection(), C4Network2IO::HandlePacket(), C4Network2IO::OnDisconn(), C4Network2Client::SetDataConn(), and C4Network2Client::SetMsgConn().
|
protected |
Definition at line 1400 of file C4Network2IO.cpp.
References C4Network2IOConnection::PacketLogEntry::Next, C4Network2IOConnection::PacketLogEntry::Number, and pPacketLog.
Referenced by C4Network2IO::HandlePacket(), and ~C4Network2IOConnection().
void C4Network2IOConnection::Close | ( | ) |
Definition at line 1459 of file C4Network2IO.cpp.
References C4NetIO::Close(), CS_Closed, isClosed(), PeerAddr, pNetClass, and SetStatus().
Referenced by C4Network2Client::CloseConns(), C4Network2::HandleConn(), C4Network2::HandleConnRe(), C4Network2::HandlePacket(), C4Network2IO::HandlePacket(), Send(), C4Network2Client::~C4Network2Client(), and ~C4Network2IOConnection().
bool C4Network2IOConnection::Connect | ( | ) |
Definition at line 1447 of file C4Network2IO.cpp.
References C4NetIO::Connect(), C4NetIOTCP::Connect(), ConnectAddr, pNetClass, and TcpSimOpenSocket.
Referenced by C4Network2IO::ConnectWithSocket().
bool C4Network2IOConnection::CreatePostMortem | ( | class C4PacketPostMortem * | pPkt | ) |
Definition at line 1421 of file C4Network2IO.cpp.
References C4PacketPostMortem::Add(), fPostMortemSent, iOutPacketCounter, iRemoteID, C4Network2IOConnection::PacketLogEntry::Next, PacketLogCSec, pPacketLog, C4PacketPostMortem::SetConnID(), and C4PacketPostMortem::SetPacketCounter().
Referenced by C4Network2::OnDisconn().
void C4Network2IOConnection::DelRef | ( | ) |
Definition at line 1543 of file C4Network2IO.cpp.
References iRefCnt.
Referenced by C4Network2IO::BroadcastMsg(), C4Network2IO::HandleFwdReq(), C4Network2IO::HandlePacket(), C4Network2IO::OnThreadEvent(), C4Network2Client::RemoveConn(), C4Network2IO::RemoveConnection(), C4Network2Res::SendChunk(), C4Network2IO::SendMsgToClient(), C4Network2Client::SetDataConn(), C4Network2Client::SetMsgConn(), C4Network2Res::StartLoad(), and C4Network2Client::~C4Network2Client().
void C4Network2IOConnection::DoStatistics | ( | int | iInterval, |
int * | pIRateSum, | ||
int * | pORateSum | ||
) |
Definition at line 1519 of file C4Network2IO.cpp.
References C4NetIO::GetConnStatistic(), iIRate, iORate, iPacketLoss, isOpen(), PeerAddr, and pNetClass.
|
inline |
|
inline |
|
inline |
Definition at line 273 of file C4Network2IO.h.
References CCore, and C4ClientCore::getID().
Referenced by C4Network2IO::HandleFwdReq(), C4Network2::HandleLobbyPacket(), C4Network2::HandlePacket(), C4GameControlNetwork::HandlePacket(), C4Network2ResList::HandlePacket(), C4Network2Players::HandlePacket(), C4Network2::OnConnectFail(), C4Network2::OnDisconn(), and C4Network2Res::OnStatus().
|
inline |
Definition at line 267 of file C4Network2IO.h.
References ConnectAddr.
Referenced by C4Network2::HandleConnRe().
|
inline |
|
inline |
Definition at line 283 of file C4Network2IO.h.
References iInPacketCounter.
Referenced by C4Network2IO::HandlePacket().
|
inline |
int C4Network2IOConnection::getLag | ( | ) | const |
Definition at line 1310 of file C4Network2IO.cpp.
References iPingTime, C4TimeMilliseconds::Now(), tLastPing, and tLastPong.
Referenced by C4Network2Client::DoTCPSimultaneousOpen(), and C4Network2Stats::ExecuteSecond().
|
inline |
Definition at line 264 of file C4Network2IO.h.
References pNetClass.
Referenced by C4Network2::HandleConnRe(), C4Network2::OnConnect(), C4Network2::OnConnectFail(), C4Network2::OnDisconnect(), and C4Network2ClientDlg::UpdateText().
|
inline |
|
inline |
Definition at line 284 of file C4Network2IO.h.
References iOutPacketCounter.
Referenced by C4Network2::OnDisconn().
|
inline |
|
inline |
Definition at line 280 of file C4Network2IO.h.
References StdStrBuf::getData(), and Password.
|
inline |
Definition at line 266 of file C4Network2IO.h.
References ConnectAddr, C4NetIO::EndpointAddress::GetPort(), and PeerAddr.
Referenced by C4Network2IO::doAutoAccept(), C4Network2::HandleConn(), C4Network2::HandleConnRe(), C4Network2IO::HandleFwdReq(), C4Network2ClientList::HandlePacket(), C4Network2IO::HandlePacket(), C4Network2::OnConnect(), C4Network2::OnConnectFail(), C4Network2::OnDisconnect(), C4Network2Client::SendAddresses(), and C4Network2ClientDlg::UpdateText().
|
inline |
Definition at line 275 of file C4Network2IO.h.
References iPingTime.
Referenced by C4GameControlNetwork::CalcPerformance(), C4Network2::HandleActivateReq(), and C4Network2ClientDlg::UpdateText().
|
inline |
Definition at line 265 of file C4Network2IO.h.
References eProt.
Referenced by C4Network2Client::DoConnectAttempt(), and C4Network2::HandleConnRe().
|
inline |
|
inline |
|
inline |
Definition at line 289 of file C4Network2IO.h.
References CS_Accepted, and Status.
Referenced by C4Network2::HandleConnRe(), C4Network2IO::HandleFwdReq(), C4GameControlNetwork::HandlePacket(), and C4Network2IO::HandlePacket().
|
inline |
Definition at line 291 of file C4Network2IO.h.
References fAutoAccept.
Referenced by C4Network2::HandleConnRe(), and C4Network2IO::HandlePacket().
|
inline |
|
inline |
Definition at line 290 of file C4Network2IO.h.
References CS_Closed, CS_ConnectFail, and Status.
Referenced by Close(), C4Network2::HandleConn(), C4GameControlNetwork::HandlePacket(), C4Network2IO::HandlePacket(), C4Network2IO::OnConn(), C4Network2IO::OnDisconn(), C4Network2IO::OnThreadEvent(), SetStatus(), and ~C4Network2IOConnection().
|
inline |
Definition at line 286 of file C4Network2IO.h.
References CS_Connect, and Status.
Referenced by C4Network2IO::OnDisconn().
|
inline |
Definition at line 281 of file C4Network2IO.h.
References fConnSent.
Referenced by C4Network2IO::HandlePacket().
|
inline |
Definition at line 293 of file C4Network2IO.h.
References CS_ConnectFail, and Status.
Referenced by C4Network2::OnDisconn().
|
inline |
Definition at line 288 of file C4Network2IO.h.
References CS_Accepted, CS_HalfAccepted, and Status.
Referenced by C4Network2::HandleConn(), C4Network2IO::HandlePacket(), and C4Network2IO::OnDisconn().
|
inline |
Definition at line 274 of file C4Network2IO.h.
References CCore, and C4ClientCore::isHost().
Referenced by C4GameControlNetwork::HandlePacket().
|
inline |
Definition at line 287 of file C4Network2IO.h.
References CS_Closed, CS_Connect, CS_ConnectFail, and Status.
Referenced by C4Network2Client::CloseConns(), DoStatistics(), C4Network2::HandleConnRe(), C4Network2::HandlePacket(), C4Network2IO::HandlePacket(), C4Network2ResList::HandlePacket(), C4Network2IO::OnConn(), and Send().
|
protected |
Definition at line 1393 of file C4Network2IO.cpp.
References iInPacketCounter, and PID_PacketLogStart.
Referenced by C4Network2IO::OnPacket().
|
protected |
Definition at line 1356 of file C4Network2IO.cpp.
References C4TimeMilliseconds::Now(), tLastPing, and tLastPong.
|
inline |
Definition at line 313 of file C4Network2IO.h.
References fAutoAccept.
Referenced by C4Network2::HandleConnRe().
bool C4Network2IOConnection::Send | ( | const C4NetIOPacket & | rPkt | ) |
Definition at line 1468 of file C4Network2IO.cpp.
References Close(), fPostMortemSent, C4NetIO::GetError(), C4NetIOPacket::getStatus(), iOutPacketCounter, isOpen(), LogF(), C4Network2IOConnection::PacketLogEntry::Next, C4Network2IOConnection::PacketLogEntry::Number, PacketLogCSec, PeerAddr, PID_PacketLogStart, C4Network2IOConnection::PacketLogEntry::Pkt, pNetClass, pPacketLog, C4NetIO::ResetError(), C4NetIO::Send(), and C4NetIOPacket::SetAddr().
Referenced by C4Network2Client::CloseConns(), C4Network2::HandleConn(), C4GameControlNetwork::HandleControlReq(), C4Network2IO::HandleFwdReq(), C4Network2IO::HandlePacket(), C4Network2Client::SendAddresses(), C4Network2Res::SendChunk(), C4Network2Client::SendData(), C4Network2ResList::SendDiscover(), C4Network2Client::SendMsg(), C4Network2IO::SendMsgToClient(), C4Network2Res::SendStatus(), and C4Network2Res::StartLoad().
|
protected |
Definition at line 1327 of file C4Network2IO.cpp.
References ConnectAddr, eProt, fBroadcastTarget, iID, iPingTime, iTimestamp, Password, PeerAddr, pNetClass, and Status.
Referenced by C4Network2IO::ConnectWithSocket(), and C4Network2IO::OnConn().
|
inline |
Definition at line 311 of file C4Network2IO.h.
References CS_Accepted, and SetStatus().
Referenced by C4Network2::HandleConnRe(), and C4Network2IO::HandlePacket().
|
protected |
Definition at line 1388 of file C4Network2IO.cpp.
References fAutoAccept.
Referenced by C4Network2IO::HandlePacket().
void C4Network2IOConnection::SetBroadcastTarget | ( | bool | fSet | ) |
Definition at line 1511 of file C4Network2IO.cpp.
References fBroadcastTarget, PeerAddr, pNetClass, and C4NetIO::SetBroadcast().
Referenced by C4Network2IO::HandleFwdReq().
void C4Network2IOConnection::SetCCore | ( | const C4ClientCore & | nCCore | ) |
Definition at line 1441 of file C4Network2IO.cpp.
References CCore, and CCoreCSec.
Referenced by C4Network2IO::ConnectWithSocket(), C4Network2::HandleConn(), C4Network2::HandleConnRe(), and C4Network2IO::HandlePacket().
|
inline |
|
inline |
Definition at line 310 of file C4Network2IO.h.
References CS_HalfAccepted, and SetStatus().
Referenced by C4Network2::HandleConn().
|
protected |
Definition at line 1350 of file C4Network2IO.cpp.
References PeerAddr.
Referenced by C4Network2IO::OnConn().
|
protected |
Definition at line 1366 of file C4Network2IO.cpp.
References iPingTime, C4TimeMilliseconds::Now(), and tLastPong.
Referenced by C4Network2IO::HandlePacket().
|
protected |
Definition at line 1345 of file C4Network2IO.cpp.
References iRemoteID.
Referenced by C4Network2IO::HandlePacket().
|
protected |
Definition at line 1340 of file C4Network2IO.cpp.
References TcpSimOpenSocket.
Referenced by C4Network2IO::ConnectWithSocket().
|
protected |
Definition at line 1374 of file C4Network2IO.cpp.
References CS_Accepted, CS_Closed, CS_Connect, CS_Connected, isClosed(), iTimestamp, and Status.
Referenced by Close(), C4Network2IO::HandlePacket(), C4Network2IO::OnConn(), C4Network2IO::OnDisconn(), SetAccepted(), and SetHalfAccepted().
|
friend |
Definition at line 216 of file C4Network2IO.h.
|
protected |
Definition at line 238 of file C4Network2IO.h.
Referenced by getCCore(), getClientID(), isHost(), and SetCCore().
|
protected |
Definition at line 239 of file C4Network2IO.h.
Referenced by getCCoreCSec(), and SetCCore().
|
protected |
Definition at line 226 of file C4Network2IO.h.
Referenced by Connect(), getConnectAddr(), getPeerAddr(), and Set().
|
protected |
Definition at line 225 of file C4Network2IO.h.
Referenced by getProtocol(), and Set().
|
protected |
Definition at line 232 of file C4Network2IO.h.
Referenced by isAutoAccepted(), ResetAutoAccepted(), and SetAutoAccepted().
|
protected |
Definition at line 233 of file C4Network2IO.h.
Referenced by isBroadcastTarget(), Set(), and SetBroadcastTarget().
|
protected |
Definition at line 243 of file C4Network2IO.h.
Referenced by isConnSent(), and SetConnSent().
|
protected |
Definition at line 244 of file C4Network2IO.h.
Referenced by CreatePostMortem(), and Send().
|
protected |
Definition at line 231 of file C4Network2IO.h.
|
protected |
Definition at line 247 of file C4Network2IO.h.
Referenced by getInPacketCounter(), and OnPacketReceived().
|
protected |
Definition at line 240 of file C4Network2IO.h.
Referenced by DoStatistics(), and getIRate().
|
protected |
Definition at line 240 of file C4Network2IO.h.
Referenced by DoStatistics(), and getORate().
|
protected |
Definition at line 247 of file C4Network2IO.h.
Referenced by CreatePostMortem(), getOutPacketCounter(), and Send().
|
protected |
Definition at line 241 of file C4Network2IO.h.
Referenced by DoStatistics(), and getPacketLoss().
|
protected |
Definition at line 235 of file C4Network2IO.h.
Referenced by getLag(), getPingTime(), Set(), and SetPingTime().
|
protected |
Definition at line 261 of file C4Network2IO.h.
Referenced by AddRef(), DelRef(), and ~C4Network2IOConnection().
|
protected |
Definition at line 231 of file C4Network2IO.h.
Referenced by CreatePostMortem(), getRemoteID(), and SetRemoteID().
|
protected |
Definition at line 234 of file C4Network2IO.h.
Referenced by getTimestamp(), Set(), and SetStatus().
|
protected |
Definition at line 255 of file C4Network2IO.h.
Referenced by CreatePostMortem(), and Send().
|
protected |
Definition at line 242 of file C4Network2IO.h.
Referenced by getPassword(), and Set().
|
protected |
Definition at line 226 of file C4Network2IO.h.
Referenced by Close(), DoStatistics(), getPeerAddr(), Send(), Set(), SetBroadcastTarget(), and SetPeerAddr().
|
protected |
Definition at line 224 of file C4Network2IO.h.
Referenced by Close(), Connect(), DoStatistics(), getNetClass(), Send(), Set(), SetBroadcastTarget(), and ~C4Network2IOConnection().
|
protected |
Definition at line 258 of file C4Network2IO.h.
Referenced by C4Network2IO::AddConnection(), C4Network2IO::BeginBroadcast(), C4Network2IO::Broadcast(), C4Network2IO::BroadcastMsg(), C4Network2IO::doAutoAccept(), C4Network2IO::GenerateStatistics(), C4Network2IO::GetConnection(), C4Network2IO::GetConnectionByConnAddr(), C4Network2IO::GetConnectionByID(), C4Network2IO::getConnectionCount(), C4Network2IO::GetDataConnection(), C4Network2IO::GetMsgConnection(), C4Network2IO::HandleFwdReq(), C4Network2IO::Ping(), C4Network2IO::RemoveConnection(), and C4Network2IO::SendConnPackets().
|
protected |
Definition at line 254 of file C4Network2IO.h.
Referenced by ClearPacketLog(), CreatePostMortem(), and Send().
|
protected |
Definition at line 230 of file C4Network2IO.h.
Referenced by isAccepted(), isClosed(), isConnecting(), isFailed(), isHalfAccepted(), isOpen(), Set(), and SetStatus().
|
protected |
Definition at line 227 of file C4Network2IO.h.
Referenced by Connect(), and SetSocket().
|
protected |
Definition at line 236 of file C4Network2IO.h.
|
protected |
Definition at line 237 of file C4Network2IO.h.
Referenced by getLag(), OnPing(), and SetPingTime().