AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/demo/object/gw_device.c
bool Routed_Device_Is_Valid_Network(
    uint16_t dest_net,
    int *DNET_list)
{
    int dnet = DNET_list[0];    /* Get the DNET of our virtual network */
    bool bSuccess = false;

    /* First, see if it's a BACnet broadcast (automatic pass). */
    if (dest_net == BACNET_BROADCAST_NETWORK)
        bSuccess = true;
    /* Or see if it's for the main Gateway Device, because
     * there's no routing info.
     */
    else if (dest_net == 0)
        bSuccess = true;
    /* Or see if matches our virtual DNET */
    else if (dest_net == dnet)
        bSuccess = true;

    return bSuccess;
}
/** Check if the destination network is reachable - is it our virtual network,
 *  or local or else broadcast.
 *
 * @param dest_net [in] The BACnet network number of a message's destination.
 * 		   Success if it is our virtual network number, or 0 (local for the
 * 			gateway, or 0xFFFF for a broadcast network number.
 * @param DNET_list [in] List of our reachable downstream BACnet Network numbers.
 * 					 Normally just one valid entry; terminated with a -1 value.
 * @return True if matches our virtual network, or is for the local network
 * 			Device (the gateway), or is BACNET_BROADCAST_NETWORK, which is
 * 		    an automatic match.
 *         Else False if not a reachable network.
 */
Check if the destination network is reachable - is it our virtual network,
or local or else broadcast.

@param dest_net [in] The BACnet network number of a message's destination.
Success if it is our virtual network number, or 0 (local for the
gateway, or 0xFFFF for a broadcast network number.
@param DNET_list [in] List of our reachable downstream BACnet Network numbers.
Normally just one valid entry; terminated with a -1 value.
@return True if matches our virtual network, or is for the local network
Device (the gateway), or is BACNET_BROADCAST_NETWORK, which is
an automatic match.
Else False if not a reachable network.
Check if the destination network is reachable - is it our virtual network or local or else broadcast . @param dest_net [ in ] The BACnet network number of a message ' s destination . Success if it is our virtual network number or 0 ( local for the gateway or 0xFFFF for a broadcast network number . @param DNET_list [ in ] List of our reachable downstream BACnet Network numbers . Normally just one valid entry ; terminated with a - 1 value . @return True if matches our virtual network or is for the local network Device ( the gateway ) or is BACNET_BROADCAST_NETWORK which is an automatic match . Else False if not a reachable network .
bool Routed_Device_Is_Valid_Network(
    uint16_t dest_net,
    int *DNET_list)
{
    int dnet = DNET_list[0];    
    bool bSuccess = false;
    if (dest_net == BACNET_BROADCAST_NETWORK)
        bSuccess = true;
    else if (dest_net == 0)
        bSuccess = true;
    else if (dest_net == dnet)
        bSuccess = true;
    return bSuccess;
}
bool Routed_Device_Is_Valid_Network ( uint16_t dest_net , int * DNET_list ) { int dnet = DNET_list [ 0 ] ; bool bSuccess = false ; if ( dest_net == BACNET_BROADCAST_NETWORK ) bSuccess = true ; else if ( dest_net == 0 ) bSuccess = true ; else if ( dest_net == dnet ) bSuccess = true ; return bSuccess ; }
Check if the destination network is reachable - is it our virtual network,
  or local or else broadcast.
Check if the destination network is reachable - is it our virtual network or local or else broadcast .
/* Get the DNET of our virtual network */ /* First, see if it's a BACnet broadcast (automatic pass). */ /* Or see if it's for the main Gateway Device, because
     * there's no routing info.
     */ /* Or see if matches our virtual DNET */