mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 16:25:45 +08:00
Handle rejected M17 RF transmissions.
This commit is contained in:
6
Log.cpp
6
Log.cpp
@@ -149,6 +149,12 @@ void LogFinalise()
|
|||||||
{
|
{
|
||||||
if (m_fpLog != NULL)
|
if (m_fpLog != NULL)
|
||||||
::fclose(m_fpLog);
|
::fclose(m_fpLog);
|
||||||
|
|
||||||
|
if (m_mqtt != NULL) {
|
||||||
|
m_mqtt->close();
|
||||||
|
delete m_mqtt;
|
||||||
|
m_mqtt = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log(unsigned int level, const char* fmt, ...)
|
void Log(unsigned int level, const char* fmt, ...)
|
||||||
|
|||||||
@@ -683,6 +683,7 @@ bool CM17Control::processRFHeader(bool lateEntry)
|
|||||||
if (type != M17_ENCRYPTION_TYPE_NONE) {
|
if (type != M17_ENCRYPTION_TYPE_NONE) {
|
||||||
LogMessage("M17, access attempt with encryption from %s to %s", m_source.c_str(), m_dest.c_str());
|
LogMessage("M17, access attempt with encryption from %s to %s", m_source.c_str(), m_dest.c_str());
|
||||||
m_rfState = RS_RF_REJECTED;
|
m_rfState = RS_RF_REJECTED;
|
||||||
|
writeJSON("rejected", RS_RF_AUDIO, m_source, m_dest);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -692,6 +693,7 @@ bool CM17Control::processRFHeader(bool lateEntry)
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
LogMessage("M17, invalid access attempt from %s to %s", m_source.c_str(), m_dest.c_str());
|
LogMessage("M17, invalid access attempt from %s to %s", m_source.c_str(), m_dest.c_str());
|
||||||
m_rfState = RS_RF_REJECTED;
|
m_rfState = RS_RF_REJECTED;
|
||||||
|
writeJSON("rejected", RS_RF_AUDIO, m_source, m_dest);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ bool CMQTTPublisher::open()
|
|||||||
|
|
||||||
rc = ::mosquitto_loop_start(m_mosq);
|
rc = ::mosquitto_loop_start(m_mosq);
|
||||||
if (rc != MOSQ_ERR_SUCCESS) {
|
if (rc != MOSQ_ERR_SUCCESS) {
|
||||||
|
::mosquitto_disconnect(m_mosq);
|
||||||
::mosquitto_destroy(m_mosq);
|
::mosquitto_destroy(m_mosq);
|
||||||
m_mosq = NULL;
|
m_mosq = NULL;
|
||||||
::fprintf(stderr, "MQTT Error loop starting: %s\n", ::mosquitto_strerror(rc));
|
::fprintf(stderr, "MQTT Error loop starting: %s\n", ::mosquitto_strerror(rc));
|
||||||
@@ -97,9 +98,11 @@ bool CMQTTPublisher::publish(const char* topic, const char* text)
|
|||||||
|
|
||||||
void CMQTTPublisher::close()
|
void CMQTTPublisher::close()
|
||||||
{
|
{
|
||||||
::mosquitto_disconnect(m_mosq);
|
if (m_mosq != NULL) {
|
||||||
::mosquitto_destroy(m_mosq);
|
::mosquitto_disconnect(m_mosq);
|
||||||
m_mosq = NULL;
|
::mosquitto_destroy(m_mosq);
|
||||||
|
m_mosq = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMQTTPublisher::onConnect(mosquitto* mosq, void* obj, int rc)
|
void CMQTTPublisher::onConnect(mosquitto* mosq, void* obj, int rc)
|
||||||
|
|||||||
22
schema.json
22
schema.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$defs": {
|
"$defs": {
|
||||||
"mmdvm_state": {"enum": ["lockout", "idle", "d-star", "dmr", "ysf", "nxdn", "pocsag", "fm", "ax,25", "m17"]},
|
"mmdvm_state": {"type": "string", "enum": ["lockout", "idle", "d-star", "dmr", "ysf", "nxdn", "pocsag", "fm", "ax,25", "m17"]},
|
||||||
"dstar_callsign": {"type": "string", "minLength": 8, "maxLength": 8},
|
"dstar_callsign": {"type": "string", "minLength": 8, "maxLength": 8},
|
||||||
"dstar_extension": {"type": "string", "minLength": 4, "maxLength": 4},
|
"dstar_extension": {"type": "string", "minLength": 4, "maxLength": 4},
|
||||||
"ysf_callsign": {"type": "string", "minLength": 10, "maxLength": 10},
|
"ysf_callsign": {"type": "string", "minLength": 10, "maxLength": 10},
|
||||||
@@ -10,17 +10,17 @@
|
|||||||
"p25_id": {"type": "integer", "minimum": 1, "maximum": 65535},
|
"p25_id": {"type": "integer", "minimum": 1, "maximum": 65535},
|
||||||
"nxdn_id": {"type": "integer", "minimum": 1, "maximum": 65535},
|
"nxdn_id": {"type": "integer", "minimum": 1, "maximum": 65535},
|
||||||
"pocsag_ric": {"type": "integer"},
|
"pocsag_ric": {"type": "integer"},
|
||||||
"id_type": {"enum": ["group", "individual"]},
|
"id_type": {"type": "string", "enum": ["group", "individual"]},
|
||||||
"ysf_mode": {"enum": ["v/d_1", "v/d_2", "voice_fr", "data_fr"]},
|
"ysf_mode": {"type": "string", "enum": ["v/d_1", "v/d_2", "voice_fr", "data_fr"]},
|
||||||
"ax25_type": {"enum": ["sabm", "disc", "ui", "ua", "rr", "rnr", "rej", "frmr", "i"]},
|
"ax25_type": {"type": "string", "enum": ["sabm", "disc", "ui", "ua", "rr", "rnr", "rej", "frmr", "i"]},
|
||||||
"dmr_slot": {"enum": [1, 2]},
|
"dmr_slot": {"type": "integer", "enum": [1, 2]},
|
||||||
"source": {"enum": ["rf", "network"]},
|
"source": {"type": "string", "enum": ["rf", "network"]},
|
||||||
"fm_state": {"enum": ["waiting_rf", "waiting_network"]},
|
"fm_state": {"type": "string", "enum": ["waiting_rf", "waiting_network"]},
|
||||||
"m17_traffic_type": {"enum": ["audio", "audio_data", "data"]},
|
"m17_traffic_type": {"type": "string", "enum": ["audio", "audio_data", "data"]},
|
||||||
"ax25_pid": {"type": "string"},
|
"ax25_pid": {"type": "string"},
|
||||||
"pocsag_source": {"enum": ["local", "network"]},
|
"pocsag_source": {"type": "string", "enum": ["local", "network"]},
|
||||||
"pocsag_function": {"enum": ["numeric", "alphanumeric", "alert_1", "alert_2"]},
|
"pocsag_function": {"type": "string", "enum": ["numeric", "alphanumeric", "alert_1", "alert_2"]},
|
||||||
"action": {"enum": ["invalid", "rejected", "header", "late_entry", "end", "lost"]},
|
"action": {"type": "string", "enum": ["invalid", "rejected", "header", "late_entry", "end", "lost"]},
|
||||||
"duration": {"type": "number", "minimum": 0.0},
|
"duration": {"type": "number", "minimum": 0.0},
|
||||||
"loss": {"type": "number", "minimum": 0.0},
|
"loss": {"type": "number", "minimum": 0.0},
|
||||||
"ber": {"type": "number", "minimum": 0.0},
|
"ber": {"type": "number", "minimum": 0.0},
|
||||||
|
|||||||
Reference in New Issue
Block a user