Allow special callsigns to connect via DMR protocol

This allows for connection of IPSC2 masters using callsigns
like IPSC_EU2. In order to not cause issues with the existing code
this has been enclosed into an ifdef. It has to be activated ex-
plicitely though.
pull/147/head
phl0 6 years ago
parent be87d54897
commit a13ef93d6e
No known key found for this signature in database
GPG Key ID: 48EA1E640798CA9A

@ -110,22 +110,34 @@ bool CCallsign::IsValid(void) const
} }
} }
valid &= (iNum < 3); valid &= (iNum < 3);
// all remaining char are letter, number or space // all remaining char are letter, number or space (or underscore in extended checks)
for ( ; i < CALLSIGN_LEN; i++) for ( ; i < CALLSIGN_LEN; i++)
{ {
#ifdef EXTENDED_DMRID_CHECKS
valid &= IsLetter(m_Callsign[i]) || IsNumber(m_Callsign[i]) || IsSpace(m_Callsign[i]) || IsUnderscore(m_Callsign[i]);
#else
valid &= IsLetter(m_Callsign[i]) || IsNumber(m_Callsign[i]) || IsSpace(m_Callsign[i]); valid &= IsLetter(m_Callsign[i]) || IsNumber(m_Callsign[i]) || IsSpace(m_Callsign[i]);
#endif
} }
// prefix // prefix
// all chars are number, uppercase or space // all chars are number, uppercase or space (or underscore in extend checks)
for ( i = 0; i < CALLSUFFIX_LEN; i++ ) for ( i = 0; i < CALLSUFFIX_LEN; i++ )
{ {
#ifdef EXTENDED_DMRID_CHECKS
valid &= IsLetter(m_Suffix[i]) || IsNumber(m_Suffix[i]) || IsSpace(m_Suffix[i]) || IsUnderscore(m_Suffix[i]);
#else
valid &= IsLetter(m_Suffix[i]) || IsNumber(m_Suffix[i]) || IsSpace(m_Suffix[i]); valid &= IsLetter(m_Suffix[i]) || IsNumber(m_Suffix[i]) || IsSpace(m_Suffix[i]);
#endif
} }
// module // module
// is an letter or space // is an letter or space
#ifdef EXTENDED_DMRID_CHECKS
valid &= IsLetter(m_Module) || IsSpace(m_Module) || IsNumber(m_Module);
#else
valid &= IsLetter(m_Module) || IsSpace(m_Module); valid &= IsLetter(m_Module) || IsSpace(m_Module);
#endif
// dmrid is not tested, as it can be NULL // dmrid is not tested, as it can be NULL
// if station does is not dmr registered // if station does is not dmr registered
@ -361,6 +373,13 @@ bool CCallsign::IsLetter(char c) const
return ((c >= 'A') && (c <= 'Z')); return ((c >= 'A') && (c <= 'Z'));
} }
#ifdef EXTENDED_DMRID_CHECKS
bool CCallsign::IsUnderscore(char c) const
{
return (c == '_');
}
#endif
bool CCallsign::IsSpace(char c) const bool CCallsign::IsSpace(char c) const
{ {
return (c == ' '); return (c == ' ');

@ -85,6 +85,9 @@ protected:
bool IsNumber(char) const; bool IsNumber(char) const;
bool IsLetter(char) const; bool IsLetter(char) const;
bool IsSpace(char) const; bool IsSpace(char) const;
#ifdef EXTENDED_DMRID_CHECKS
bool IsUnderscore(char) const;
#endif
protected: protected:
// data // data

@ -144,6 +144,11 @@
#define DMRIDDB_PATH "/xlxd/dmrid.dat" // local file path #define DMRIDDB_PATH "/xlxd/dmrid.dat" // local file path
#define DMRIDDB_REFRESH_RATE 180 // in minutes #define DMRIDDB_REFRESH_RATE 180 // in minutes
// Extended DMR ID checks ---------------------------------------
//#define EXTENDED_DMRID_CHECKS // Also allow extended "callsigns" like "IPSC_EU2"
// used for incoming DMR-DL master connections
// Wires-X node database ---------------------------------------- // Wires-X node database ----------------------------------------
#define YSFNODEDB_USE_RLX_SERVER 1 // 1 = use http, 0 = use local file #define YSFNODEDB_USE_RLX_SERVER 1 // 1 = use http, 0 = use local file

Loading…
Cancel
Save

Powered by TurnKey Linux.