Feature/comments and buffer checks (#73)
* Added comments * Replaced Goto construct * Added apdu_len check * Added comments * Added string limit and reworked printable check * Mainly comments * Just comments * Just comments * decode service request returns now non zero on success * eliminated warnings * Added character string init with length check. * Paranoic length check * Comments and object index checking on read/write. * Check name/desc strings before returning. * Eliminated Goto
This commit is contained in:
+27
-15
@@ -37,11 +37,15 @@
|
||||
|
||||
/** @file alarm_ack.c Handles Event Notifications (ACKs) */
|
||||
|
||||
/***************************************************
|
||||
**
|
||||
** Creates an Unconfirmed Event Notification APDU
|
||||
**
|
||||
****************************************************/
|
||||
/**
|
||||
* @brief Creates an Unconfirmed Event Notification APDU
|
||||
*
|
||||
* @param apdu Transmission buffer
|
||||
* @param invoke_id Invoked ID
|
||||
* @param data Alarm acknowledge data that will be copied into the payload.
|
||||
*
|
||||
* @return Length of the APDU
|
||||
*/
|
||||
int alarm_ack_encode_apdu(
|
||||
uint8_t *apdu, uint8_t invoke_id, BACNET_ALARM_ACK_DATA *data)
|
||||
{
|
||||
@@ -62,11 +66,15 @@ int alarm_ack_encode_apdu(
|
||||
return apdu_len;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
**
|
||||
** Encodes the service data part of Event Notification
|
||||
**
|
||||
****************************************************/
|
||||
/**
|
||||
* @brief Encodes the service data part of Event Notification.
|
||||
*
|
||||
* @param apdu Receive buffer
|
||||
* @param data Alarm acknowledge data that will be filled in
|
||||
* with the data from the payload.
|
||||
*
|
||||
* @return Total length of the apdu
|
||||
*/
|
||||
int alarm_ack_encode_service_request(uint8_t *apdu, BACNET_ALARM_ACK_DATA *data)
|
||||
{
|
||||
int len = 0; /* length of each encoding */
|
||||
@@ -102,11 +110,15 @@ int alarm_ack_encode_service_request(uint8_t *apdu, BACNET_ALARM_ACK_DATA *data)
|
||||
return apdu_len;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
**
|
||||
** Decodes the service data part of Event Notification
|
||||
**
|
||||
****************************************************/
|
||||
/**
|
||||
* @brief Decodes the service data part of Event Notification.
|
||||
*
|
||||
* @param apdu Receive buffer
|
||||
* @param apdu_len Bytes valid in the buffer.
|
||||
* @param data Alarm acknowledge data that will be filled.
|
||||
*
|
||||
* @return Total length of the apdu
|
||||
*/
|
||||
int alarm_ack_decode_service_request(
|
||||
uint8_t *apdu, unsigned apdu_len, BACNET_ALARM_ACK_DATA *data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user