@ -938,6 +938,8 @@ bool HostBridge::readParams()
yaml : : Node systemConf = m_conf [ " system " ] ;
m_identity = systemConf [ " identity " ] . as < std : : string > ( ) ;
m_trace = systemConf [ " trace " ] . as < bool > ( false ) ;
m_debug = systemConf [ " debug " ] . as < bool > ( false ) ;
m_netId = ( uint32_t ) : : strtoul ( systemConf [ " netId " ] . as < std : : string > ( " BB800 " ) . c_str ( ) , NULL , 16 ) ;
m_netId = p25 : : P25Utils : : netId ( m_netId ) ;
@ -1003,8 +1005,75 @@ bool HostBridge::readParams()
m_localAudio = systemConf [ " localAudio " ] . as < bool > ( true ) ;
m_trace = systemConf [ " trace " ] . as < bool > ( false ) ;
m_debug = systemConf [ " debug " ] . as < bool > ( false ) ;
m_udpAudio = systemConf [ " udpAudio " ] . as < bool > ( false ) ;
m_udpMetadata = systemConf [ " udpMetadata " ] . as < bool > ( false ) ;
m_udpSendPort = ( uint16_t ) systemConf [ " udpSendPort " ] . as < uint32_t > ( 34001 ) ;
m_udpSendAddress = systemConf [ " udpSendAddress " ] . as < std : : string > ( ) ;
m_udpReceivePort = ( uint16_t ) systemConf [ " udpReceivePort " ] . as < uint32_t > ( 34001 ) ;
m_udpReceiveAddress = systemConf [ " udpReceiveAddress " ] . as < std : : string > ( ) ;
m_udpUsrp = systemConf [ " udpUsrp " ] . as < bool > ( false ) ;
m_udpFrameTiming = systemConf [ " udpFrameTiming " ] . as < bool > ( false ) ;
if ( m_udpUsrp ) {
m_udpMetadata = false ; // USRP disables metadata due to USRP always having metadata
m_udpRTPFrames = false ; // USRP disables RTP
m_udpUseULaw = false ; // USRP disables ULaw
}
m_udpRTPFrames = systemConf [ " udpRTPFrames " ] . as < bool > ( false ) ;
m_udpIgnoreRTPTiming = systemConf [ " udpIgnoreRTPTiming " ] . as < bool > ( false ) ;
m_udpUseULaw = systemConf [ " udpUseULaw " ] . as < bool > ( false ) ;
if ( m_udpRTPFrames ) {
m_udpUsrp = false ; // RTP disabled USRP
m_udpFrameTiming = false ;
}
else {
if ( m_udpUseULaw ) {
: : LogWarning ( LOG_HOST , " uLaw encoding can only be used with RTP frames, disabling. " ) ;
m_udpUseULaw = false ;
}
}
if ( m_udpIgnoreRTPTiming )
: : LogWarning ( LOG_HOST , " Ignoring RTP timing, audio frames will be processed as they arrive. " ) ;
yaml : : Node tekConf = systemConf [ " tek " ] ;
bool tekEnable = tekConf [ " enable " ] . as < bool > ( false ) ;
std : : string tekAlgo = tekConf [ " tekAlgo " ] . as < std : : string > ( ) ;
std : : transform ( tekAlgo . begin ( ) , tekAlgo . end ( ) , tekAlgo . begin ( ) , : : tolower ) ;
m_tekKeyId = ( uint32_t ) : : strtoul ( tekConf [ " tekKeyId " ] . as < std : : string > ( " 0 " ) . c_str ( ) , NULL , 16 ) ;
if ( tekEnable & & m_tekKeyId > 0U ) {
if ( tekAlgo = = TEK_AES )
m_tekAlgoId = P25DEF : : ALGO_AES_256 ;
else if ( tekAlgo = = TEK_ARC4 )
m_tekAlgoId = P25DEF : : ALGO_ARC4 ;
else if ( tekAlgo = = TEK_DES )
m_tekAlgoId = P25DEF : : ALGO_DES ;
else {
: : LogError ( LOG_HOST , " Invalid TEK algorithm specified, must be \" aes \" or \" adp \" . " ) ;
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
m_tekKeyId = 0U ;
}
}
if ( ! tekEnable )
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
if ( m_tekAlgoId = = P25DEF : : ALGO_UNENCRYPT )
m_tekKeyId = 0U ;
// ensure encryption is currently disabled for DMR (its not supported)
if ( m_txMode = = TX_MODE_DMR & & m_tekAlgoId ! = P25DEF : : ALGO_UNENCRYPT & & m_tekKeyId > 0U ) {
: : LogError ( LOG_HOST , " Encryption is not supported for DMR. Disabling. " ) ;
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
m_tekKeyId = 0U ;
}
// ensure encryption is currently disabled for analog (its not supported)
if ( m_txMode = = TX_MODE_ANALOG & & m_tekAlgoId ! = P25DEF : : ALGO_UNENCRYPT & & m_tekKeyId > 0U ) {
: : LogError ( LOG_HOST , " Encryption is not supported for Analog. Disabling. " ) ;
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
m_tekKeyId = 0U ;
}
// RTS PTT Configuration
m_rtsPttEnable = systemConf [ " rtsPttEnable " ] . as < bool > ( false ) ;
@ -1040,7 +1109,27 @@ bool HostBridge::readParams()
LogInfo ( " Preamble Tone Length: %ums " , m_preambleLength ) ;
LogInfo ( " Grant Demands: %s " , m_grantDemand ? " yes " : " no " ) ;
LogInfo ( " Local Audio: %s " , m_localAudio ? " yes " : " no " ) ;
LogInfo ( " UDP Audio: %s " , m_udpAudio ? " yes " : " no " ) ;
LogInfo ( " PCM over UDP Audio: %s " , m_udpAudio ? " yes " : " no " ) ;
if ( m_udpAudio ) {
LogInfo ( " UDP Audio Metadata: %s " , m_udpMetadata ? " yes " : " no " ) ;
LogInfo ( " UDP Audio Send Address: %s " , m_udpSendAddress . c_str ( ) ) ;
LogInfo ( " UDP Audio Send Port: %u " , m_udpSendPort ) ;
LogInfo ( " UDP Audio Receive Address: %s " , m_udpReceiveAddress . c_str ( ) ) ;
LogInfo ( " UDP Audio Receive Port: %u " , m_udpReceivePort ) ;
LogInfo ( " UDP Audio RTP Framed: %s " , m_udpRTPFrames ? " yes " : " no " ) ;
if ( m_udpRTPFrames ) {
LogInfo ( " UDP Audio Use uLaw Encoding: %s " , m_udpUseULaw ? " yes " : " no " ) ;
LogInfo ( " UDP Audio Ignore RTP Timing: %s " , m_udpIgnoreRTPTiming ? " yes " : " no " ) ;
}
LogInfo ( " UDP Audio USRP: %s " , m_udpUsrp ? " yes " : " no " ) ;
LogInfo ( " UDP Frame Timing: %s " , m_udpFrameTiming ? " yes " : " no " ) ;
}
LogInfo ( " Traffic Encrypted: %s " , tekEnable ? " yes " : " no " ) ;
if ( tekEnable ) {
LogInfo ( " TEK Algorithm: %s " , tekAlgo . c_str ( ) ) ;
LogInfo ( " TEK Key ID: $%04X " , m_tekKeyId ) ;
}
LogInfo ( " RTS PTT Enable: %s " , m_rtsPttEnable ? " yes " : " no " ) ;
if ( m_rtsPttEnable ) {
LogInfo ( " RTS PTT Port: %s " , m_rtsPttPort . c_str ( ) ) ;
@ -1075,75 +1164,6 @@ bool HostBridge::createNetwork()
bool packetDump = networkConf [ " packetDump " ] . as < bool > ( false ) ;
bool debug = networkConf [ " debug " ] . as < bool > ( false ) ;
m_udpAudio = networkConf [ " udpAudio " ] . as < bool > ( false ) ;
m_udpMetadata = networkConf [ " udpMetadata " ] . as < bool > ( false ) ;
m_udpSendPort = ( uint16_t ) networkConf [ " udpSendPort " ] . as < uint32_t > ( 34001 ) ;
m_udpSendAddress = networkConf [ " udpSendAddress " ] . as < std : : string > ( ) ;
m_udpReceivePort = ( uint16_t ) networkConf [ " udpReceivePort " ] . as < uint32_t > ( 34001 ) ;
m_udpReceiveAddress = networkConf [ " udpReceiveAddress " ] . as < std : : string > ( ) ;
m_udpUsrp = networkConf [ " udpUsrp " ] . as < bool > ( false ) ;
m_udpFrameTiming = networkConf [ " udpFrameTiming " ] . as < bool > ( false ) ;
if ( m_udpUsrp ) {
m_udpMetadata = false ; // USRP disables metadata due to USRP always having metadata
m_udpRTPFrames = false ; // USRP disables RTP
m_udpUseULaw = false ; // USRP disables ULaw
}
m_udpRTPFrames = networkConf [ " udpRTPFrames " ] . as < bool > ( false ) ;
m_udpIgnoreRTPTiming = networkConf [ " udpIgnoreRTPTiming " ] . as < bool > ( false ) ;
m_udpUseULaw = networkConf [ " udpUseULaw " ] . as < bool > ( false ) ;
if ( m_udpRTPFrames ) {
m_udpUsrp = false ; // RTP disabled USRP
m_udpFrameTiming = false ;
} else {
if ( m_udpUseULaw ) {
: : LogWarning ( LOG_HOST , " uLaw encoding can only be used with RTP frames, disabling. " ) ;
m_udpUseULaw = false ;
}
}
if ( m_udpIgnoreRTPTiming )
: : LogWarning ( LOG_HOST , " Ignoring RTP timing, audio frames will be processed as they arrive. " ) ;
yaml : : Node tekConf = networkConf [ " tek " ] ;
bool tekEnable = tekConf [ " enable " ] . as < bool > ( false ) ;
std : : string tekAlgo = tekConf [ " tekAlgo " ] . as < std : : string > ( ) ;
std : : transform ( tekAlgo . begin ( ) , tekAlgo . end ( ) , tekAlgo . begin ( ) , : : tolower ) ;
m_tekKeyId = ( uint32_t ) : : strtoul ( tekConf [ " tekKeyId " ] . as < std : : string > ( " 0 " ) . c_str ( ) , NULL , 16 ) ;
if ( tekEnable & & m_tekKeyId > 0U ) {
if ( tekAlgo = = TEK_AES )
m_tekAlgoId = P25DEF : : ALGO_AES_256 ;
else if ( tekAlgo = = TEK_ARC4 )
m_tekAlgoId = P25DEF : : ALGO_ARC4 ;
else if ( tekAlgo = = TEK_DES )
m_tekAlgoId = P25DEF : : ALGO_DES ;
else {
: : LogError ( LOG_HOST , " Invalid TEK algorithm specified, must be \" aes \" or \" adp \" . " ) ;
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
m_tekKeyId = 0U ;
}
}
if ( ! tekEnable )
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
if ( m_tekAlgoId = = P25DEF : : ALGO_UNENCRYPT )
m_tekKeyId = 0U ;
// ensure encryption is currently disabled for DMR (its not supported)
if ( m_txMode = = TX_MODE_DMR & & m_tekAlgoId ! = P25DEF : : ALGO_UNENCRYPT & & m_tekKeyId > 0U ) {
: : LogError ( LOG_HOST , " Encryption is not supported for DMR. Disabling. " ) ;
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
m_tekKeyId = 0U ;
}
// ensure encryption is currently disabled for analog (its not supported)
if ( m_txMode = = TX_MODE_ANALOG & & m_tekAlgoId ! = P25DEF : : ALGO_UNENCRYPT & & m_tekKeyId > 0U ) {
: : LogError ( LOG_HOST , " Encryption is not supported for Analog. Disabling. " ) ;
m_tekAlgoId = P25DEF : : ALGO_UNENCRYPT ;
m_tekKeyId = 0U ;
}
m_srcId = ( uint32_t ) networkConf [ " sourceId " ] . as < uint32_t > ( P25DEF : : WUID_FNE ) ;
m_overrideSrcIdFromMDC = networkConf [ " overrideSourceIdFromMDC " ] . as < bool > ( false ) ;
m_overrideSrcIdFromUDP = networkConf [ " overrideSourceIdFromUDP " ] . as < bool > ( false ) ;
@ -1236,29 +1256,6 @@ bool HostBridge::createNetwork()
LogInfo ( " Local: random " ) ;
LogInfo ( " Encrypted: %s " , encrypted ? " yes " : " no " ) ;
LogInfo ( " PCM over UDP Audio: %s " , m_udpAudio ? " yes " : " no " ) ;
if ( m_udpAudio ) {
LogInfo ( " UDP Audio Metadata: %s " , m_udpMetadata ? " yes " : " no " ) ;
LogInfo ( " UDP Audio Send Address: %s " , m_udpSendAddress . c_str ( ) ) ;
LogInfo ( " UDP Audio Send Port: %u " , m_udpSendPort ) ;
LogInfo ( " UDP Audio Receive Address: %s " , m_udpReceiveAddress . c_str ( ) ) ;
LogInfo ( " UDP Audio Receive Port: %u " , m_udpReceivePort ) ;
LogInfo ( " UDP Audio RTP Framed: %s " , m_udpRTPFrames ? " yes " : " no " ) ;
if ( m_udpRTPFrames ) {
LogInfo ( " UDP Audio Use uLaw Encoding: %s " , m_udpUseULaw ? " yes " : " no " ) ;
LogInfo ( " UDP Audio Ignore RTP Timing: %s " , m_udpIgnoreRTPTiming ? " yes " : " no " ) ;
}
LogInfo ( " UDP Audio USRP: %s " , m_udpUsrp ? " yes " : " no " ) ;
LogInfo ( " UDP Frame Timing: %s " , m_udpFrameTiming ? " yes " : " no " ) ;
}
LogInfo ( " Traffic Encrypted: %s " , tekEnable ? " yes " : " no " ) ;
if ( tekEnable ) {
LogInfo ( " TEK Algorithm: %s " , tekAlgo . c_str ( ) ) ;
LogInfo ( " TEK Key ID: $%04X " , m_tekKeyId ) ;
}
LogInfo ( " Source ID: %u " , m_srcId ) ;
LogInfo ( " Destination ID: %u " , m_dstId ) ;
LogInfo ( " DMR Slot: %u " , m_slot ) ;