mirror of
https://github.com/nostar/urfd.git
synced 2026-11-08 12:26:46 +00:00
Add handlers for YSFI and YSFV packets, so that they dont clutter the lof=g with unkown packet entries
This commit is contained in:
1 parent
1bc7927cb1
commit
dd1586d478
2 files changed
+28
No files matched your search
@@ -186,6 +186,14 @@ void CYsfProtocol::Task(void)
|
||||
EncodeServerStatusPacket(&Buffer);
|
||||
Send(Buffer, Ip);
|
||||
}
|
||||
else if ( IsValidInfoPacket(Buffer) )
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
else if ( IsValidAckPacket(Buffer) )
|
||||
{
|
||||
std::cout << "YSF valid/ack packet received from " << Ip << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@@ -882,6 +890,24 @@ bool CYsfProtocol::IsValidServerStatusPacket(const CBuffer &Buffer) const
|
||||
return ( (Buffer.size() >= 4) && (Buffer.Compare(tag, sizeof(tag)) == 0) );
|
||||
}
|
||||
|
||||
// Info packet sent by some clients -- currently ignored by YSFReflector
|
||||
|
||||
bool CYsfProtocol::IsValidInfoPacket(const CBuffer &Buffer) const
|
||||
{
|
||||
uint8_t tag[] = { 'Y','S','F','I' };
|
||||
|
||||
return ( (Buffer.size() >= 4) && (Buffer.Compare(tag, sizeof(tag)) == 0) );
|
||||
}
|
||||
|
||||
// Valid packet sent by registry as an ACK response to a server status reply from reflector
|
||||
|
||||
bool CYsfProtocol::IsValidAckPacket(const CBuffer &Buffer) const
|
||||
{
|
||||
uint8_t tag[] = { 'Y','S','F','V' };
|
||||
|
||||
return ( (Buffer.size() >= 4) && (Buffer.Compare(tag, sizeof(tag)) == 0) );
|
||||
}
|
||||
|
||||
// server status packet encoding helpers
|
||||
|
||||
bool CYsfProtocol::EncodeServerStatusPacket(CBuffer *Buffer) const
|
||||
|
||||
@@ -101,6 +101,8 @@ protected:
|
||||
|
||||
// server status packet decoding helpers
|
||||
bool IsValidServerStatusPacket(const CBuffer &) const;
|
||||
bool IsValidInfoPacket(const CBuffer &) const;
|
||||
bool IsValidAckPacket(const CBuffer &) const;
|
||||
uint32_t CalcHash(const uint8_t *, int) const;
|
||||
|
||||
// server status packet encoding helpers
|
||||
|
||||
Reference in new issue
Block a user