#include <C4NetIO.h>
Public Member Functions | |
Peer (const C4NetIO::addr_t &naddr, C4NetIOUDP *pnParent) | |
~Peer () | |
const C4NetIO::addr_t & | GetAddr () const |
const C4NetIO::addr_t & | GetAltAddr () const |
bool | Connect (bool fFailCallback) |
bool | Send (const C4NetIOPacket &rPacket) |
bool | Check (bool fForceCheck=true) |
void | OnRecv (const C4NetIOPacket &Packet) |
void | Close (const char *szReason) |
bool | Open () const |
bool | Closed () const |
bool | MultiCast () const |
unsigned int | GetMCAckPacketCounter () const |
C4TimeMilliseconds | GetTimeout () |
void | CheckTimeout () |
bool | doBroadcast () const |
void | SetBroadcast (bool fSet) |
void | SetAltAddr (const C4NetIO::addr_t &naddr2) |
int | GetIRate () const |
int | GetORate () const |
int | GetLoss () const |
void | ClearStatistics () |
Public Attributes | |
Peer * | Next |
Protected Types | |
enum | ConnStatus { CS_None , CS_Conn , CS_Works , CS_Closed } |
Protected Member Functions | |
bool | DoConn (bool fMC) |
bool | DoCheck (int iAskCnt=0, int iMCAskCnt=0, unsigned int *pAskList=nullptr) |
bool | SendDirect (const Packet &rPacket, unsigned int iNr=~0) |
bool | SendDirect (C4NetIOPacket &&rPacket) |
void | OnConn () |
void | OnClose (const char *szReason) |
void | CheckCompleteIPackets () |
void | SetTimeout (int iLength=iStdTimeout, int iRetryCnt=0) |
void | OnTimeout () |
Protected Attributes | |
C4NetIOUDP *const | pParent |
C4NetIO::addr_t | addr |
C4NetIO::addr_t | addr2 |
addr_t | PeerAddr |
enum C4NetIOUDP::Peer::ConnStatus | eStatus |
bool | fMultiCast |
bool | fDoBroadcast |
bool | fConnFailCallback |
PacketList | OPackets |
PacketList | IPackets |
PacketList | IMCPackets |
unsigned int | iOPacketCounter |
unsigned int | iIPacketCounter |
unsigned int | iRIPacketCounter |
unsigned int | iIMCPacketCounter |
unsigned int | iRIMCPacketCounter |
unsigned int | iMCAckPacketCounter |
CStdCSec | OutCSec |
C4TimeMilliseconds | tNextReCheck |
unsigned int | iLastPacketAsked |
unsigned int | iLastMCPacketAsked |
C4TimeMilliseconds | tTimeout |
unsigned int | iRetries |
int | iIRate |
int | iORate |
int | iLoss |
CStdCSec | StatCSec |
Static Protected Attributes | |
static const unsigned int | iConnectRetries = 5 |
static const unsigned int | iReCheckInterval = 1000 |
|
protected |
C4NetIOUDP::Peer::Peer | ( | const C4NetIO::addr_t & | naddr, |
C4NetIOUDP * | pnParent | ||
) |
Definition at line 3161 of file C4NetIO.cpp.
C4NetIOUDP::Peer::~Peer | ( | ) |
Definition at line 3175 of file C4NetIO.cpp.
References C4NetIOUDP::Close().
bool C4NetIOUDP::Peer::Check | ( | bool | fForceCheck = true | ) |
Definition at line 3210 of file C4NetIO.cpp.
References C4NetIOUDP::DoCheck(), C4TimeMilliseconds::NegativeInfinity, and C4TimeMilliseconds::Now().
|
protected |
Definition at line 3581 of file C4NetIO.cpp.
References C4NetIOUDP::Packet::FragmentCnt(), C4NetIOUDP::Packet::GetData(), and C4NetIOUDP::Packet::GetNr().
void C4NetIOUDP::Peer::CheckTimeout | ( | ) |
Definition at line 3473 of file C4NetIO.cpp.
References C4TimeMilliseconds::Now().
void C4NetIOUDP::Peer::ClearStatistics | ( | ) |
Definition at line 3480 of file C4NetIO.cpp.
References C4NetIOUDP::StatCSec.
void C4NetIOUDP::Peer::Close | ( | const char * | szReason | ) |
Definition at line 3458 of file C4NetIO.cpp.
References C4NetIOUDP::ClosePacket::Addr, CS_Closed, C4NetIOUDP::IPID_Close, C4NetIOUDP::PacketHdr::Nr, C4NetIOUDP::SendDirect(), and C4NetIOUDP::PacketHdr::StatusByte.
Referenced by C4NetIOUDP::Close(), and C4NetIOUDP::ConnectPeer().
|
inline |
bool C4NetIOUDP::Peer::Connect | ( | bool | fFailCallback | ) |
Definition at line 3181 of file C4NetIO.cpp.
References C4NetIOUDP::fMultiCast.
Referenced by C4NetIOUDP::ConnectPeer().
|
inline |
Definition at line 831 of file C4NetIO.h.
References fDoBroadcast.
Referenced by C4NetIOUDP::Broadcast().
|
protected |
Definition at line 3506 of file C4NetIO.cpp.
References C4NetIOUDP::CheckPacketHdr::AckNr, C4NetIOUDP::CheckPacketHdr::AskCount, C4NetIOUDP::iOPacketCounter, C4NetIOUDP::IPID_Check, C4NetIOUDP::CheckPacketHdr::MCAckNr, C4NetIOUDP::CheckPacketHdr::MCAskCount, C4NetIOUDP::PacketHdr::Nr, C4NetIOUDP::Packet, C4NetIOUDP::SendDirect(), C4NetIOUDP::StatCSec, and C4NetIOUDP::PacketHdr::StatusByte.
|
protected |
Definition at line 3487 of file C4NetIO.cpp.
References C4NetIOUDP::ConnPacket::Addr, C4NetIOUDP::iOPacketCounter, C4NetIOUDP::IPID_Conn, C4NetIOUDP::iStdTimeout, C4NetIOUDP::ConnPacket::MCAddr, C4NetIOUDP::PacketHdr::Nr, C4NetIOUDP::ConnPacket::ProtocolVer, C4NetIOUDP::SendDirect(), and C4NetIOUDP::PacketHdr::StatusByte.
|
inline |
|
inline |
|
inline |
Definition at line 839 of file C4NetIO.h.
References iIRate.
Referenced by C4NetIOUDP::GetConnStatistic().
|
inline |
|
inline |
Definition at line 824 of file C4NetIO.h.
References iMCAckPacketCounter.
Referenced by C4NetIOUDP::ClearMCPackets().
|
inline |
Definition at line 840 of file C4NetIO.h.
References iORate.
Referenced by C4NetIOUDP::GetConnStatistic().
|
inline |
|
inline |
Definition at line 821 of file C4NetIO.h.
References fMultiCast.
Referenced by C4NetIOUDP::Broadcast(), and C4NetIOUDP::DoCheck().
|
protected |
Definition at line 3570 of file C4NetIO.cpp.
References CS_Closed, and C4NetIO::CBClass::OnDisconn().
|
protected |
Definition at line 3553 of file C4NetIO.cpp.
References C4NetIOUDP::Close(), C4NetIO::CBClass::OnConn(), and C4NetIO::TO_INF.
void C4NetIOUDP::Peer::OnRecv | ( | const C4NetIOPacket & | Packet | ) |
Definition at line 3246 of file C4NetIO.cpp.
References C4NetIOUDP::CheckPacketHdr::AckNr, C4NetIOUDP::Packet::AddFragment(), C4NetIOUDP::PacketList::AddPacket(), C4NetIOUDP::ConnPacket::Addr, C4NetIOUDP::ConnOKPacket::Addr, C4NetIOUDP::AddAddrPacket::Addr, C4NetIOUDP::ClosePacket::Addr, C4NetIOUDP::CheckPacketHdr::AskCount, CStdLock::Clear(), C4NetIOUDP::PacketList::ClearPackets(), C4NetIOUDP::Close(), C4NetIOUDP::Connect(), CS_Closed, C4NetIOUDP::fMultiCast, C4NetIOUDP::DataPacketHdr::FNr, C4NetIOUDP::PacketList::GetPacket(), StdBuf::getSize(), C4NetIOUDP::iOPacketCounter, C4NetIOUDP::IPID_AddAddr, C4NetIOUDP::IPID_Check, C4NetIOUDP::IPID_Close, C4NetIOUDP::IPID_Conn, C4NetIOUDP::IPID_ConnOK, C4NetIOUDP::IPID_Data, C4NetIO::EndpointAddress::IsNull(), C4NetIOUDP::iUDPHeaderSize, C4NetIOUDP::CheckPacketHdr::MCAckNr, C4NetIOUDP::ConnPacket::MCAddr, C4NetIOUDP::CheckPacketHdr::MCAskCount, C4NetIOUDP::ConnOKPacket::MCM_MC, C4NetIOUDP::ConnOKPacket::MCM_MCOK, C4NetIOUDP::ConnOKPacket::MCM_NoMC, C4NetIOUDP::ConnOKPacket::MCMode, C4TimeMilliseconds::NegativeInfinity, C4NetIOUDP::AddAddrPacket::NewAddr, C4NetIOUDP::PacketHdr::Nr, C4NetIOUDP::OPackets, C4NetIOUDP::OutCSec, C4NetIOUDP::Packet, C4NetIOUDP::ConnPacket::ProtocolVer, C4NetIOUDP::SendDirect(), C4NetIOUDP::StatCSec, and C4NetIOUDP::PacketHdr::StatusByte.
|
protected |
Definition at line 3636 of file C4NetIO.cpp.
References C4NetIOUDP::Close(), C4NetIOUDP::fMultiCast, and C4NetIO::TO_INF.
|
inline |
Definition at line 817 of file C4NetIO.h.
References CS_Works, and eStatus.
Referenced by C4NetIOUDP::Broadcast(), C4NetIOUDP::DoCheck(), and C4NetIOUDP::GetConnStatistic().
bool C4NetIOUDP::Peer::Send | ( | const C4NetIOPacket & | rPacket | ) |
Definition at line 3188 of file C4NetIO.cpp.
References C4NetIOUDP::PacketList::AddPacket(), C4NetIOUDP::Close(), C4NetIOPacket::Duplicate(), C4NetIOUDP::Packet::FragmentCnt(), C4NetIOUDP::Packet::GetData(), C4NetIOUDP::iOPacketCounter, C4NetIOUDP::OPackets, C4NetIOUDP::OutCSec, C4NetIOUDP::Packet, C4NetIOUDP::SendDirect(), and C4NetIOPacket::SetAddr().
Referenced by C4NetIOUDP::Broadcast(), and C4NetIOUDP::Send().
|
protected |
Definition at line 3542 of file C4NetIO.cpp.
References C4NetIOUDP::iUDPHeaderSize, and C4NetIOUDP::StatCSec.
|
protected |
Definition at line 3530 of file C4NetIO.cpp.
References C4NetIOUDP::Packet::FragmentCnt(), C4NetIOUDP::Packet::GetFragment(), C4NetIOUDP::Packet::GetNr(), and C4NetIOUDP::SendDirect().
|
inline |
|
inline |
Definition at line 833 of file C4NetIO.h.
References fDoBroadcast.
Referenced by C4NetIOUDP::SetBroadcast().
|
protected |
Definition at line 3623 of file C4NetIO.cpp.
References C4TimeMilliseconds::Now(), C4TimeMilliseconds::PositiveInfinity, and C4NetIO::TO_INF.
|
protected |
|
protected |
Definition at line 756 of file C4NetIO.h.
Referenced by GetAltAddr(), and SetAltAddr().
|
protected |
|
protected |
Definition at line 768 of file C4NetIO.h.
Referenced by doBroadcast(), and SetBroadcast().
|
protected |
Definition at line 766 of file C4NetIO.h.
Referenced by MultiCast().
|
staticprotected |
|
protected |
|
protected |
Definition at line 795 of file C4NetIO.h.
Referenced by GetIRate().
|
protected |
|
protected |
|
protected |
Definition at line 781 of file C4NetIO.h.
Referenced by GetMCAckPacketCounter().
|
protected |
|
protected |
Definition at line 795 of file C4NetIO.h.
Referenced by GetORate().
|
protected |
|
staticprotected |
|
protected |
Peer* C4NetIOUDP::Peer::Next |
Definition at line 867 of file C4NetIO.h.
Referenced by C4NetIOUDP::AddPeer(), C4NetIOUDP::Broadcast(), C4NetIOUDP::ClearMCPackets(), C4NetIOUDP::ClearStatistic(), C4NetIOUDP::Close(), C4NetIOUDP::DoCheck(), C4NetIOUDP::Execute(), C4NetIOUDP::GetNextTick(), C4NetIOUDP::GetPeer(), and C4NetIOUDP::OnShareFree().
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 791 of file C4NetIO.h.
Referenced by GetTimeout().