Corrected warnings found by splint.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
-Iinclude -Iports/linux -castfcnptr -fullinitblock -weak +posixlib
|
-Iinclude -Iports/linux -castfcnptr -fullinitblock -initallelements -weak +posixlib
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ extern "C" {
|
|||||||
uint8_t * apdu);
|
uint8_t * apdu);
|
||||||
int encode_context_null(
|
int encode_context_null(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number);
|
uint8_t tag_number);
|
||||||
|
|
||||||
/* from clause 20.2.3 Encoding of a Boolean Value */
|
/* from clause 20.2.3 Encoding of a Boolean Value */
|
||||||
int encode_application_boolean(
|
int encode_application_boolean(
|
||||||
@@ -137,7 +137,7 @@ extern "C" {
|
|||||||
BACNET_BIT_STRING * bit_string);
|
BACNET_BIT_STRING * bit_string);
|
||||||
int encode_context_bitstring(
|
int encode_context_bitstring(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_BIT_STRING * bit_string);
|
BACNET_BIT_STRING * bit_string);
|
||||||
|
|
||||||
/* from clause 20.2.6 Encoding of a Real Number Value */
|
/* from clause 20.2.6 Encoding of a Real Number Value */
|
||||||
@@ -148,7 +148,7 @@ extern "C" {
|
|||||||
float value);
|
float value);
|
||||||
int encode_context_real(
|
int encode_context_real(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
float value);
|
float value);
|
||||||
|
|
||||||
/* from clause 20.2.7 Encoding of a Double Precision Real Number Value */
|
/* from clause 20.2.7 Encoding of a Double Precision Real Number Value */
|
||||||
@@ -160,7 +160,7 @@ extern "C" {
|
|||||||
|
|
||||||
int encode_context_double(
|
int encode_context_double(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
double value);
|
double value);
|
||||||
|
|
||||||
/* from clause 20.2.14 Encoding of an Object Identifier Value */
|
/* from clause 20.2.14 Encoding of an Object Identifier Value */
|
||||||
@@ -183,7 +183,7 @@ extern "C" {
|
|||||||
uint32_t instance);
|
uint32_t instance);
|
||||||
int encode_context_object_id(
|
int encode_context_object_id(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
int object_type,
|
int object_type,
|
||||||
uint32_t instance);
|
uint32_t instance);
|
||||||
int encode_application_object_id(
|
int encode_application_object_id(
|
||||||
@@ -202,7 +202,7 @@ extern "C" {
|
|||||||
BACNET_OCTET_STRING * octet_string);
|
BACNET_OCTET_STRING * octet_string);
|
||||||
int encode_context_octet_string(
|
int encode_context_octet_string(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_OCTET_STRING * octet_string);
|
BACNET_OCTET_STRING * octet_string);
|
||||||
int decode_octet_string(
|
int decode_octet_string(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
@@ -225,7 +225,7 @@ extern "C" {
|
|||||||
BACNET_CHARACTER_STRING * char_string);
|
BACNET_CHARACTER_STRING * char_string);
|
||||||
int encode_context_character_string(
|
int encode_context_character_string(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_CHARACTER_STRING * char_string);
|
BACNET_CHARACTER_STRING * char_string);
|
||||||
int decode_character_string(
|
int decode_character_string(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
@@ -245,7 +245,7 @@ extern "C" {
|
|||||||
uint32_t value);
|
uint32_t value);
|
||||||
int encode_context_unsigned(
|
int encode_context_unsigned(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
uint32_t value);
|
uint32_t value);
|
||||||
int encode_application_unsigned(
|
int encode_application_unsigned(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
@@ -270,7 +270,7 @@ extern "C" {
|
|||||||
int32_t value);
|
int32_t value);
|
||||||
int encode_context_signed(
|
int encode_context_signed(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
int32_t value);
|
int32_t value);
|
||||||
int decode_signed(
|
int decode_signed(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
@@ -301,7 +301,7 @@ extern "C" {
|
|||||||
uint32_t value);
|
uint32_t value);
|
||||||
int encode_context_enumerated(
|
int encode_context_enumerated(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
uint32_t value);
|
uint32_t value);
|
||||||
|
|
||||||
/* from clause 20.2.13 Encoding of a Time Value */
|
/* from clause 20.2.13 Encoding of a Time Value */
|
||||||
@@ -318,7 +318,7 @@ extern "C" {
|
|||||||
BACNET_TIME * btime);
|
BACNET_TIME * btime);
|
||||||
int encode_context_time(
|
int encode_context_time(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_TIME * btime);
|
BACNET_TIME * btime);
|
||||||
int decode_application_time(
|
int decode_application_time(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
@@ -346,7 +346,7 @@ extern "C" {
|
|||||||
BACNET_DATE * bdate);
|
BACNET_DATE * bdate);
|
||||||
int encode_context_date(
|
int encode_context_date(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_DATE * bdate);
|
BACNET_DATE * bdate);
|
||||||
int decode_date(
|
int decode_date(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
|
|||||||
@@ -54,43 +54,43 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
const char *bactext_confirmed_service_name(
|
const char *bactext_confirmed_service_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_unconfirmed_service_name(
|
const char *bactext_unconfirmed_service_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_application_tag_name(
|
const char *bactext_application_tag_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_object_type_name(
|
const char *bactext_object_type_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_property_name(
|
const char *bactext_property_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_engineering_unit_name(
|
const char *bactext_engineering_unit_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_reject_reason_name(
|
const char *bactext_reject_reason_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_abort_reason_name(
|
const char *bactext_abort_reason_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_error_class_name(
|
const char *bactext_error_class_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_error_code_name(
|
const char *bactext_error_code_name(
|
||||||
int index);
|
unsigned index);
|
||||||
unsigned bactext_property_id(
|
unsigned bactext_property_id(
|
||||||
const char *name);
|
const char *name);
|
||||||
const char *bactext_month_name(
|
const char *bactext_month_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_week_of_month_name(
|
const char *bactext_week_of_month_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_day_of_week_name(
|
const char *bactext_day_of_week_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_event_state_name(
|
const char *bactext_event_state_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_binary_present_value_name(
|
const char *bactext_binary_present_value_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_reliability_name(
|
const char *bactext_reliability_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_device_status_name(
|
const char *bactext_device_status_name(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *bactext_segmentation_name(
|
const char *bactext_segmentation_name(
|
||||||
int index);
|
unsigned index);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ extern "C" {
|
|||||||
the before_split_default_name is used */
|
the before_split_default_name is used */
|
||||||
const char *indtext_by_index_split_default(
|
const char *indtext_by_index_split_default(
|
||||||
INDTEXT_DATA * data_list,
|
INDTEXT_DATA * data_list,
|
||||||
int index,
|
unsigned index,
|
||||||
int split_index,
|
unsigned split_index,
|
||||||
const char *before_split_default_name,
|
const char *before_split_default_name,
|
||||||
const char *default_name);
|
const char *default_name);
|
||||||
|
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
const char *mstptext_receive_state(
|
const char *mstptext_receive_state(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *mstptext_master_state(
|
const char *mstptext_master_state(
|
||||||
int index);
|
unsigned index);
|
||||||
const char *mstptext_frame_type(
|
const char *mstptext_frame_type(
|
||||||
int index);
|
unsigned index);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
[ -x /usr/bin/splint ] || exit 0
|
[ -x /usr/bin/splint ] || exit 0
|
||||||
|
|
||||||
INCLUDES="-Iinclude -Iports/linux"
|
INCLUDES="-Iinclude -Iports/linux"
|
||||||
SETTINGS="-castfcnptr -fullinitblock -weak +posixlib"
|
SETTINGS="-castfcnptr -fullinitblock -initallelements -weak +posixlib"
|
||||||
|
|
||||||
if [ ! -x .splintrc ]
|
if [ ! -x .splintrc ]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ static struct Address_Cache_Entry {
|
|||||||
bool address_match(BACNET_ADDRESS * dest,
|
bool address_match(BACNET_ADDRESS * dest,
|
||||||
BACNET_ADDRESS * src)
|
BACNET_ADDRESS * src)
|
||||||
{
|
{
|
||||||
unsigned i;
|
uint8_t i = 0;
|
||||||
unsigned max_len;
|
uint8_t max_len = 0;
|
||||||
|
|
||||||
if (dest->mac_len != src->mac_len)
|
if (dest->mac_len != src->mac_len)
|
||||||
return false;
|
return false;
|
||||||
@@ -120,7 +120,7 @@ void address_file_init(
|
|||||||
char line[256] = { "" }; /* holds line from file */
|
char line[256] = { "" }; /* holds line from file */
|
||||||
long device_id = 0;
|
long device_id = 0;
|
||||||
int snet = 0;
|
int snet = 0;
|
||||||
int max_apdu = 0;
|
unsigned max_apdu = 0;
|
||||||
unsigned mac[6];
|
unsigned mac[6];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
char mac_string[80], sadr_string[80];
|
char mac_string[80], sadr_string[80];
|
||||||
@@ -129,24 +129,24 @@ void address_file_init(
|
|||||||
|
|
||||||
pFile = fopen(pFilename, "r");
|
pFile = fopen(pFilename, "r");
|
||||||
if (pFile) {
|
if (pFile) {
|
||||||
while (fgets(line, sizeof(line), pFile) != NULL) {
|
while (fgets(line, (int)sizeof(line), pFile) != NULL) {
|
||||||
/* ignore comments */
|
/* ignore comments */
|
||||||
if (line[0] != ';') {
|
if (line[0] != ';') {
|
||||||
if (sscanf(line, "%ld %s %d %s %d", &device_id, &mac_string[0],
|
if (sscanf(line, "%ld %s %d %s %u", &device_id, &mac_string[0],
|
||||||
&snet, &sadr_string[0], &max_apdu) == 5) {
|
&snet, &sadr_string[0], &max_apdu) == 5) {
|
||||||
count =
|
count =
|
||||||
sscanf(mac_string, "%x:%x:%x:%x:%x:%x", &mac[0],
|
sscanf(mac_string, "%x:%x:%x:%x:%x:%x", &mac[0],
|
||||||
&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
|
&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
|
||||||
src.mac_len = count;
|
src.mac_len = (uint8_t)count;
|
||||||
for (index = 0; index < MAX_MAC_LEN; index++) {
|
for (index = 0; index < MAX_MAC_LEN; index++) {
|
||||||
src.mac[index] = mac[index];
|
src.mac[index] = mac[index];
|
||||||
}
|
}
|
||||||
src.net = snet;
|
src.net = (uint8_t)snet;
|
||||||
if (snet) {
|
if (snet) {
|
||||||
count =
|
count =
|
||||||
sscanf(sadr_string, "%x:%x:%x:%x:%x:%x", &mac[0],
|
sscanf(sadr_string, "%x:%x:%x:%x:%x:%x", &mac[0],
|
||||||
&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
|
&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
|
||||||
src.len = count;
|
src.len = (uint8_t)count;
|
||||||
for (index = 0; index < MAX_MAC_LEN; index++) {
|
for (index = 0; index < MAX_MAC_LEN; index++) {
|
||||||
src.adr[index] = mac[index];
|
src.adr[index] = mac[index];
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ void address_file_init(
|
|||||||
src.adr[index] = 0;
|
src.adr[index] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
address_add(device_id, max_apdu, &src);
|
address_add((uint32_t)device_id, max_apdu, &src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ bool bacnet_address_same(
|
|||||||
BACNET_ADDRESS * dest,
|
BACNET_ADDRESS * dest,
|
||||||
BACNET_ADDRESS * src)
|
BACNET_ADDRESS * src)
|
||||||
{
|
{
|
||||||
unsigned i;
|
uint8_t i = 0; /* loop counter */
|
||||||
unsigned max_len;
|
uint8_t max_len = 0; /* used for dynamic max */
|
||||||
bool match = true; /* return value */
|
bool match = true; /* return value */
|
||||||
|
|
||||||
if (dest->mac_len != src->mac_len)
|
if (dest->mac_len != src->mac_len)
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ int bacapp_encode_application_data(
|
|||||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||||
apdu_len =
|
apdu_len =
|
||||||
encode_application_object_id(&apdu[0],
|
encode_application_object_id(&apdu[0],
|
||||||
value->type.Object_Id.type,
|
(int)value->type.Object_Id.type,
|
||||||
value->type.Object_Id.instance);
|
value->type.Object_Id.instance);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -376,7 +376,7 @@ int bacapp_encode_context_data_value(
|
|||||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||||
apdu_len =
|
apdu_len =
|
||||||
encode_context_object_id(&apdu[0], context_tag_number,
|
encode_context_object_id(&apdu[0], context_tag_number,
|
||||||
value->type.Object_Id.type,
|
(int)value->type.Object_Id.type,
|
||||||
value->type.Object_Id.instance);
|
value->type.Object_Id.instance);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -686,7 +686,7 @@ int bacapp_data_len(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (apdu_len > max_apdu_len) {
|
if ((unsigned)apdu_len > max_apdu_len) {
|
||||||
/* error: exceeding our buffer limit */
|
/* error: exceeding our buffer limit */
|
||||||
total_len = -1;
|
total_len = -1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+24
-24
@@ -559,9 +559,9 @@ int encode_application_null(
|
|||||||
|
|
||||||
int encode_context_null(
|
int encode_context_null(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number)
|
uint8_t tag_number)
|
||||||
{
|
{
|
||||||
return encode_tag(&apdu[0], (uint8_t) tag_number, true, 0);
|
return encode_tag(&apdu[0], tag_number, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t byte_reverse_bits(
|
static uint8_t byte_reverse_bits(
|
||||||
@@ -696,7 +696,7 @@ int encode_application_bitstring(
|
|||||||
|
|
||||||
int encode_context_bitstring(
|
int encode_context_bitstring(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_BIT_STRING * bit_string)
|
BACNET_BIT_STRING * bit_string)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -705,7 +705,7 @@ int encode_context_bitstring(
|
|||||||
/* bit string may use more than 1 octet for the tag, so find out how many */
|
/* bit string may use more than 1 octet for the tag, so find out how many */
|
||||||
bit_string_encoded_length += bitstring_bytes_used(bit_string);
|
bit_string_encoded_length += bitstring_bytes_used(bit_string);
|
||||||
len =
|
len =
|
||||||
encode_tag(&apdu[0], (uint8_t) tag_number, true,
|
encode_tag(&apdu[0], tag_number, true,
|
||||||
bit_string_encoded_length);
|
bit_string_encoded_length);
|
||||||
len += encode_bitstring(&apdu[len], bit_string);
|
len += encode_bitstring(&apdu[len], bit_string);
|
||||||
|
|
||||||
@@ -771,7 +771,7 @@ int encode_bacnet_object_id(
|
|||||||
/* returns the number of apdu bytes consumed */
|
/* returns the number of apdu bytes consumed */
|
||||||
int encode_context_object_id(
|
int encode_context_object_id(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
int object_type,
|
int object_type,
|
||||||
uint32_t instance)
|
uint32_t instance)
|
||||||
{
|
{
|
||||||
@@ -781,7 +781,7 @@ int encode_context_object_id(
|
|||||||
len = encode_bacnet_object_id(&apdu[1], object_type, instance);
|
len = encode_bacnet_object_id(&apdu[1], object_type, instance);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if ((tag_number <= 14) && (len <= 4)) {
|
if ((tag_number <= 14) && (len <= 4)) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
@@ -859,14 +859,14 @@ int encode_application_octet_string(
|
|||||||
/* returns the number of apdu bytes consumed */
|
/* returns the number of apdu bytes consumed */
|
||||||
int encode_context_octet_string(
|
int encode_context_octet_string(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_OCTET_STRING * octet_string)
|
BACNET_OCTET_STRING * octet_string)
|
||||||
{
|
{
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
|
|
||||||
if (apdu && octet_string) {
|
if (apdu && octet_string) {
|
||||||
apdu_len =
|
apdu_len =
|
||||||
encode_tag(&apdu[0], (uint8_t) tag_number, true,
|
encode_tag(&apdu[0], tag_number, true,
|
||||||
octetstring_length(octet_string));
|
octetstring_length(octet_string));
|
||||||
if ((apdu_len + octetstring_length(octet_string)) < MAX_APDU) {
|
if ((apdu_len + octetstring_length(octet_string)) < MAX_APDU) {
|
||||||
apdu_len += encode_octet_string(&apdu[apdu_len], octet_string);
|
apdu_len += encode_octet_string(&apdu[apdu_len], octet_string);
|
||||||
@@ -966,14 +966,14 @@ int encode_application_character_string(
|
|||||||
|
|
||||||
int encode_context_character_string(
|
int encode_context_character_string(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_CHARACTER_STRING * char_string)
|
BACNET_CHARACTER_STRING * char_string)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int string_len = 0;
|
int string_len = 0;
|
||||||
|
|
||||||
string_len = (int)characterstring_length(char_string) + 1 /* for encoding */ ;
|
string_len = (int)characterstring_length(char_string) + 1 /* for encoding */ ;
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)string_len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)string_len);
|
||||||
if ((len + string_len) < MAX_APDU) {
|
if ((len + string_len) < MAX_APDU) {
|
||||||
len += encode_bacnet_character_string(&apdu[len], char_string);
|
len += encode_bacnet_character_string(&apdu[len], char_string);
|
||||||
} else {
|
} else {
|
||||||
@@ -1111,7 +1111,7 @@ int encode_bacnet_unsigned(
|
|||||||
/* returns the number of apdu bytes consumed */
|
/* returns the number of apdu bytes consumed */
|
||||||
int encode_context_unsigned(
|
int encode_context_unsigned(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
uint32_t value)
|
uint32_t value)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -1119,7 +1119,7 @@ int encode_context_unsigned(
|
|||||||
len = encode_bacnet_unsigned(&apdu[1], value);
|
len = encode_bacnet_unsigned(&apdu[1], value);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if ((tag_number <= 14) && (len <= 4)) {
|
if ((tag_number <= 14) && (len <= 4)) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
@@ -1212,7 +1212,7 @@ int encode_application_enumerated(
|
|||||||
/* returns the number of apdu bytes consumed */
|
/* returns the number of apdu bytes consumed */
|
||||||
int encode_context_enumerated(
|
int encode_context_enumerated(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
uint32_t value)
|
uint32_t value)
|
||||||
{
|
{
|
||||||
int len = 0; /* return value */
|
int len = 0; /* return value */
|
||||||
@@ -1221,7 +1221,7 @@ int encode_context_enumerated(
|
|||||||
len = encode_bacnet_enumerated(&apdu[1], value);
|
len = encode_bacnet_enumerated(&apdu[1], value);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if ((tag_number <= 14) && (len <= 4)) {
|
if ((tag_number <= 14) && (len <= 4)) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
@@ -1326,7 +1326,7 @@ int encode_application_signed(
|
|||||||
/* returns the number of apdu bytes consumed */
|
/* returns the number of apdu bytes consumed */
|
||||||
int encode_context_signed(
|
int encode_context_signed(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
int32_t value)
|
int32_t value)
|
||||||
{
|
{
|
||||||
int len = 0; /* return value */
|
int len = 0; /* return value */
|
||||||
@@ -1335,7 +1335,7 @@ int encode_context_signed(
|
|||||||
len = encode_bacnet_signed(&apdu[1], value);
|
len = encode_bacnet_signed(&apdu[1], value);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if ((tag_number <= 14) && (len <= 4)) {
|
if ((tag_number <= 14) && (len <= 4)) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
@@ -1361,7 +1361,7 @@ int encode_application_real(
|
|||||||
|
|
||||||
int encode_context_real(
|
int encode_context_real(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
float value)
|
float value)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -1370,7 +1370,7 @@ int encode_context_real(
|
|||||||
len = encode_bacnet_real(value, &apdu[1]);
|
len = encode_bacnet_real(value, &apdu[1]);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if (tag_number <= 14) {
|
if (tag_number <= 14) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
@@ -1396,7 +1396,7 @@ int encode_application_double(
|
|||||||
|
|
||||||
int encode_context_double(
|
int encode_context_double(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
double value)
|
double value)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -1405,7 +1405,7 @@ int encode_context_double(
|
|||||||
len = encode_bacnet_double(value, &apdu[1]);
|
len = encode_bacnet_double(value, &apdu[1]);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if (tag_number <= 14) {
|
if (tag_number <= 14) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
@@ -1446,7 +1446,7 @@ int encode_application_time(
|
|||||||
|
|
||||||
int encode_context_time(
|
int encode_context_time(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_TIME * btime)
|
BACNET_TIME * btime)
|
||||||
{
|
{
|
||||||
int len = 0; /* return value */
|
int len = 0; /* return value */
|
||||||
@@ -1455,7 +1455,7 @@ int encode_context_time(
|
|||||||
len = encode_bacnet_time(&apdu[1], btime);
|
len = encode_bacnet_time(&apdu[1], btime);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if ((tag_number <= 14) && (len <= 4)) {
|
if ((tag_number <= 14) && (len <= 4)) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
@@ -1566,7 +1566,7 @@ int encode_application_date(
|
|||||||
|
|
||||||
int encode_context_date(
|
int encode_context_date(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_DATE * bdate)
|
BACNET_DATE * bdate)
|
||||||
{
|
{
|
||||||
int len = 0; /* return value */
|
int len = 0; /* return value */
|
||||||
@@ -1575,7 +1575,7 @@ int encode_context_date(
|
|||||||
len = encode_bacnet_date(&apdu[1], bdate);
|
len = encode_bacnet_date(&apdu[1], bdate);
|
||||||
/* we only reserved 1 byte for encoding the tag - check the limits */
|
/* we only reserved 1 byte for encoding the tag - check the limits */
|
||||||
if ((tag_number <= 14) && (len <= 4)) {
|
if ((tag_number <= 14) && (len <= 4)) {
|
||||||
len += encode_tag(&apdu[0], (uint8_t) tag_number, true, (uint32_t)len);
|
len += encode_tag(&apdu[0], tag_number, true, (uint32_t)len);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-18
@@ -76,7 +76,7 @@ INDTEXT_DATA bacnet_confirmed_service_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_confirmed_service_name(
|
const char *bactext_confirmed_service_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_confirmed_service_names, index,
|
return indtext_by_index_default(bacnet_confirmed_service_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -108,7 +108,7 @@ INDTEXT_DATA bacnet_unconfirmed_service_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_unconfirmed_service_name(
|
const char *bactext_unconfirmed_service_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_unconfirmed_service_names, index,
|
return indtext_by_index_default(bacnet_unconfirmed_service_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -151,7 +151,7 @@ INDTEXT_DATA bacnet_application_tag_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_application_tag_name(
|
const char *bactext_application_tag_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_application_tag_names, index,
|
return indtext_by_index_default(bacnet_application_tag_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -241,7 +241,7 @@ INDTEXT_DATA bacnet_object_type_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_object_type_name(
|
const char *bactext_object_type_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(bacnet_object_type_names, index, 128,
|
return indtext_by_index_split_default(bacnet_object_type_names, index, 128,
|
||||||
ASHRAE_Reserved_String, Vendor_Proprietary_String);
|
ASHRAE_Reserved_String, Vendor_Proprietary_String);
|
||||||
@@ -911,7 +911,7 @@ INDTEXT_DATA bacnet_property_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_property_name(
|
const char *bactext_property_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(bacnet_property_names, index, 512,
|
return indtext_by_index_split_default(bacnet_property_names, index, 512,
|
||||||
ASHRAE_Reserved_String, Vendor_Proprietary_String);
|
ASHRAE_Reserved_String, Vendor_Proprietary_String);
|
||||||
@@ -1318,7 +1318,7 @@ INDTEXT_DATA bacnet_engineering_unit_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_engineering_unit_name(
|
const char *bactext_engineering_unit_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(bacnet_engineering_unit_names, index,
|
return indtext_by_index_split_default(bacnet_engineering_unit_names, index,
|
||||||
256, ASHRAE_Reserved_String, Vendor_Proprietary_String);
|
256, ASHRAE_Reserved_String, Vendor_Proprietary_String);
|
||||||
@@ -1350,7 +1350,7 @@ INDTEXT_DATA bacnet_reject_reason_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_reject_reason_name(
|
const char *bactext_reject_reason_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(bacnet_reject_reason_names, index,
|
return indtext_by_index_split_default(bacnet_reject_reason_names, index,
|
||||||
FIRST_PROPRIETARY_REJECT_REASON, ASHRAE_Reserved_String,
|
FIRST_PROPRIETARY_REJECT_REASON, ASHRAE_Reserved_String,
|
||||||
@@ -1373,7 +1373,7 @@ INDTEXT_DATA bacnet_abort_reason_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_abort_reason_name(
|
const char *bactext_abort_reason_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(bacnet_abort_reason_names, index,
|
return indtext_by_index_split_default(bacnet_abort_reason_names, index,
|
||||||
FIRST_PROPRIETARY_ABORT_REASON, ASHRAE_Reserved_String,
|
FIRST_PROPRIETARY_ABORT_REASON, ASHRAE_Reserved_String,
|
||||||
@@ -1399,7 +1399,7 @@ INDTEXT_DATA bacnet_error_class_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_error_class_name(
|
const char *bactext_error_class_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(bacnet_error_class_names, index,
|
return indtext_by_index_split_default(bacnet_error_class_names, index,
|
||||||
FIRST_PROPRIETARY_ERROR_CLASS, ASHRAE_Reserved_String,
|
FIRST_PROPRIETARY_ERROR_CLASS, ASHRAE_Reserved_String,
|
||||||
@@ -1596,7 +1596,7 @@ INDTEXT_DATA bacnet_error_code_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_error_code_name(
|
const char *bactext_error_code_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(bacnet_error_code_names, index,
|
return indtext_by_index_split_default(bacnet_error_code_names, index,
|
||||||
FIRST_PROPRIETARY_ERROR_CLASS, ASHRAE_Reserved_String,
|
FIRST_PROPRIETARY_ERROR_CLASS, ASHRAE_Reserved_String,
|
||||||
@@ -1634,7 +1634,7 @@ INDTEXT_DATA bacnet_month_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_month_name(
|
const char *bactext_month_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_month_names, index,
|
return indtext_by_index_default(bacnet_month_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -1659,7 +1659,7 @@ INDTEXT_DATA bacnet_week_of_month_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_week_of_month_name(
|
const char *bactext_week_of_month_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_week_of_month_names, index,
|
return indtext_by_index_default(bacnet_week_of_month_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -1687,7 +1687,7 @@ INDTEXT_DATA bacnet_day_of_week_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_day_of_week_name(
|
const char *bactext_day_of_week_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_day_of_week_names, index,
|
return indtext_by_index_default(bacnet_day_of_week_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -1708,7 +1708,7 @@ INDTEXT_DATA bacnet_event_state_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_event_state_name(
|
const char *bactext_event_state_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_event_state_names, index,
|
return indtext_by_index_default(bacnet_event_state_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -1723,7 +1723,7 @@ INDTEXT_DATA bacnet_binary_present_value_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_binary_present_value_name(
|
const char *bactext_binary_present_value_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_binary_present_value_names, index,
|
return indtext_by_index_default(bacnet_binary_present_value_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -1756,7 +1756,7 @@ INDTEXT_DATA bacnet_reliability_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_reliability_name(
|
const char *bactext_reliability_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_reliability_names, index,
|
return indtext_by_index_default(bacnet_reliability_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -1777,7 +1777,7 @@ INDTEXT_DATA bacnet_device_status_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_device_status_name(
|
const char *bactext_device_status_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_device_status_names, index,
|
return indtext_by_index_default(bacnet_device_status_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
@@ -1796,7 +1796,7 @@ INDTEXT_DATA bacnet_segmentation_names[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *bactext_segmentation_name(
|
const char *bactext_segmentation_name(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(bacnet_segmentation_names, index,
|
return indtext_by_index_default(bacnet_segmentation_names, index,
|
||||||
ASHRAE_Reserved_String);
|
ASHRAE_Reserved_String);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ static int notify_encode_adpu(
|
|||||||
/* tag 2 - monitoredObjectIdentifier */
|
/* tag 2 - monitoredObjectIdentifier */
|
||||||
len =
|
len =
|
||||||
encode_context_object_id(&apdu[apdu_len], 2,
|
encode_context_object_id(&apdu[apdu_len], 2,
|
||||||
data->monitoredObjectIdentifier.type,
|
(int)data->monitoredObjectIdentifier.type,
|
||||||
data->monitoredObjectIdentifier.instance);
|
data->monitoredObjectIdentifier.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* tag 3 - timeRemaining */
|
/* tag 3 - timeRemaining */
|
||||||
@@ -338,7 +338,7 @@ int cov_subscribe_encode_adpu(
|
|||||||
/* tag 1 - monitoredObjectIdentifier */
|
/* tag 1 - monitoredObjectIdentifier */
|
||||||
len =
|
len =
|
||||||
encode_context_object_id(&apdu[apdu_len], 1,
|
encode_context_object_id(&apdu[apdu_len], 1,
|
||||||
data->monitoredObjectIdentifier.type,
|
(int)data->monitoredObjectIdentifier.type,
|
||||||
data->monitoredObjectIdentifier.instance);
|
data->monitoredObjectIdentifier.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/*
|
/*
|
||||||
@@ -467,7 +467,7 @@ int cov_subscribe_property_encode_adpu(
|
|||||||
/* tag 1 - monitoredObjectIdentifier */
|
/* tag 1 - monitoredObjectIdentifier */
|
||||||
len =
|
len =
|
||||||
encode_context_object_id(&apdu[apdu_len], 1,
|
encode_context_object_id(&apdu[apdu_len], 1,
|
||||||
data->monitoredObjectIdentifier.type,
|
(int)data->monitoredObjectIdentifier.type,
|
||||||
data->monitoredObjectIdentifier.instance);
|
data->monitoredObjectIdentifier.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
if (!data->cancellationRequest) {
|
if (!data->cancellationRequest) {
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ int iam_encode_apdu(
|
|||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
len = encode_application_unsigned(&apdu[apdu_len], max_apdu);
|
len = encode_application_unsigned(&apdu[apdu_len], max_apdu);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
len = encode_application_enumerated(&apdu[apdu_len], segmentation);
|
len = encode_application_enumerated(&apdu[apdu_len],
|
||||||
|
(uint32_t)segmentation);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
len = encode_application_unsigned(&apdu[apdu_len], vendor_id);
|
len = encode_application_unsigned(&apdu[apdu_len], vendor_id);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
@@ -106,7 +107,7 @@ int iam_decode_service_request(
|
|||||||
len = decode_unsigned(&apdu[apdu_len], len_value, &decoded_value);
|
len = decode_unsigned(&apdu[apdu_len], len_value, &decoded_value);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
if (pMax_apdu)
|
if (pMax_apdu)
|
||||||
*pMax_apdu = decoded_value;
|
*pMax_apdu = (unsigned)decoded_value;
|
||||||
/* Segmentation - enumerated */
|
/* Segmentation - enumerated */
|
||||||
len =
|
len =
|
||||||
decode_tag_number_and_value(&apdu[apdu_len], &tag_number, &len_value);
|
decode_tag_number_and_value(&apdu[apdu_len], &tag_number, &len_value);
|
||||||
@@ -118,7 +119,7 @@ int iam_decode_service_request(
|
|||||||
if (decoded_value >= MAX_BACNET_SEGMENTATION)
|
if (decoded_value >= MAX_BACNET_SEGMENTATION)
|
||||||
return -1;
|
return -1;
|
||||||
if (pSegmentation)
|
if (pSegmentation)
|
||||||
*pSegmentation = decoded_value;
|
*pSegmentation = (int)decoded_value;
|
||||||
/* Vendor ID - unsigned16 */
|
/* Vendor ID - unsigned16 */
|
||||||
len =
|
len =
|
||||||
decode_tag_number_and_value(&apdu[apdu_len], &tag_number, &len_value);
|
decode_tag_number_and_value(&apdu[apdu_len], &tag_number, &len_value);
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ int ihave_encode_apdu(
|
|||||||
apdu_len = 2;
|
apdu_len = 2;
|
||||||
/* deviceIdentifier */
|
/* deviceIdentifier */
|
||||||
len =
|
len =
|
||||||
encode_application_object_id(&apdu[apdu_len], data->device_id.type,
|
encode_application_object_id(&apdu[apdu_len], (int)data->device_id.type,
|
||||||
data->device_id.instance);
|
data->device_id.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* objectIdentifier */
|
/* objectIdentifier */
|
||||||
len =
|
len =
|
||||||
encode_application_object_id(&apdu[apdu_len], data->object_id.type,
|
encode_application_object_id(&apdu[apdu_len], (int)data->object_id.type,
|
||||||
data->object_id.instance);
|
data->object_id.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* objectName */
|
/* objectName */
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ int stricmp(
|
|||||||
unsigned char c1, c2;
|
unsigned char c1, c2;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
c1 = *s1;
|
c1 = (unsigned char)*s1;
|
||||||
c2 = *s2;
|
c2 = (unsigned char)*s2;
|
||||||
c1 = (unsigned char) tolower((unsigned char) c1);
|
c1 = (unsigned char) tolower(c1);
|
||||||
c2 = (unsigned char) tolower((unsigned char) c2);
|
c2 = (unsigned char) tolower(c2);
|
||||||
s1++;
|
s1++;
|
||||||
s2++;
|
s2++;
|
||||||
} while ((c1 == c2) && (c1 != '\0'));
|
} while ((c1 == c2) && (c1 != '\0'));
|
||||||
@@ -155,8 +155,8 @@ const char *indtext_by_index_default(
|
|||||||
|
|
||||||
const char *indtext_by_index_split_default(
|
const char *indtext_by_index_split_default(
|
||||||
INDTEXT_DATA * data_list,
|
INDTEXT_DATA * data_list,
|
||||||
int index,
|
unsigned index,
|
||||||
int split_index,
|
unsigned split_index,
|
||||||
const char *before_split_default_name,
|
const char *before_split_default_name,
|
||||||
const char *default_name)
|
const char *default_name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int lso_encode_adpu(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
len = encode_context_object_id(&apdu[apdu_len], 3,
|
len = encode_context_object_id(&apdu[apdu_len], 3,
|
||||||
data->targetObject.type,
|
(int)data->targetObject.type,
|
||||||
data->targetObject.instance);
|
data->targetObject.instance);
|
||||||
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ static INDTEXT_DATA mstp_receive_state_text[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *mstptext_receive_state(
|
const char *mstptext_receive_state(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(mstp_receive_state_text, index, "unknown");
|
return indtext_by_index_default(mstp_receive_state_text, index, "unknown");
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ static INDTEXT_DATA mstp_master_state_text[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *mstptext_master_state(
|
const char *mstptext_master_state(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_default(mstp_master_state_text, index, "unknown");
|
return indtext_by_index_default(mstp_master_state_text, index, "unknown");
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ static INDTEXT_DATA mstp_frame_type_text[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *mstptext_frame_type(
|
const char *mstptext_frame_type(
|
||||||
int index)
|
unsigned index)
|
||||||
{
|
{
|
||||||
return indtext_by_index_split_default(mstp_frame_type_text, index,
|
return indtext_by_index_split_default(mstp_frame_type_text, index,
|
||||||
FRAME_TYPE_PROPRIETARY_MIN, "UNKNOWN", "PROPRIETARY");
|
FRAME_TYPE_PROPRIETARY_MIN, "UNKNOWN", "PROPRIETARY");
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ int ptransfer_decode_service_request(
|
|||||||
unsigned apdu_len,
|
unsigned apdu_len,
|
||||||
BACNET_PRIVATE_TRANSFER_DATA * private_data)
|
BACNET_PRIVATE_TRANSFER_DATA * private_data)
|
||||||
{
|
{
|
||||||
unsigned len = 0; /* return value */
|
int len = 0; /* return value */
|
||||||
unsigned decode_len = 0; /* return value */
|
int decode_len = 0; /* return value */
|
||||||
uint32_t unsigned_value = 0;
|
uint32_t unsigned_value = 0;
|
||||||
|
|
||||||
/* check for value pointers */
|
/* check for value pointers */
|
||||||
@@ -111,15 +111,15 @@ int ptransfer_decode_service_request(
|
|||||||
/* don't decode the serviceParameters here */
|
/* don't decode the serviceParameters here */
|
||||||
private_data->serviceParameters = &apdu[len];
|
private_data->serviceParameters = &apdu[len];
|
||||||
private_data->serviceParametersLen =
|
private_data->serviceParametersLen =
|
||||||
apdu_len - len - 1 /*closing tag */ ;
|
(int)apdu_len - len - 1 /*closing tag */ ;
|
||||||
/* len includes the data and the closing tag */
|
/* len includes the data and the closing tag */
|
||||||
len = apdu_len;
|
len = (int)apdu_len;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ptransfer_error_encode_apdu(
|
int ptransfer_error_encode_apdu(
|
||||||
@@ -181,8 +181,8 @@ int ptransfer_error_decode_service_request(
|
|||||||
BACNET_ERROR_CODE * error_code,
|
BACNET_ERROR_CODE * error_code,
|
||||||
BACNET_PRIVATE_TRANSFER_DATA * private_data)
|
BACNET_PRIVATE_TRANSFER_DATA * private_data)
|
||||||
{
|
{
|
||||||
unsigned len = 0; /* return value */
|
int len = 0; /* return value */
|
||||||
unsigned decode_len = 0; /* return value */
|
int decode_len = 0; /* return value */
|
||||||
uint8_t tag_number = 0;
|
uint8_t tag_number = 0;
|
||||||
uint32_t len_value_type = 0;
|
uint32_t len_value_type = 0;
|
||||||
uint32_t unsigned_value = 0;
|
uint32_t unsigned_value = 0;
|
||||||
@@ -248,14 +248,14 @@ int ptransfer_error_decode_service_request(
|
|||||||
len++;
|
len++;
|
||||||
/* don't decode the serviceParameters here */
|
/* don't decode the serviceParameters here */
|
||||||
private_data->serviceParameters = &apdu[len];
|
private_data->serviceParameters = &apdu[len];
|
||||||
private_data->serviceParametersLen = apdu_len - len - 1 /*closing tag */ ;
|
private_data->serviceParametersLen = (int)apdu_len - len - 1 /*closing tag */ ;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* we could check for a closing tag of 3 */
|
/* we could check for a closing tag of 3 */
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ptransfer_ack_encode_apdu(
|
int ptransfer_ack_encode_apdu(
|
||||||
@@ -304,8 +304,8 @@ int ptransfer_ack_encode_apdu(
|
|||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ctest.h"
|
#include "ctest.h"
|
||||||
#include "bacapp.h"
|
#include "bacapp.h"
|
||||||
|
|
||||||
int ptransfer_decode_apdu(
|
int ptransfer_decode_apdu(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
@@ -403,25 +403,25 @@ void test_Private_Transfer_Ack(
|
|||||||
uint8_t test_invoke_id = 0;
|
uint8_t test_invoke_id = 0;
|
||||||
BACNET_PRIVATE_TRANSFER_DATA private_data;
|
BACNET_PRIVATE_TRANSFER_DATA private_data;
|
||||||
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
||||||
uint8_t test_value[480] = { 0 };
|
uint8_t test_value[480] = { 0 };
|
||||||
int private_data_len = 0;
|
int private_data_len = 0;
|
||||||
uint8_t private_data_chunk[32] = {"I Love You, Patricia!"};
|
uint8_t private_data_chunk[32] = {"I Love You, Patricia!"};
|
||||||
BACNET_APPLICATION_DATA_VALUE data_value;
|
BACNET_APPLICATION_DATA_VALUE data_value;
|
||||||
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
||||||
|
|
||||||
private_data.vendorID = BACNET_VENDOR_ID;
|
private_data.vendorID = BACNET_VENDOR_ID;
|
||||||
private_data.serviceNumber = 1;
|
private_data.serviceNumber = 1;
|
||||||
|
|
||||||
bacapp_parse_application_data(
|
bacapp_parse_application_data(
|
||||||
BACNET_APPLICATION_TAG_OCTET_STRING,
|
BACNET_APPLICATION_TAG_OCTET_STRING,
|
||||||
&private_data_chunk[0], &data_value);
|
&private_data_chunk[0], &data_value);
|
||||||
private_data_len = bacapp_encode_application_data(
|
private_data_len = bacapp_encode_application_data(
|
||||||
&test_value[0],
|
&test_value[0],
|
||||||
&data_value);
|
&data_value);
|
||||||
|
|
||||||
private_data.serviceParameters = &test_value[0];
|
private_data.serviceParameters = &test_value[0];
|
||||||
private_data.serviceParametersLen = private_data_len;
|
private_data.serviceParametersLen = private_data_len;
|
||||||
|
|
||||||
|
|
||||||
len = ptransfer_ack_encode_apdu(&apdu[0], invoke_id, &private_data);
|
len = ptransfer_ack_encode_apdu(&apdu[0], invoke_id, &private_data);
|
||||||
ct_test(pTest, len != 0);
|
ct_test(pTest, len != 0);
|
||||||
@@ -436,11 +436,11 @@ void test_Private_Transfer_Ack(
|
|||||||
ct_test(pTest, test_data.serviceNumber == private_data.serviceNumber);
|
ct_test(pTest, test_data.serviceNumber == private_data.serviceNumber);
|
||||||
ct_test(pTest,
|
ct_test(pTest,
|
||||||
test_data.serviceParametersLen == private_data.serviceParametersLen);
|
test_data.serviceParametersLen == private_data.serviceParametersLen);
|
||||||
len = bacapp_decode_application_data(
|
len = bacapp_decode_application_data(
|
||||||
test_data.serviceParameters,
|
test_data.serviceParameters,
|
||||||
test_data.serviceParametersLen,
|
test_data.serviceParametersLen,
|
||||||
&test_data_value);
|
&test_data_value);
|
||||||
ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true);
|
ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_Private_Transfer_Error(
|
void test_Private_Transfer_Error(
|
||||||
@@ -455,26 +455,26 @@ void test_Private_Transfer_Error(
|
|||||||
BACNET_ERROR_CODE error_code = ERROR_CODE_OPERATIONAL_PROBLEM;
|
BACNET_ERROR_CODE error_code = ERROR_CODE_OPERATIONAL_PROBLEM;
|
||||||
BACNET_ERROR_CLASS test_error_class = 0;
|
BACNET_ERROR_CLASS test_error_class = 0;
|
||||||
BACNET_ERROR_CODE test_error_code = 0;
|
BACNET_ERROR_CODE test_error_code = 0;
|
||||||
BACNET_PRIVATE_TRANSFER_DATA private_data;
|
BACNET_PRIVATE_TRANSFER_DATA private_data;
|
||||||
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
||||||
uint8_t test_value[480] = { 0 };
|
uint8_t test_value[480] = { 0 };
|
||||||
int private_data_len = 0;
|
int private_data_len = 0;
|
||||||
uint8_t private_data_chunk[32] = {"I Love You, Patricia!"};
|
uint8_t private_data_chunk[32] = {"I Love You, Patricia!"};
|
||||||
BACNET_APPLICATION_DATA_VALUE data_value;
|
BACNET_APPLICATION_DATA_VALUE data_value;
|
||||||
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
||||||
|
|
||||||
private_data.vendorID = BACNET_VENDOR_ID;
|
private_data.vendorID = BACNET_VENDOR_ID;
|
||||||
private_data.serviceNumber = 1;
|
private_data.serviceNumber = 1;
|
||||||
|
|
||||||
bacapp_parse_application_data(
|
bacapp_parse_application_data(
|
||||||
BACNET_APPLICATION_TAG_OCTET_STRING,
|
BACNET_APPLICATION_TAG_OCTET_STRING,
|
||||||
&private_data_chunk[0], &data_value);
|
&private_data_chunk[0], &data_value);
|
||||||
private_data_len = bacapp_encode_application_data(
|
private_data_len = bacapp_encode_application_data(
|
||||||
&test_value[0],
|
&test_value[0],
|
||||||
&data_value);
|
&data_value);
|
||||||
private_data.serviceParameters = &test_value[0];
|
private_data.serviceParameters = &test_value[0];
|
||||||
private_data.serviceParametersLen = private_data_len;
|
private_data.serviceParametersLen = private_data_len;
|
||||||
|
|
||||||
len = ptransfer_error_encode_apdu(&apdu[0], invoke_id,
|
len = ptransfer_error_encode_apdu(&apdu[0], invoke_id,
|
||||||
error_class, error_code, &private_data);
|
error_class, error_code, &private_data);
|
||||||
ct_test(pTest, len != 0);
|
ct_test(pTest, len != 0);
|
||||||
@@ -493,41 +493,41 @@ void test_Private_Transfer_Error(
|
|||||||
ct_test(pTest, test_error_code == error_code);
|
ct_test(pTest, test_error_code == error_code);
|
||||||
ct_test(pTest,
|
ct_test(pTest,
|
||||||
test_data.serviceParametersLen == private_data.serviceParametersLen);
|
test_data.serviceParametersLen == private_data.serviceParametersLen);
|
||||||
len = bacapp_decode_application_data(
|
len = bacapp_decode_application_data(
|
||||||
test_data.serviceParameters,
|
test_data.serviceParameters,
|
||||||
test_data.serviceParametersLen,
|
test_data.serviceParametersLen,
|
||||||
&test_data_value);
|
&test_data_value);
|
||||||
ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true);
|
ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_Private_Transfer_Request(
|
void test_Private_Transfer_Request(
|
||||||
Test * pTest)
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[480] = { 0 };
|
uint8_t apdu[480] = { 0 };
|
||||||
uint8_t test_value[480] = { 0 };
|
uint8_t test_value[480] = { 0 };
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
uint8_t invoke_id = 128;
|
uint8_t invoke_id = 128;
|
||||||
uint8_t test_invoke_id = 0;
|
uint8_t test_invoke_id = 0;
|
||||||
int private_data_len = 0;
|
int private_data_len = 0;
|
||||||
uint8_t private_data_chunk[32] = {"I Love You, Patricia!"};
|
uint8_t private_data_chunk[32] = {"I Love You, Patricia!"};
|
||||||
BACNET_APPLICATION_DATA_VALUE data_value;
|
BACNET_APPLICATION_DATA_VALUE data_value;
|
||||||
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
||||||
BACNET_PRIVATE_TRANSFER_DATA private_data;
|
BACNET_PRIVATE_TRANSFER_DATA private_data;
|
||||||
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
||||||
|
|
||||||
private_data.vendorID = BACNET_VENDOR_ID;
|
private_data.vendorID = BACNET_VENDOR_ID;
|
||||||
private_data.serviceNumber = 1;
|
private_data.serviceNumber = 1;
|
||||||
|
|
||||||
bacapp_parse_application_data(
|
bacapp_parse_application_data(
|
||||||
BACNET_APPLICATION_TAG_OCTET_STRING,
|
BACNET_APPLICATION_TAG_OCTET_STRING,
|
||||||
&private_data_chunk[0], &data_value);
|
&private_data_chunk[0], &data_value);
|
||||||
private_data_len = bacapp_encode_application_data(
|
private_data_len = bacapp_encode_application_data(
|
||||||
&test_value[0],
|
&test_value[0],
|
||||||
&data_value);
|
&data_value);
|
||||||
private_data.serviceParameters = &test_value[0];
|
private_data.serviceParameters = &test_value[0];
|
||||||
private_data.serviceParametersLen = private_data_len;
|
private_data.serviceParametersLen = private_data_len;
|
||||||
|
|
||||||
len = ptransfer_encode_apdu(&apdu[0], invoke_id, &private_data);
|
len = ptransfer_encode_apdu(&apdu[0], invoke_id, &private_data);
|
||||||
ct_test(pTest, len != 0);
|
ct_test(pTest, len != 0);
|
||||||
apdu_len = len;
|
apdu_len = len;
|
||||||
@@ -536,12 +536,12 @@ void test_Private_Transfer_Request(
|
|||||||
ct_test(pTest, test_data.vendorID == private_data.vendorID);
|
ct_test(pTest, test_data.vendorID == private_data.vendorID);
|
||||||
ct_test(pTest, test_data.serviceNumber == private_data.serviceNumber);
|
ct_test(pTest, test_data.serviceNumber == private_data.serviceNumber);
|
||||||
ct_test(pTest,
|
ct_test(pTest,
|
||||||
test_data.serviceParametersLen == private_data.serviceParametersLen);
|
test_data.serviceParametersLen == private_data.serviceParametersLen);
|
||||||
len = bacapp_decode_application_data(
|
len = bacapp_decode_application_data(
|
||||||
test_data.serviceParameters,
|
test_data.serviceParameters,
|
||||||
test_data.serviceParametersLen,
|
test_data.serviceParametersLen,
|
||||||
&test_data_value);
|
&test_data_value);
|
||||||
ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true);
|
ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-13
@@ -119,7 +119,8 @@ int rpm_encode_apdu(
|
|||||||
BACNET_PROPERTY_REFERENCE *rpm_property; /* current property */
|
BACNET_PROPERTY_REFERENCE *rpm_property; /* current property */
|
||||||
|
|
||||||
len = rpm_encode_apdu_init(&apdu_temp[0], invoke_id);
|
len = rpm_encode_apdu_init(&apdu_temp[0], invoke_id);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len = (int)memcopy(&apdu[0], &apdu_temp[0],
|
||||||
|
(size_t)apdu_len, (size_t)len, (size_t)max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -129,14 +130,16 @@ int rpm_encode_apdu(
|
|||||||
len =
|
len =
|
||||||
encode_context_object_id(&apdu_temp[0], 0, rpm_object->object_type,
|
encode_context_object_id(&apdu_temp[0], 0, rpm_object->object_type,
|
||||||
rpm_object->object_instance);
|
rpm_object->object_instance);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len = (int)memcopy(&apdu[0], &apdu_temp[0],
|
||||||
|
(size_t)apdu_len, (size_t)len, (size_t)max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* Tag 1: sequence of ReadAccessSpecification */
|
/* Tag 1: sequence of ReadAccessSpecification */
|
||||||
len = encode_opening_tag(&apdu_temp[0], 1);
|
len = encode_opening_tag(&apdu_temp[0], 1);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len = (int)memcopy(&apdu[0], &apdu_temp[0],
|
||||||
|
(size_t)apdu_len, (size_t)len, (size_t)max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -147,7 +150,8 @@ int rpm_encode_apdu(
|
|||||||
len =
|
len =
|
||||||
encode_context_enumerated(&apdu_temp[0], 0,
|
encode_context_enumerated(&apdu_temp[0], 0,
|
||||||
rpm_property->propertyIdentifier);
|
rpm_property->propertyIdentifier);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len = (int)memcopy(&apdu[0], &apdu_temp[0],
|
||||||
|
(size_t)apdu_len, (size_t)len, (size_t)max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -157,8 +161,8 @@ int rpm_encode_apdu(
|
|||||||
len =
|
len =
|
||||||
encode_context_unsigned(&apdu_temp[0], 1,
|
encode_context_unsigned(&apdu_temp[0], 1,
|
||||||
rpm_property->propertyArrayIndex);
|
rpm_property->propertyArrayIndex);
|
||||||
len =
|
len = (int)memcopy(&apdu[0], &apdu_temp[0],
|
||||||
memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
(size_t)apdu_len, (size_t)len, (size_t)max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -167,7 +171,8 @@ int rpm_encode_apdu(
|
|||||||
rpm_property = rpm_property->next;
|
rpm_property = rpm_property->next;
|
||||||
}
|
}
|
||||||
len = encode_closing_tag(&apdu_temp[0], 1);
|
len = encode_closing_tag(&apdu_temp[0], 1);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len = (int)memcopy(&apdu[0], &apdu_temp[0],
|
||||||
|
(size_t)apdu_len, (size_t)len, (size_t)max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -256,9 +261,8 @@ int rpm_decode_object_property(
|
|||||||
/* Tag 1: Optional propertyArrayIndex */
|
/* Tag 1: Optional propertyArrayIndex */
|
||||||
if ((len < apdu_len) && decode_is_context_specific(&apdu[len]) &&
|
if ((len < apdu_len) && decode_is_context_specific(&apdu[len]) &&
|
||||||
(!decode_is_closing_tag(&apdu[len]))) {
|
(!decode_is_closing_tag(&apdu[len]))) {
|
||||||
option_len =
|
option_len = (unsigned)decode_tag_number_and_value(
|
||||||
decode_tag_number_and_value(&apdu[len], &tag_number,
|
&apdu[len], &tag_number, &len_value_type);
|
||||||
&len_value_type);
|
|
||||||
if (tag_number == 1) {
|
if (tag_number == 1) {
|
||||||
len += option_len;
|
len += option_len;
|
||||||
len +=
|
len +=
|
||||||
@@ -449,9 +453,8 @@ int rpm_ack_decode_object_property(
|
|||||||
/* Tag 3: Optional propertyArrayIndex */
|
/* Tag 3: Optional propertyArrayIndex */
|
||||||
if ((len < apdu_len) && decode_is_context_specific(&apdu[len]) &&
|
if ((len < apdu_len) && decode_is_context_specific(&apdu[len]) &&
|
||||||
(!decode_is_closing_tag(&apdu[len]))) {
|
(!decode_is_closing_tag(&apdu[len]))) {
|
||||||
tag_len =
|
tag_len = (unsigned)decode_tag_number_and_value(
|
||||||
decode_tag_number_and_value(&apdu[len], &tag_number,
|
&apdu[len], &tag_number, &len_value_type);
|
||||||
&len_value_type);
|
|
||||||
if (tag_number == 3) {
|
if (tag_number == 3) {
|
||||||
len += tag_len;
|
len += tag_len;
|
||||||
len +=
|
len +=
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ int whohas_encode_apdu(
|
|||||||
} else {
|
} else {
|
||||||
len =
|
len =
|
||||||
encode_context_object_id(&apdu[apdu_len], 2,
|
encode_context_object_id(&apdu[apdu_len], 2,
|
||||||
data->object.identifier.type,
|
(int)data->object.identifier.type,
|
||||||
data->object.identifier.instance);
|
data->object.identifier.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user