diff --git a/bacnet-stack/demo/handler/s_router.c b/bacnet-stack/demo/handler/s_router.c index 17f58a8c..3396505f 100644 --- a/bacnet-stack/demo/handler/s_router.c +++ b/bacnet-stack/demo/handler/s_router.c @@ -50,7 +50,7 @@ * The name is a misnomer, as it doesn't do any actual encoding here. * @see npdu_encode_npdu_data for a simpler version to use when sending an * APDU instead of a Network Layer Message. - * + * * @param npdu_data [out] Returns a filled-out structure with information * provided by the other arguments and good defaults. * @param network_message_type [in] The type of Network Layer Message. @@ -71,7 +71,7 @@ static void npdu_encode_npdu_network( npdu_data->network_message_type = network_message_type; /* optional */ npdu_data->vendor_id = 0; /* optional, if net message type is > 0x80 */ npdu_data->priority = priority; - npdu_data->hop_count = DFLT_HOP_COUNT; + npdu_data->hop_count = HOP_COUNT_DEFAULT; } } @@ -87,13 +87,13 @@ static void npdu_encode_npdu_network( * - NETWORK_MESSAGE_ROUTER_BUSY_TO_NETWORK: same as I-Am-Router msg * - NETWORK_MESSAGE_ROUTER_AVAILABLE_TO_NETWORK: same as I-Am-Router msg * - NETWORK_MESSAGE_INIT_RT_TABLE and NETWORK_MESSAGE_INIT_RT_TABLE_ACK: - * Array of DNET(s) to process as "Ports", terminated with -1. Each DNET + * Array of DNET(s) to process as "Ports", terminated with -1. Each DNET * will be expanded to a BACNET_ROUTER_PORT (with simple defaults for - * most fields) and encoded. - * + * most fields) and encoded. + * * @param network_message_type [in] The type of message to be sent. * @param dst [in/out] If not NULL, contains the destination for the message. - * @param iArgs [in] An optional array of values whose meaning depends on + * @param iArgs [in] An optional array of values whose meaning depends on * the type of message. * @return Number of bytes sent, or <=0 if no message was sent. */ @@ -179,7 +179,7 @@ int Send_Network_Layer_Message( pVal = iArgs; /* Reset to beginning */ /* Now encode each (virtual) BACNET_ROUTER_PORT. * We will simply use a positive index for PortID, - * and have no PortInfo. + * and have no PortInfo. */ while (*pVal >= 0) { len = @@ -228,7 +228,7 @@ int Send_Network_Layer_Message( /** Finds a specific router, or all reachable BACnet networks. * The response(s) will come in I-am-router-to-network message(s). * @ingroup NMRC - * + * * @param dst [in] If NULL, request will be broadcast to the local BACnet * network. Optionally may designate a particular router * destination to respond. @@ -244,13 +244,13 @@ void Send_Who_Is_Router_To_Network( &dnet); } -/** Broadcast an I-am-router-to-network message, giving the list of networks +/** Broadcast an I-am-router-to-network message, giving the list of networks * we can reach. - * The message will be sent to our normal DataLink Layer interface, + * The message will be sent to our normal DataLink Layer interface, * not the routed backend. * @ingroup NMRC - * - * @param DNET_list [in] List of BACnet network numbers for which I am a router, + * + * @param DNET_list [in] List of BACnet network numbers for which I am a router, * terminated with -1 */ void Send_I_Am_Router_To_Network( @@ -264,7 +264,7 @@ void Send_I_Am_Router_To_Network( /** Finds a specific router, or all reachable BACnet networks. * The response(s) will come in I-am-router-to-network message(s). * @ingroup NMRC - * + * * @param dst [in] If NULL, request will be broadcast to the local BACnet * network. Otherwise, designates a particular router * destination. @@ -285,20 +285,20 @@ void Send_Reject_Message_To_Network( } -/** Send an Initialize Routing Table message, built from an optional DNET[] +/** Send an Initialize Routing Table message, built from an optional DNET[] * array. * There are two cases here: * 1) We are requesting a destination router's Routing Table. - * In that case, DNET[] should just have one entry of -1 (no routing table + * In that case, DNET[] should just have one entry of -1 (no routing table * is sent). * 2) We are sending out our Routing Table for some reason (normally bcast it). * @ingroup NMRC - * + * * @param dst [in] If NULL, msg will be broadcast to the local BACnet network. - * Optionally may designate a particular router destination, + * Optionally may designate a particular router destination, * especially when requesting a Routing Table. - * @param DNET_list [in] List of BACnet network numbers for which I am a router, - * terminated with -1. Will be just -1 when we are + * @param DNET_list [in] List of BACnet network numbers for which I am a router, + * terminated with -1. Will be just -1 when we are * requesting a routing table. */ void Send_Initialize_Routing_Table( @@ -316,16 +316,16 @@ void Send_Initialize_Routing_Table( * 1) We are responding to a NETWORK_MESSAGE_INIT_RT_TABLE requesting our table. * We will normally broadcast that response. * 2) We are ACKing the receipt of a NETWORK_MESSAGE_INIT_RT_TABLE containing a - * routing table, and then we will want to respond to that dst router. - * In that case, DNET[] should just have one entry of -1 (no routing table + * routing table, and then we will want to respond to that dst router. + * In that case, DNET[] should just have one entry of -1 (no routing table * is sent). * @ingroup NMRC - * + * * @param dst [in] If NULL, Ack will be broadcast to the local BACnet network. - * Optionally may designate a particular router destination, + * Optionally may designate a particular router destination, * especially when ACKing receipt of this message type. - * @param DNET_list [in] List of BACnet network numbers for which I am a router, - * terminated with -1. May be just -1 when no table + * @param DNET_list [in] List of BACnet network numbers for which I am a router, + * terminated with -1. May be just -1 when no table * should be sent. */ void Send_Initialize_Routing_Table_Ack( diff --git a/bacnet-stack/include/npdu.h b/bacnet-stack/include/npdu.h index d5ac29bd..7fbb2535 100644 --- a/bacnet-stack/include/npdu.h +++ b/bacnet-stack/include/npdu.h @@ -39,8 +39,10 @@ #include "bacdef.h" #include "bacenum.h" -/** Use a hop count default that is generous but reasonable. */ -#define DFLT_HOP_COUNT 15 +/** Hop count default is required by BTL to be maximum */ +#ifndef HOP_COUNT_DEFAULT +#define HOP_COUNT_DEFAULT 255 +#endif /* an NPDU structure keeps the parameter stack to a minimum */ typedef struct bacnet_npdu_data_t { @@ -56,7 +58,7 @@ typedef struct bacnet_npdu_data_t { } BACNET_NPDU_DATA; struct router_port_t; -/** The info[] string has no agreed-upon purpose, hence it is useless. +/** The info[] string has no agreed-upon purpose, hence it is useless. * Keeping it short here. This size could be 0-255. */ #define ROUTER_PORT_INFO_LEN 2 /** Port Info structure used by Routers for their routing table. */ diff --git a/bacnet-stack/src/npdu.c b/bacnet-stack/src/npdu.c index 15d0967e..89861d19 100644 --- a/bacnet-stack/src/npdu.c +++ b/bacnet-stack/src/npdu.c @@ -45,7 +45,7 @@ /** Copy the npdu_data structure information from src to dest. * @param dest [out] The 'to' structure - * @param src [in] The 'from' structure + * @param src [in] The 'from' structure */ void npdu_copy_data( BACNET_NPDU_DATA * dest, @@ -107,14 +107,14 @@ ABORT.indication Yes Yes Yes No * and associated data. * If this is to be a Network Layer Control Message, there are probably * more bytes which will need to be encoded following the ones encoded here. - * The Network Layer Protocol Control Information byte is described + * The Network Layer Protocol Control Information byte is described * in section 6.2.2 of the BACnet standard. * @param npdu [out] Buffer which will hold the encoded NPDU header bytes. * The size isn't given, but it must be at least 2 bytes * for the simplest case, and should always be at least 24 * bytes to accommodate the maximal case (all fields loaded). * @param dest [in] The routing destination information if the message must - * be routed to reach its destination. + * be routed to reach its destination. * If dest->net and dest->len are 0, there is no * routing destination information. * @param src [in] The routing source information if the message was routed @@ -123,9 +123,9 @@ ABORT.indication Yes Yes Yes No * routing source information. * This src describes the original source of the message when * it had to be routed to reach this BACnet Device. - * @param npdu_data [in] The structure which describes how the NCPI and other + * @param npdu_data [in] The structure which describes how the NCPI and other * NPDU bytes should be encoded. - * @return On success, returns the number of bytes which were encoded into the + * @return On success, returns the number of bytes which were encoded into the * NPDU section. * If 0 or negative, there were problems with the data or encoding. */ @@ -262,7 +262,7 @@ is expected for the service being issued. /** Initialize an npdu_data structure to good defaults. * The name is a misnomer, as it doesn't do any actual encoding here. * @see npdu_encode_npdu_network if you need to set a network layer msg. - * + * * @param npdu_data [out] Returns a filled-out structure with information * provided by the other arguments and good defaults. * @param data_expecting_reply [in] True if message should have a reply. @@ -281,27 +281,27 @@ void npdu_encode_npdu_data( npdu_data->network_message_type = NETWORK_MESSAGE_INVALID; /* optional */ npdu_data->vendor_id = 0; /* optional, if net message type is > 0x80 */ npdu_data->priority = priority; - npdu_data->hop_count = DFLT_HOP_COUNT; + npdu_data->hop_count = HOP_COUNT_DEFAULT; } } /** Decode the NPDU portion of a received message, particularly the NCPI byte. - * The Network Layer Protocol Control Information byte is described + * The Network Layer Protocol Control Information byte is described * in section 6.2.2 of the BACnet standard. * @param npdu [in] Buffer holding the received NPDU header bytes (must be at least 2) - * @param dest [out] Returned with routing destination information if the NPDU - * has any and if this points to non-null storage for it. + * @param dest [out] Returned with routing destination information if the NPDU + * has any and if this points to non-null storage for it. * If dest->net and dest->len are 0 on return, there is no * routing destination information. - * @param src [out] Returned with routing source information if the NPDU - * has any and if this points to non-null storage for it. + * @param src [out] Returned with routing source information if the NPDU + * has any and if this points to non-null storage for it. * If src->net and src->len are 0 on return, there is no * routing source information. * This src describes the original source of the message when * it had to be routed to reach this BACnet Device. * @param npdu_data [out] Returns a filled-out structure with information * decoded from the NCPI and other NPDU bytes. - * @return On success, returns the number of bytes which were decoded from the + * @return On success, returns the number of bytes which were decoded from the * NPDU section; if this is a network layer message, there may be more * bytes left in the NPDU; if not a network msg, the APDU follows. * If 0 or negative, there were problems with the data or arguments.