Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,19 @@ CONNECTION LESS MESSAGES
five times for one registration request at 500ms intervals.
Beyond this, it should "ping" every 15 minutes
(standard re-registration timeout).


- PROTMESSID_CLM_SERVER_INFO: Bitmask of enabled server features
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially phrased it as "capabilities". FYI.

There were old versions which didn't support panning I think. Assuming this message was already implemented at this time, We would have used this message to advertise pan support.

In think we should make it very clear what this message can and cannot encode

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a new message being added for this new feature.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I know. But we should specify what this feature can and what it can't expose. I'm thinking of a specification/architectural viewpoint


+------------------+
| 4 bytes number n |
+------------------+


- PROTMESSID_CLM_REQ_SERVER_INFO: Request bitmask of enabled server features

note: does not have any data -> n = 0

*/

#include "protocol.h"
Expand Down Expand Up @@ -925,6 +938,10 @@ void CProtocol::ParseConnectionLessMessageBody ( const CVector<uint8_t>& vecbyMe
case PROTMESSID_CLM_REGISTER_SERVER_RESP:
EvaluateCLRegisterServerResp ( InetAddr, vecbyMesBodyData );
break;

case PROTMESSID_CLM_REQ_SERVER_INFO:
EvaluateCLReqServerInfoMes ( InetAddr );
break;
}
}

Expand Down Expand Up @@ -2598,6 +2615,24 @@ bool CProtocol::EvaluateCLRegisterServerResp ( const CHostAddress& InetAddr, con
return false; // no error
}

bool CProtocol::EvaluateCLReqServerInfoMes ( const CHostAddress& InetAddr )
{
// invoke message action
emit CLReqServerInfo ( InetAddr );

return false; // no error
}

void CProtocol::CreateCLServerInfoMes ( const CHostAddress& InetAddr, const uint32_t iFeatures )
{
int iPos = 0; // init position pointer
CVector<uint8_t> vecData ( 1 );

PutValOnStream ( vecData, iPos, iFeatures, 4 );

CreateAndImmSendConLessMessage ( PROTMESSID_CLM_SERVER_INFO, vecData, InetAddr );
}

/******************************************************************************\
* Message generation and parsing *
\******************************************************************************/
Expand Down
5 changes: 5 additions & 0 deletions src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
#define PROTMESSID_CLM_REGISTER_SERVER_RESP 1016 // status of server registration request
#define PROTMESSID_CLM_REGISTER_SERVER_EX 1017 // register server with extended information
#define PROTMESSID_CLM_RED_SERVER_LIST 1018 // reduced server list
#define PROTMESSID_CLM_SERVER_INFO 1019 // server info message
#define PROTMESSID_CLM_REQ_SERVER_INFO 1020 // request server info

// special IDs
#define PROTMESSID_SPECIAL_SPLIT_MESSAGE 2001 // a container for split messages
Expand Down Expand Up @@ -155,6 +157,7 @@ class CProtocol : public QObject
void CreateCLReqConnClientsListMes ( const CHostAddress& InetAddr );
void CreateCLChannelLevelListMes ( const CHostAddress& InetAddr, const CVector<uint16_t>& vecLevelList, const int iNumClients );
void CreateCLRegisterServerResp ( const CHostAddress& InetAddr, const ESvrRegResult eResult );
void CreateCLServerInfoMes ( const CHostAddress& InetAddr, const uint32_t iResult );

static bool ParseMessageFrame ( const CVector<uint8_t>& vecbyData,
const int iNumBytesIn,
Expand Down Expand Up @@ -282,6 +285,7 @@ class CProtocol : public QObject
bool EvaluateCLReqConnClientsListMes ( const CHostAddress& InetAddr );
bool EvaluateCLChannelLevelListMes ( const CHostAddress& InetAddr, const CVector<uint8_t>& vecData );
bool EvaluateCLRegisterServerResp ( const CHostAddress& InetAddr, const CVector<uint8_t>& vecData );
bool EvaluateCLReqServerInfoMes ( const CHostAddress& InetAddr );

int iOldRecID;
int iOldRecCnt;
Expand Down Expand Up @@ -349,4 +353,5 @@ public slots:
void CLReqConnClientsList ( CHostAddress InetAddr );
void CLChannelLevelListReceived ( CHostAddress InetAddr, CVector<uint16_t> vecLevelList );
void CLRegisterServerResp ( CHostAddress InetAddr, ESvrRegResult eStatus );
void CLReqServerInfo ( CHostAddress InetAddr );
};
19 changes: 19 additions & 0 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
\******************************************************************************/

#include "server.h"
#include "util.h"

// CServer implementation ******************************************************
CServer::CServer ( const int iNewMaxNumChan,
Expand Down Expand Up @@ -269,6 +270,8 @@ CServer::CServer ( const int iNewMaxNumChan,

QObject::connect ( &ConnLessProtocol, &CProtocol::CLReqConnClientsList, this, &CServer::OnCLReqConnClientsList );

QObject::connect ( &ConnLessProtocol, &CProtocol::CLReqServerInfo, this, &CServer::OnCLReqServerInfo );

QObject::connect ( &ServerListManager, &CServerListManager::SvrRegStatusChanged, this, &CServer::SvrRegStatusChanged );

QObject::connect ( &JamController, &recorder::CJamController::RestartRecorder, this, &CServer::RestartRecorder );
Expand Down Expand Up @@ -450,6 +453,22 @@ void CServer::OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAd
Logging.AddNewConnection ( RecHostAddr.InetAddr, iTotChans );
}

void CServer::OnCLReqServerInfo ( CHostAddress RecHostAddr )
{
uint32_t iFeatures = 0;

iFeatures |= ( !bUseDoubleSystemFrameSize << FS_SMALL_NETW_BUF );
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't conflate "small network buffers" in the client with "double frame size" in the server -- you've looked at this now 😄.

iFeatures |= ( bUseMultithreading << FS_MULTITHREADING );
iFeatures |= ( GetRecorderInitialised() << FS_RECORDER_INIT );
iFeatures |= ( GetDisableRecording() << FS_DISABLE_RECORDING );
iFeatures |= ( (JamController.GetRecorderState() != RS_RECORDING) << FS_IS_RECORDING );
iFeatures |= ( bDelayPan << FS_DELAY_PAN );
iFeatures |= ( bEnableIPv6 << FS_ENABLE_IPV6 );
// iFeatures |= ( bDisableRaw << FS_RAW_AUDIO );
Copy link
Copy Markdown
Member

@ann0see ann0see Jun 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be un commented?


ConnLessProtocol.CreateCLServerInfoMes ( RecHostAddr, iFeatures );
}

void CServer::OnServerFull ( CHostAddress RecHostAddr )
{
// note: no mutex required here
Expand Down
2 changes: 2 additions & 0 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ public slots:

void OnCLUnregisterServerReceived ( CHostAddress InetAddr ) { ServerListManager.Remove ( InetAddr ); }

void OnCLReqServerInfo ( CHostAddress InetAddr );

void OnCLDisconnection ( CHostAddress InetAddr );

void OnAboutToQuit();
Expand Down
14 changes: 14 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,20 @@ enum EDirectoryType
AT_CUSTOM = 7 // Must be the last entry!
};

// Server feature set ----------------------------------------------------------
enum EFeatureSet
{
// used for protocol -> enum values must be fixed
FS_SMALL_NETW_BUF = 0,
Copy link
Copy Markdown
Collaborator Author

@pljones pljones Jun 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be FS_FAST_UPDATE and be true if bUseDoubleSystemFrameSize is false.

FS_MULTITHREADING = 1,
FS_RECORDER_INIT = 2,
FS_DISABLE_RECORDING = 3,
FS_IS_RECORDING = 4,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need three flags:

  • FS_RECORDER_ENABLED - true if GetRecorderInitialised() && !GetDisableRecording()
  • FS_IS_RECORDING - true if JamController.GetRecorderState() == RS_RECORDING (you had !=?)

FS_DELAY_PAN = 5,
FS_ENABLE_IPV6 = 6,
FS_RAW_AUDIO = 7
};
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding:

  • FS_DISCONONQUIT -- true if the connection will drop if the server exits


inline QString DirectoryTypeToString ( EDirectoryType eAddrType )
{
switch ( eAddrType )
Expand Down
Loading