Fixed indent script, and indented files.

This commit is contained in:
skarg
2010-07-19 23:19:54 +00:00
parent c0d63a1ed0
commit 6c9ef7211d
69 changed files with 681 additions and 627 deletions
+16 -14
View File
@@ -48,7 +48,8 @@ static uint16_t BBMD_Timer_Seconds;
* - BACNET_BBMD_TIMETOLIVE - 0..65535 seconds, defaults to 60000
* - BACNET_BBMD_ADDRESS - dotted IPv4 address
*/
void dlenv_register_as_foreign_device(void)
void dlenv_register_as_foreign_device(
void)
{
#if defined(BACDL_BIP) && BBMD_ENABLED
char *pEnv = NULL;
@@ -79,8 +80,8 @@ void dlenv_register_as_foreign_device(void)
fprintf(stderr,
"Registering with BBMD at %s:%ld for %ld seconds\n",
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
bvlc_register_with_bbmd(bbmd_address, (uint16_t)bbmd_port,
(uint16_t)bbmd_timetolive_seconds);
bvlc_register_with_bbmd(bbmd_address, (uint16_t) bbmd_port,
(uint16_t) bbmd_timetolive_seconds);
BBMD_Timer_Seconds = bbmd_timetolive_seconds;
}
}
@@ -92,7 +93,8 @@ void dlenv_register_as_foreign_device(void)
*
* Call this function to renew Foreign Device Registration
*/
void dlenv_maintenance_timer(uint16_t elapsed_seconds)
void dlenv_maintenance_timer(
uint16_t elapsed_seconds)
{
if (BBMD_Timer_Seconds) {
if (BBMD_Timer_Seconds <= elapsed_seconds) {
@@ -153,16 +155,16 @@ void dlenv_init(
#endif
pEnv = getenv("BACNET_IP_PORT");
if (pEnv) {
bip_set_port((uint16_t)strtol(pEnv, NULL, 0));
bip_set_port((uint16_t) strtol(pEnv, NULL, 0));
} else {
/* BIP_Port is statically initialized to 0xBAC0,
* so if it is different, then it was programmatically altered,
* and we shouldn't just stomp on it here.
* Unless it is set below 1024, since:
* "The range for well-known ports managed by the IANA is 0-1023."
*/
if ( bip_get_port() < 1024 )
bip_set_port(0xBAC0);
/* BIP_Port is statically initialized to 0xBAC0,
* so if it is different, then it was programmatically altered,
* and we shouldn't just stomp on it here.
* Unless it is set below 1024, since:
* "The range for well-known ports managed by the IANA is 0-1023."
*/
if (bip_get_port() < 1024)
bip_set_port(0xBAC0);
}
#elif defined(BACDL_MSTP)
pEnv = getenv("BACNET_MAX_INFO_FRAMES");
@@ -192,7 +194,7 @@ void dlenv_init(
#endif
pEnv = getenv("BACNET_APDU_TIMEOUT");
if (pEnv) {
apdu_timeout_set((uint16_t)strtol(pEnv, NULL, 0));
apdu_timeout_set((uint16_t) strtol(pEnv, NULL, 0));
fprintf(stderr, "BACNET_APDU_TIMEOUT=%s\r\n", pEnv);
} else {
#if defined(BACDL_MSTP)
+5 -4
View File
@@ -344,8 +344,9 @@ static bool cov_send_request(
value_list[1].next = NULL;
switch (cov_subscription->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT:
Binary_Input_Encode_Value_List(cov_subscription->
monitoredObjectIdentifier.instance, &value_list[0]);
Binary_Input_Encode_Value_List
(cov_subscription->monitoredObjectIdentifier.instance,
&value_list[0]);
break;
default:
goto COV_FAILED;
@@ -462,8 +463,8 @@ static bool cov_subscribe(
switch (cov_data->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT:
if (Binary_Input_Valid_Instance(cov_data->
monitoredObjectIdentifier.instance)) {
if (Binary_Input_Valid_Instance
(cov_data->monitoredObjectIdentifier.instance)) {
status =
cov_list_subscribe(src, cov_data, error_class, error_code);
} else {
+9 -7
View File
@@ -75,7 +75,7 @@ void handler_read_property(
int apdu_len = -1;
int npdu_len = -1;
BACNET_NPDU_DATA npdu_data;
bool error = true; /* assume that there is an error */
bool error = true; /* assume that there is an error */
int bytes_sent = 0;
BACNET_ADDRESS my_address;
@@ -85,7 +85,7 @@ void handler_read_property(
npdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
&npdu_data);
if (service_data->segmented_message) { /* we don't support segmentation - send an abort */
if (service_data->segmented_message) { /* we don't support segmentation - send an abort */
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
len = BACNET_STATUS_ABORT;
#if PRINT_ENABLED
@@ -136,7 +136,7 @@ void handler_read_property(
}
}
RP_FAILURE:
RP_FAILURE:
if (error) {
if (len == BACNET_STATUS_ABORT) {
/* Kludge alert! At the moment we assume any abort is due to
@@ -153,7 +153,7 @@ void handler_read_property(
#if PRINT_ENABLED
fprintf(stderr, "RP: Sending Abort!\n");
#endif
} else if (len == BACNET_STATUS_ERROR){
} else if (len == BACNET_STATUS_ERROR) {
apdu_len =
bacerror_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id, SERVICE_CONFIRMED_READ_PROPERTY,
@@ -161,9 +161,11 @@ void handler_read_property(
#if PRINT_ENABLED
fprintf(stderr, "RP: Sending Error!\n");
#endif
} else if (len == BACNET_STATUS_REJECT){
apdu_len = reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id, reject_convert_error_code(rpdata.error_code));
} else if (len == BACNET_STATUS_REJECT) {
apdu_len =
reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
reject_convert_error_code(rpdata.error_code));
#if PRINT_ENABLED
fprintf(stderr, "RP: Sending Reject!\n");
#endif
+43 -35
View File
@@ -106,7 +106,7 @@ static int RPM_Encode_Property(
uint8_t * apdu,
uint16_t offset,
uint16_t max_apdu,
BACNET_RPM_DATA *rpmdata)
BACNET_RPM_DATA * rpmdata)
{
int len = 0;
size_t copy_len = 0;
@@ -114,8 +114,8 @@ static int RPM_Encode_Property(
BACNET_READ_PROPERTY_DATA rpdata;
len =
rpm_ack_encode_apdu_object_property(&Temp_Buf[0], rpmdata->object_property,
rpmdata->array_index);
rpm_ack_encode_apdu_object_property(&Temp_Buf[0],
rpmdata->object_property, rpmdata->array_index);
copy_len = memcopy(&apdu[0], &Temp_Buf[0], offset, len, max_apdu);
if (copy_len == 0) {
rpmdata->error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
@@ -133,9 +133,9 @@ static int RPM_Encode_Property(
rpdata.application_data_len = sizeof(Temp_Buf);
len = Device_Read_Property(&rpdata);
if (len < 0) {
if ((len == BACNET_STATUS_ABORT) || (len == BACNET_STATUS_REJECT)){
if ((len == BACNET_STATUS_ABORT) || (len == BACNET_STATUS_REJECT)) {
/* pass on aborts and rejects for now */
return len; /* Ie, Abort */
return len; /* Ie, Abort */
}
/* error was returned - encode that for the response */
len =
@@ -221,14 +221,14 @@ void handler_read_property_multiple(
apdu_len =
rpm_ack_encode_apdu_init(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id);
for(;;) {
for (;;) {
/* Start by looking for an object ID */
len =
rpm_decode_object_id(&service_request[decode_len],
service_len - decode_len, &rpmdata);
if (len >= 0) { /* Got one so skip to next stage */
decode_len += len;
} else { /* bad encoding - skip to error/reject/abort handling */
} else { /* bad encoding - skip to error/reject/abort handling */
#if PRINT_ENABLED
fprintf(stderr, "RPM: Bad Encoding.\n");
#endif
@@ -243,7 +243,7 @@ void handler_read_property_multiple(
len, sizeof(Handler_Transmit_Buffer));
if (!copy_len) {
#if PRINT_ENABLED
fprintf(stderr, "RPM: Response too big!\r\n");
fprintf(stderr, "RPM: Response too big!\r\n");
#endif
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
@@ -252,12 +252,12 @@ void handler_read_property_multiple(
apdu_len += copy_len;
/* do each property of this object of the RPM request */
for(;;) {
for (;;) {
/* Fetch a property */
len =
rpm_decode_object_property(&service_request[decode_len],
service_len - decode_len, &rpmdata);
if (len < 0) { /* bad encoding - skip to error/reject/abort handling */
if (len < 0) { /* bad encoding - skip to error/reject/abort handling */
#if PRINT_ENABLED
fprintf(stderr, "RPM: Bad Encoding.\n");
#endif
@@ -276,16 +276,17 @@ void handler_read_property_multiple(
if (rpmdata.array_index != BACNET_ARRAY_ALL) {
/* No array index options for this special property.
Encode error for this object property response */
Encode error for this object property response */
len =
rpm_ack_encode_apdu_object_property(&Temp_Buf[0],
rpmdata.object_property, rpmdata.array_index);
copy_len =
memcopy(&Handler_Transmit_Buffer[0],
&Temp_Buf[0], npdu_len + apdu_len,
len, sizeof(Handler_Transmit_Buffer));
memcopy(&Handler_Transmit_Buffer[0], &Temp_Buf[0],
npdu_len + apdu_len, len,
sizeof(Handler_Transmit_Buffer));
if (copy_len == 0) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
goto RPM_FAILURE;
}
@@ -295,18 +296,20 @@ void handler_read_property_multiple(
ERROR_CLASS_PROPERTY,
ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY);
copy_len =
memcopy(&Handler_Transmit_Buffer[0],
&Temp_Buf[0], npdu_len + apdu_len,
len, sizeof(Handler_Transmit_Buffer));
memcopy(&Handler_Transmit_Buffer[0], &Temp_Buf[0],
npdu_len + apdu_len, len,
sizeof(Handler_Transmit_Buffer));
if (copy_len == 0) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
goto RPM_FAILURE;
}
apdu_len += len;
} else {
special_object_property = rpmdata.object_property;
Device_Objects_Property_List(rpmdata.object_type, &property_list);
Device_Objects_Property_List(rpmdata.object_type,
&property_list);
property_count =
RPM_Object_Property_Count(&property_list,
special_object_property);
@@ -314,7 +317,8 @@ void handler_read_property_multiple(
/* handle the error code - but use the special property */
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata);
(uint16_t) (npdu_len + apdu_len), MAX_APDU,
&rpmdata);
if (len > 0) {
apdu_len += len;
} else {
@@ -327,8 +331,9 @@ void handler_read_property_multiple(
RPM_Object_Property(&property_list,
special_object_property, index);
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata);
RPM_Encode_Property(&Handler_Transmit_Buffer
[0], (uint16_t) (npdu_len + apdu_len),
MAX_APDU, &rpmdata);
if (len > 0) {
apdu_len += len;
} else {
@@ -342,7 +347,8 @@ void handler_read_property_multiple(
/* handle an individual property */
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), sizeof(Handler_Transmit_Buffer), &rpmdata);
(uint16_t) (npdu_len + apdu_len),
sizeof(Handler_Transmit_Buffer), &rpmdata);
if (len > 0) {
apdu_len += len;
} else {
@@ -356,20 +362,20 @@ void handler_read_property_multiple(
decode_len++;
len = rpm_ack_encode_apdu_object_end(&Temp_Buf[0]);
copy_len =
memcopy(&Handler_Transmit_Buffer[npdu_len],
&Temp_Buf[0], apdu_len, len,
sizeof(Handler_Transmit_Buffer));
memcopy(&Handler_Transmit_Buffer[npdu_len], &Temp_Buf[0],
apdu_len, len, sizeof(Handler_Transmit_Buffer));
if (!copy_len) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
goto RPM_FAILURE;
} else {
apdu_len += copy_len;
}
break; /* finished with this property list */
break; /* finished with this property list */
}
}
if(service_len == decode_len) /* Reached the end so finish up */
if (service_len == decode_len) /* Reached the end so finish up */
break;
}
@@ -385,7 +391,7 @@ void handler_read_property_multiple(
goto RPM_FAILURE;
}
RPM_FAILURE:
RPM_FAILURE:
if (error) {
if (error == BACNET_STATUS_ABORT) {
/* Kludge alert! At the moment we assume any abort is due to
@@ -402,7 +408,7 @@ void handler_read_property_multiple(
#if PRINT_ENABLED
fprintf(stderr, "RP: Sending Abort!\n");
#endif
} else if (error == BACNET_STATUS_ERROR){
} else if (error == BACNET_STATUS_ERROR) {
apdu_len =
bacerror_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id, SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
@@ -410,9 +416,11 @@ void handler_read_property_multiple(
#if PRINT_ENABLED
fprintf(stderr, "RP: Sending Error!\n");
#endif
} else if (error == BACNET_STATUS_REJECT){
apdu_len = reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id, reject_convert_error_code(rpmdata.error_code));
} else if (error == BACNET_STATUS_REJECT) {
apdu_len =
reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
reject_convert_error_code(rpmdata.error_code));
#if PRINT_ENABLED
fprintf(stderr, "RP: Sending Reject!\n");
#endif
+6 -6
View File
@@ -219,8 +219,8 @@ void rpm_ack_print_data(
#if PRINT_ENABLED
if (listOfProperties->propertyIdentifier < 512) {
fprintf(stdout, " %s: ",
bactext_property_name
(listOfProperties->propertyIdentifier));
bactext_property_name(listOfProperties->
propertyIdentifier));
} else {
fprintf(stdout, " proprietary %u: ",
(unsigned) listOfProperties->propertyIdentifier);
@@ -261,10 +261,10 @@ void rpm_ack_print_data(
#if PRINT_ENABLED
/* AccessError */
fprintf(stdout, "BACnet Error: %s: %s\r\n",
bactext_error_class_name((int) listOfProperties->error.
error_class),
bactext_error_code_name((int) listOfProperties->error.
error_code));
bactext_error_class_name((int) listOfProperties->
error.error_class),
bactext_error_code_name((int) listOfProperties->
error.error_code));
#endif
}
listOfProperties = listOfProperties->next;
+2 -2
View File
@@ -103,8 +103,8 @@ void handler_ucov_notification(
fprintf(stderr, "UCOV: ");
if (pProperty_value->propertyIdentifier < 512) {
fprintf(stderr, "%s ",
bactext_property_name(pProperty_value->
propertyIdentifier));
bactext_property_name
(pProperty_value->propertyIdentifier));
} else {
fprintf(stderr, "proprietary %u ",
pProperty_value->propertyIdentifier);
+2 -2
View File
@@ -173,8 +173,8 @@ bool WPValidateString(
(characterstring_length(&pValue->type.Character_String) ==
0)) {
*pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE;
} else if (characterstring_length(&pValue->type.
Character_String) >= iMaxLen) {
} else if (characterstring_length(&pValue->
type.Character_String) >= iMaxLen) {
*pErrorClass = ERROR_CLASS_RESOURCES;
*pErrorCode = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
} else
+1 -1
View File
@@ -95,7 +95,7 @@ uint8_t Send_Atomic_Read_File_Stream(
max_apdu in the address binding table. */
if ((unsigned) pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t) pdu_len);
bytes_sent =
datalink_send_pdu(&dest, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
+2 -1
View File
@@ -97,7 +97,8 @@ uint8_t Send_Atomic_Write_File_Stream(
max_apdu in the address binding table. */
if ((unsigned) pdu_len <= max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
&npdu_data, &Handler_Transmit_Buffer[0],
(uint16_t) pdu_len);
bytes_sent =
datalink_send_pdu(&dest, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
+1 -1
View File
@@ -101,7 +101,7 @@ uint8_t Send_Device_Communication_Control_Request(
max_apdu in the address binding table. */
if ((unsigned) pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t) pdu_len);
bytes_sent =
datalink_send_pdu(&dest, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
+1 -1
View File
@@ -118,7 +118,7 @@ uint8_t Send_Private_Transfer_Request(
if ((unsigned) pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t) pdu_len);
bytes_sent =
datalink_send_pdu(&dest, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
+1 -1
View File
@@ -98,7 +98,7 @@ uint8_t Send_Reinitialize_Device_Request(
max_apdu in the address binding table. */
if ((unsigned) pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t) pdu_len);
bytes_sent =
datalink_send_pdu(&dest, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
+4 -2
View File
@@ -78,7 +78,9 @@ void Send_Who_Is_Router_To_Network(
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
/* encode the optional DNET portion of the packet */
if (dnet >= 0) {
len = encode_unsigned16(&Handler_Transmit_Buffer[pdu_len], (uint16_t)dnet);
len =
encode_unsigned16(&Handler_Transmit_Buffer[pdu_len],
(uint16_t) dnet);
pdu_len += len;
#if PRINT_ENABLED
fprintf(stderr, "Send Who-Is-Router-To-Network message to %u\n", dnet);
@@ -122,7 +124,7 @@ void Send_I_Am_Router_To_Network(
fprintf(stderr, "Send I-Am-Router-To-Network message to:\n");
#endif
while (DNET_list[index] != -1) {
dnet = (uint16_t)DNET_list[index];
dnet = (uint16_t) DNET_list[index];
len = encode_unsigned16(&Handler_Transmit_Buffer[pdu_len], dnet);
pdu_len += len;
index++;
+3 -2
View File
@@ -155,8 +155,9 @@ uint8_t Send_Write_Property_Request(
#if PRINT_ENABLED_DEBUG
fprintf(stderr, "WriteProperty service: " "%s tag=%d\n",
(object_value->context_specific ? "context" : "application"),
(int) (object_value->context_specific ? object_value->
context_tag : object_value->tag));
(int) (object_value->
context_specific ? object_value->context_tag : object_value->
tag));
#endif
len = bacapp_encode_data(&application_data[apdu_len], object_value);
if ((len + apdu_len) < MAX_APDU) {