h_dcc.c : Return correct error when no service request (#877)

This commit is contained in:
Jonathan
2024-12-18 18:40:23 +01:00
committed by GitHub
parent f0461078ba
commit 389b6a7d4d
2 changed files with 16 additions and 6 deletions
+15 -5
View File
@@ -113,7 +113,17 @@ void handler_device_communication_control(
"DeviceCommunicationControl: "
"Sending Abort - segmented message.\n");
#endif
goto DCC_ABORT;
goto DCC_FAILURE;
}
if (!service_request || service_len == 0) {
len = reject_encode_apdu(
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id,
REJECT_REASON_MISSING_REQUIRED_PARAMETER);
#if PRINT_ENABLED
fprintf(stderr, "DCC: Sending Reject!\n");
#endif
goto DCC_FAILURE;
}
/* decode the service request only */
len = dcc_decode_service_request(
@@ -146,7 +156,7 @@ void handler_device_communication_control(
fprintf(stderr, "DCC: Sending Reject!\n");
#endif
}
goto DCC_ABORT;
goto DCC_FAILURE;
}
#if (BACNET_PROTOCOL_REVISION >= 20)
if (state == COMMUNICATION_DISABLE) {
@@ -163,7 +173,7 @@ void handler_device_communication_control(
"DeviceCommunicationControl: "
"Sending Error - DISABLE has been deprecated.\n");
#endif
goto DCC_ABORT;
goto DCC_FAILURE;
}
#endif
if (state >= MAX_BACNET_COMMUNICATION_ENABLE_DISABLE) {
@@ -183,7 +193,7 @@ void handler_device_communication_control(
SERVICE_SUPPORTED_DEVICE_COMMUNICATION_CONTROL, (int)state,
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id);
if (len > 0) {
goto DCC_ABORT;
goto DCC_FAILURE;
}
#endif
if ((My_Password[0] == '\0') ||
@@ -211,7 +221,7 @@ void handler_device_communication_control(
#endif
}
}
DCC_ABORT:
DCC_FAILURE:
pdu_len += len;
len = datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
+1 -1
View File
@@ -250,7 +250,7 @@ int dcc_encode_apdu(
* @param apdu Pointer to the received request.
* @param apdu_len_max Valid count of bytes in the buffer.
* @param timeDuration Pointer to the duration given in minutes [optional]
* @param enable_disable Pointer to the variable takingthe communication
* @param enable_disable Pointer to the variable taking the communication
* enable/disable.
* @param password Pointer to the password [optional]
*