Followed Steve's good recommendation, and made routed_get_my_address() be a variant of datalink_get_my_address() just when routing is in use. Haven't done anything about the sending functions yet.
Renamed Lookup_Routed_Device_Address() as Routed_Device_Address_Lookup(), and replaced it in the routed npdu handler with a function that finds the "next" gateway or routed device, as per the destination address. (Less tied to the specifics of the gw_device.c implementation.) Fixed a few build warnings (eg, %zu for size_t arguments). Until we improve the makefile system, I've enabled BAC_ROUTING in config.h
This commit is contained in:
@@ -69,11 +69,7 @@ void handler_alarm_ack(
|
|||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -118,11 +118,7 @@ void handler_atomic_read_file(
|
|||||||
fprintf(stderr, "Received Atomic-Read-File Request!\n");
|
fprintf(stderr, "Received Atomic-Read-File Request!\n");
|
||||||
#endif
|
#endif
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
@@ -174,7 +170,7 @@ void handler_atomic_read_file(
|
|||||||
service_data->invoke_id,
|
service_data->invoke_id,
|
||||||
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "Too Big To Send (%d >= %d). Sending Abort!\n",
|
fprintf(stderr, "Too Big To Send (%d >= %zu). Sending Abort!\n",
|
||||||
data.type.stream.requestedOctetCount,
|
data.type.stream.requestedOctetCount,
|
||||||
octetstring_capacity(&data.fileData));
|
octetstring_capacity(&data.fileData));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -96,11 +96,7 @@ void handler_atomic_write_file(
|
|||||||
fprintf(stderr, "Received AtomicWriteFile Request!\n");
|
fprintf(stderr, "Received AtomicWriteFile Request!\n");
|
||||||
#endif
|
#endif
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
@@ -132,7 +128,7 @@ void handler_atomic_write_file(
|
|||||||
} else if (data.access == FILE_STREAM_ACCESS) {
|
} else if (data.access == FILE_STREAM_ACCESS) {
|
||||||
if (bacfile_write_stream_data(&data)) {
|
if (bacfile_write_stream_data(&data)) {
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "AWF: Stream offset %d, %d bytes\n",
|
fprintf(stderr, "AWF: Stream offset %d, %zu bytes\n",
|
||||||
data.type.stream.fileStartPosition,
|
data.type.stream.fileStartPosition,
|
||||||
octetstring_length(&data.fileData));
|
octetstring_length(&data.fileData));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -326,11 +326,7 @@ static bool cov_send_request(
|
|||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "COVnotification: requested\n");
|
fprintf(stderr, "COVnotification: requested\n");
|
||||||
#endif
|
#endif
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &cov_subscription->dest,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &cov_subscription->dest,
|
||||||
@@ -528,11 +524,7 @@ void handler_cov_subscribe(
|
|||||||
/* initialize a common abort code */
|
/* initialize a common abort code */
|
||||||
cov_data.error_code = ABORT_REASON_SEGMENTATION_NOT_SUPPORTED;
|
cov_data.error_code = ABORT_REASON_SEGMENTATION_NOT_SUPPORTED;
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
npdu_len =
|
npdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -103,11 +103,7 @@ void handler_device_communication_control(
|
|||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
/* encode the NPDU portion of the reply packet */
|
/* encode the NPDU portion of the reply packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -72,11 +72,7 @@ void handler_get_event_information(
|
|||||||
int valid_event = 0;
|
int valid_event = 0;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -54,11 +54,7 @@ void handler_lso(
|
|||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -46,6 +46,8 @@
|
|||||||
* and passing the remaining bytes to the apdu_handler.
|
* and passing the remaining bytes to the apdu_handler.
|
||||||
* @note The routing (except src) and NCPI information, including
|
* @note The routing (except src) and NCPI information, including
|
||||||
* npdu_data->data_expecting_reply, are discarded.
|
* npdu_data->data_expecting_reply, are discarded.
|
||||||
|
* @see routing_npdu_handler
|
||||||
|
*
|
||||||
* @ingroup MISCHNDLR
|
* @ingroup MISCHNDLR
|
||||||
*
|
*
|
||||||
* @param src [out] Returned with routing source information if the NPDU
|
* @param src [out] Returned with routing source information if the NPDU
|
||||||
|
|||||||
@@ -231,11 +231,7 @@ void handler_conf_private_trans(
|
|||||||
/* encode the NPDU portion of the response packet as it will be needed */
|
/* encode the NPDU portion of the response packet as it will be needed */
|
||||||
/* no matter what the outcome. */
|
/* no matter what the outcome. */
|
||||||
|
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -77,11 +77,7 @@ void handler_reinitialize_device(
|
|||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -197,30 +197,16 @@ static void routed_apdu_handler(
|
|||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
uint16_t apdu_len)
|
uint16_t apdu_len)
|
||||||
{
|
{
|
||||||
int dnet = DNET_list[0]; /* Get the DNET of our virtual network */
|
int cursor = 0; /* Starting hint */
|
||||||
int i;
|
bool bGotOne = false;
|
||||||
|
|
||||||
/* First, see if it's for the main Gateway Device, either because
|
while ( Routed_Device_GetNext( dest, DNET_list, &cursor ) ) {
|
||||||
* there's no routing info or else its a BACnet broadcast.
|
apdu_handler(src, apdu, apdu_len);
|
||||||
*/
|
bGotOne = true;
|
||||||
if ( (dest->net == 0 ) || (dest->net == BACNET_BROADCAST_NETWORK)) {
|
if ( cursor < 0 ) /* If no more matches, */
|
||||||
/* Handle like a normal, non-routed access of the Gateway Device.
|
break; /* We don't need to keep looking */
|
||||||
* But first, make sure our internal access is pointing at
|
|
||||||
* that Device in our table by telling it "no routing info" : */
|
|
||||||
Lookup_Routed_Device_Address( 0, 0, NULL );
|
|
||||||
apdu_handler(src, apdu, apdu_len);
|
|
||||||
}
|
}
|
||||||
/* Now check for our virtual DNET or BACnet broadcast, and check
|
if ( !bGotOne ) {
|
||||||
* against each of our virtually routed Devices.
|
|
||||||
* If we get a match, have it handle the APDU.
|
|
||||||
* For broadcasts, all Devices get a chance at it.
|
|
||||||
*/
|
|
||||||
if ((dest->net == dnet) || (dest->net == BACNET_BROADCAST_NETWORK)) {
|
|
||||||
for ( i = 1; i < MAX_NUM_DEVICES; i++ ) {
|
|
||||||
if ( Lookup_Routed_Device_Address( i, dest->len, dest->adr ) )
|
|
||||||
apdu_handler(src, apdu, apdu_len);
|
|
||||||
}
|
|
||||||
} else if ( dest->net != 0 ) {
|
|
||||||
/* We don't know how to reach this one */
|
/* We don't know how to reach this one */
|
||||||
Send_Reject_Message_To_Network( src, NETWORK_REJECT_NO_ROUTE, dest->net );
|
Send_Reject_Message_To_Network( src, NETWORK_REJECT_NO_ROUTE, dest->net );
|
||||||
}
|
}
|
||||||
@@ -237,6 +223,7 @@ static void routed_apdu_handler(
|
|||||||
* destination.
|
* destination.
|
||||||
* - Errors in decoding.
|
* - Errors in decoding.
|
||||||
* @note The npdu_data->data_expecting_reply status is discarded.
|
* @note The npdu_data->data_expecting_reply status is discarded.
|
||||||
|
* @see npdu_handler
|
||||||
* @ingroup NMRC
|
* @ingroup NMRC
|
||||||
*
|
*
|
||||||
* @param src [out] Returned with routing source information if the NPDU
|
* @param src [out] Returned with routing source information if the NPDU
|
||||||
|
|||||||
@@ -83,11 +83,7 @@ void handler_read_property(
|
|||||||
/* configure default error code as an abort since it is common */
|
/* configure default error code as an abort since it is common */
|
||||||
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
npdu_len =
|
npdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -204,11 +204,7 @@ void handler_read_property_multiple(
|
|||||||
/* jps_debug - see if we are utilizing all the buffer */
|
/* jps_debug - see if we are utilizing all the buffer */
|
||||||
/* memset(&Handler_Transmit_Buffer[0], 0xff, sizeof(Handler_Transmit_Buffer)); */
|
/* memset(&Handler_Transmit_Buffer[0], 0xff, sizeof(Handler_Transmit_Buffer)); */
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
npdu_len =
|
npdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -104,11 +104,7 @@ void handler_read_range(
|
|||||||
data.error_class = ERROR_CLASS_OBJECT;
|
data.error_class = ERROR_CLASS_OBJECT;
|
||||||
data.error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
data.error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -75,11 +75,7 @@ void handler_write_property(
|
|||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -65,11 +65,7 @@ void handler_unrecognized_service(
|
|||||||
(void) service_len;
|
(void) service_len;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -73,11 +73,7 @@ uint8_t Send_Alarm_Acknowledgement(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -79,11 +79,7 @@ uint8_t Send_Atomic_Read_File_Stream(
|
|||||||
data.type.stream.fileStartPosition = fileStartPosition;
|
data.type.stream.fileStartPosition = fileStartPosition;
|
||||||
data.type.stream.requestedOctetCount = requestedOctetCount;
|
data.type.stream.requestedOctetCount = requestedOctetCount;
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -80,11 +80,7 @@ uint8_t Send_Atomic_Write_File_Stream(
|
|||||||
status = octetstring_copy(&data.fileData, fileData);
|
status = octetstring_copy(&data.fileData, fileData);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest,
|
||||||
|
|||||||
@@ -70,11 +70,7 @@ uint8_t Send_CEvent_Notify(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -127,11 +127,7 @@ uint8_t Send_COV_Subscribe(
|
|||||||
}
|
}
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -83,11 +83,7 @@ uint8_t Send_Device_Communication_Control_Request(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -141,11 +141,7 @@ int iam_unicast_encode_pdu(
|
|||||||
memcpy(dest, src, sizeof(BACNET_ADDRESS));
|
memcpy(dest, src, sizeof(BACNET_ADDRESS));
|
||||||
dest->net = 0;
|
dest->net = 0;
|
||||||
|
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
npdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
npdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
||||||
|
|||||||
@@ -73,11 +73,7 @@ uint8_t Send_Life_Safety_Operation_Data(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -78,11 +78,7 @@ uint8_t Send_Private_Transfer_Request(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -80,11 +80,7 @@ uint8_t Send_Reinitialize_Device_Request(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -72,11 +72,7 @@ uint8_t Send_ReadRange_Request(
|
|||||||
|
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -86,11 +86,7 @@ uint8_t Send_Read_Property_Request(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -81,11 +81,7 @@ uint8_t Send_Read_Property_Multiple_Request(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len = npdu_encode_pdu(&pdu[0], &dest, &my_address, &npdu_data);
|
pdu_len = npdu_encode_pdu(&pdu[0], &dest, &my_address, &npdu_data);
|
||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
|
|||||||
@@ -77,11 +77,7 @@ uint8_t Send_Write_Property_Request_Data(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#else
|
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ DEVICE_OBJECT_DATA * Get_Routed_Device_Object(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the BACnet addreess for the indicated entry.
|
/** Return the BACnet address for the indicated entry.
|
||||||
* @param idx [in] Index into Devices[] array being requested.
|
* @param idx [in] Index into Devices[] array being requested.
|
||||||
* 0 is for the main, gateway Device entry.
|
* 0 is for the main, gateway Device entry.
|
||||||
* -1 is a special case meaning "whichever iCurrent_Device_Idx
|
* -1 is a special case meaning "whichever iCurrent_Device_Idx
|
||||||
@@ -175,6 +175,21 @@ BACNET_ADDRESS * Get_Routed_Device_Address(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the currently active BACnet address.
|
||||||
|
* This is an implementation of the datalink_get_my_address() template for
|
||||||
|
* devices with routing.
|
||||||
|
*
|
||||||
|
* @param my_address [out] Points to the currently active Device Object's
|
||||||
|
* BACnet address.
|
||||||
|
*/
|
||||||
|
void routed_get_my_address(
|
||||||
|
BACNET_ADDRESS * my_address)
|
||||||
|
|
||||||
|
{
|
||||||
|
my_address = &Devices[iCurrent_Device_Idx].bacDevAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** See if the Gateway or Routed Device at the given idx matches
|
/** See if the Gateway or Routed Device at the given idx matches
|
||||||
* the given MAC address.
|
* the given MAC address.
|
||||||
* Has the desirable side-effect of setting iCurrent_Device_Idx to the
|
* Has the desirable side-effect of setting iCurrent_Device_Idx to the
|
||||||
@@ -192,7 +207,7 @@ BACNET_ADDRESS * Get_Routed_Device_Address(
|
|||||||
* meaning MAC broadcast, so it's an automatic match).
|
* meaning MAC broadcast, so it's an automatic match).
|
||||||
* Else False if no match or invalid idx is given.
|
* Else False if no match or invalid idx is given.
|
||||||
*/
|
*/
|
||||||
bool Lookup_Routed_Device_Address(
|
bool Routed_Device_Address_Lookup(
|
||||||
int idx,
|
int idx,
|
||||||
uint8_t address_len,
|
uint8_t address_len,
|
||||||
uint8_t * mac_adress )
|
uint8_t * mac_adress )
|
||||||
@@ -206,7 +221,7 @@ bool Lookup_Routed_Device_Address(
|
|||||||
/* Automatic match */
|
/* Automatic match */
|
||||||
iCurrent_Device_Idx = idx;
|
iCurrent_Device_Idx = idx;
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else if ( mac_adress != NULL ) {
|
||||||
for (i = 0; i < address_len; i++) {
|
for (i = 0; i < address_len; i++) {
|
||||||
if (pDev->bacDevAddr.mac[i] != mac_adress[i])
|
if (pDev->bacDevAddr.mac[i] != mac_adress[i])
|
||||||
break;
|
break;
|
||||||
@@ -220,6 +235,88 @@ bool Lookup_Routed_Device_Address(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Find the next Gateway or Routed Device at the given MAC address,
|
||||||
|
* starting the search at the "cursor".
|
||||||
|
* Has the desirable side-effect of setting internal iCurrent_Device_Idx
|
||||||
|
* if a match is found, for use in the subsequent routing handling
|
||||||
|
* functions.
|
||||||
|
*
|
||||||
|
* @param dest [in] The BACNET_ADDRESS of the message's destination.
|
||||||
|
* If the Length of the mac_adress[] field is 0, then this is a MAC
|
||||||
|
* broadcast. Otherwise, size is determined
|
||||||
|
* by the DLL type (eg, 6 for BIP and 2 for MSTP).
|
||||||
|
* @param DNET_list [in] List of our reachable downstream BACnet Network numbers.
|
||||||
|
* Normally just one valid entry; terminated with a -1 value.
|
||||||
|
* @param cursor [in,out] The concept of the cursor is that it is a starting
|
||||||
|
* "hint" for the search; on return, it is updated to provide the
|
||||||
|
* cursor value to use with a subsequent GetNext call, or it
|
||||||
|
* equals -1 if there are no further matches.
|
||||||
|
* Set it to 0 on entry to access the main, gateway Device entry, or
|
||||||
|
* to start looping through the routed devices.
|
||||||
|
* Otherwise, its returned value is implementation-dependent and the
|
||||||
|
* calling function should not alter or interpret it.
|
||||||
|
*
|
||||||
|
* @return True if the MAC addresses match (or the address_len is 0,
|
||||||
|
* meaning MAC broadcast, so it's an automatic match).
|
||||||
|
* Else False if no match or invalid idx is given; the cursor will
|
||||||
|
* be returned as -1 in these cases.
|
||||||
|
*/
|
||||||
|
bool Routed_Device_GetNext(
|
||||||
|
BACNET_ADDRESS * dest,
|
||||||
|
int * DNET_list,
|
||||||
|
int * cursor )
|
||||||
|
{
|
||||||
|
int dnet = DNET_list[0]; /* Get the DNET of our virtual network */
|
||||||
|
int idx = *cursor;
|
||||||
|
bool bSuccess = false;
|
||||||
|
|
||||||
|
/* First, see if it's a BACnet broadcast.
|
||||||
|
* For broadcasts, all Devices get a chance at it.
|
||||||
|
*/
|
||||||
|
if (dest->net == BACNET_BROADCAST_NETWORK) {
|
||||||
|
/* Just take the entry indexed by the cursor */
|
||||||
|
bSuccess = Routed_Device_Address_Lookup( idx++,
|
||||||
|
dest->len, dest->adr );
|
||||||
|
}
|
||||||
|
/* Or see if it's for the main Gateway Device, because
|
||||||
|
* there's no routing info.
|
||||||
|
*/
|
||||||
|
else if (dest->net == 0) {
|
||||||
|
/* Handle like a normal, non-routed access of the Gateway Device.
|
||||||
|
* But first, make sure our internal access is pointing at
|
||||||
|
* that Device in our table by telling it "no routing info" : */
|
||||||
|
bSuccess = Routed_Device_Address_Lookup( 0,
|
||||||
|
dest->len, dest->adr );
|
||||||
|
/* Next step: no more matches: */
|
||||||
|
idx = -1;
|
||||||
|
}
|
||||||
|
/* Or if is our virtual DNET, check
|
||||||
|
* against each of our virtually routed Devices.
|
||||||
|
* If we get a match, have it handle the APDU.
|
||||||
|
* For broadcasts, all Devices get a chance at it.
|
||||||
|
*/
|
||||||
|
else if (dest->net == dnet) {
|
||||||
|
if ( idx == 0 ) /* Step over this case (starting point) */
|
||||||
|
idx = 1;
|
||||||
|
while (idx < MAX_NUM_DEVICES) {
|
||||||
|
bSuccess = Routed_Device_Address_Lookup( idx++,
|
||||||
|
dest->len, dest->adr );
|
||||||
|
if ( bSuccess )
|
||||||
|
break; /* We don't need to keep looking */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !bSuccess )
|
||||||
|
*cursor = -1;
|
||||||
|
else if ( idx == MAX_NUM_DEVICES ) /* No more to GetNext */
|
||||||
|
*cursor = -1;
|
||||||
|
else
|
||||||
|
*cursor = idx;
|
||||||
|
return bSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* methods to override the normal Device objection functions */
|
/* methods to override the normal Device objection functions */
|
||||||
|
|
||||||
uint32_t Routed_Device_Index_To_Instance(
|
uint32_t Routed_Device_Index_To_Instance(
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ static void AtomicReadFileAckHandler(
|
|||||||
} else if (octets_written == 0) {
|
} else if (octets_written == 0) {
|
||||||
fprintf(stderr, "Received 0 byte octet string!.\n");
|
fprintf(stderr, "Received 0 byte octet string!.\n");
|
||||||
} else {
|
} else {
|
||||||
printf("\r%u bytes",
|
printf("\r%zu bytes",
|
||||||
(data.type.stream.fileStartPosition + octets_written));
|
(data.type.stream.fileStartPosition + octets_written));
|
||||||
}
|
}
|
||||||
fflush(pFile);
|
fflush(pFile);
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ int main(
|
|||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
} else
|
} else
|
||||||
End_Of_File_Detected = true;
|
End_Of_File_Detected = true;
|
||||||
printf("\rSending %d bytes", (fileStartPosition + len));
|
printf("\rSending %zu bytes", (fileStartPosition + len));
|
||||||
invoke_id =
|
invoke_id =
|
||||||
Send_Atomic_Write_File_Stream
|
Send_Atomic_Write_File_Stream
|
||||||
(Target_Device_Object_Instance,
|
(Target_Device_Object_Instance,
|
||||||
|
|||||||
@@ -197,10 +197,8 @@ extern "C" {
|
|||||||
unsigned max_apdu_len,
|
unsigned max_apdu_len,
|
||||||
BACNET_PROPERTY_ID property);
|
BACNET_PROPERTY_ID property);
|
||||||
|
|
||||||
#if PRINT_ENABLED
|
#ifndef BACAPP_PRINT_ENABLED
|
||||||
#define BACAPP_PRINT_ENABLED
|
#if PRINT_ENABLED || defined TEST
|
||||||
#else
|
|
||||||
#ifdef TEST
|
|
||||||
#define BACAPP_PRINT_ENABLED
|
#define BACAPP_PRINT_ENABLED
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
/* Enable the Gateway (Routing) functionality here, if desired. */
|
/* Enable the Gateway (Routing) functionality here, if desired. */
|
||||||
#if !defined(BAC_ROUTING)
|
#if !defined(BAC_ROUTING)
|
||||||
#define BAC_ROUTING 0
|
#define BAC_ROUTING 1
|
||||||
#endif
|
#endif
|
||||||
#if !defined(MAX_NUM_DEVICES)
|
#if !defined(MAX_NUM_DEVICES)
|
||||||
#if BAC_ROUTING
|
#if BAC_ROUTING
|
||||||
|
|||||||
@@ -81,7 +81,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#define datalink_cleanup bip_cleanup
|
#define datalink_cleanup bip_cleanup
|
||||||
#define datalink_get_broadcast_address bip_get_broadcast_address
|
#define datalink_get_broadcast_address bip_get_broadcast_address
|
||||||
|
#if BAC_ROUTING
|
||||||
|
#define datalink_get_my_address routed_get_my_address
|
||||||
|
#else
|
||||||
#define datalink_get_my_address bip_get_my_address
|
#define datalink_get_my_address bip_get_my_address
|
||||||
|
#endif
|
||||||
|
|
||||||
#else /* Ie, BACDL_ALL */
|
#else /* Ie, BACDL_ALL */
|
||||||
#include "npdu.h"
|
#include "npdu.h"
|
||||||
|
|||||||
@@ -319,10 +319,18 @@ extern "C" {
|
|||||||
int idx );
|
int idx );
|
||||||
BACNET_ADDRESS * Get_Routed_Device_Address(
|
BACNET_ADDRESS * Get_Routed_Device_Address(
|
||||||
int idx );
|
int idx );
|
||||||
bool Lookup_Routed_Device_Address(
|
|
||||||
|
void routed_get_my_address(
|
||||||
|
BACNET_ADDRESS * my_address);
|
||||||
|
|
||||||
|
bool Routed_Device_Address_Lookup(
|
||||||
int idx,
|
int idx,
|
||||||
uint8_t address_len,
|
uint8_t address_len,
|
||||||
uint8_t * mac_adress );
|
uint8_t * mac_adress );
|
||||||
|
bool Routed_Device_GetNext(
|
||||||
|
BACNET_ADDRESS * dest,
|
||||||
|
int * DNET_list,
|
||||||
|
int * cursor );
|
||||||
|
|
||||||
uint32_t Routed_Device_Index_To_Instance(
|
uint32_t Routed_Device_Index_To_Instance(
|
||||||
unsigned index);
|
unsigned index);
|
||||||
|
|||||||
Reference in New Issue
Block a user