This commit is contained in:
@@ -13,7 +13,10 @@
|
|||||||
/* optional debug info for BACnet/IP datalink layers */
|
/* optional debug info for BACnet/IP datalink layers */
|
||||||
#if defined(BACDL_BIP)
|
#if defined(BACDL_BIP)
|
||||||
#if !defined(BIP_DEBUG)
|
#if !defined(BIP_DEBUG)
|
||||||
#define BIP_DEBUG
|
#define BIP_DEBUG 1
|
||||||
|
#endif
|
||||||
|
#if !defined(USE_INADDR)
|
||||||
|
#define USE_INADDR 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ static void bip_set_interface(char *ifname)
|
|||||||
local_address.s_addr = 0;
|
local_address.s_addr = 0;
|
||||||
}
|
}
|
||||||
bip_set_addr(local_address.s_addr);
|
bip_set_addr(local_address.s_addr);
|
||||||
#ifdef BIP_DEBUG
|
#if BIP_DEBUG
|
||||||
fprintf(stderr, "Interface: %s\n", ifname);
|
fprintf(stderr, "Interface: %s\n", ifname);
|
||||||
fprintf(stderr, "IP Address: %s\n", inet_ntoa(local_address));
|
fprintf(stderr, "IP Address: %s\n", inet_ntoa(local_address));
|
||||||
#endif
|
#endif
|
||||||
@@ -94,7 +94,7 @@ static void bip_set_interface(char *ifname)
|
|||||||
broadcast_address.s_addr = ~0;
|
broadcast_address.s_addr = ~0;
|
||||||
}
|
}
|
||||||
bip_set_broadcast_addr(broadcast_address.s_addr);
|
bip_set_broadcast_addr(broadcast_address.s_addr);
|
||||||
#ifdef BIP_DEBUG
|
#if BIP_DEBUG
|
||||||
fprintf(stderr, "IP Broadcast Address: %s\n",
|
fprintf(stderr, "IP Broadcast Address: %s\n",
|
||||||
inet_ntoa(broadcast_address));
|
inet_ntoa(broadcast_address));
|
||||||
fprintf(stderr, "UDP Port: 0x%04X [%hu]\n",
|
fprintf(stderr, "UDP Port: 0x%04X [%hu]\n",
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ static long gethostaddr(void)
|
|||||||
|
|
||||||
if ((host_ent = gethostbyname(host_name)) == NULL)
|
if ((host_ent = gethostbyname(host_name)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
#ifdef BIP_DEBUG
|
#if BIP_DEBUG
|
||||||
printf("host: %s at %u.%u.%u.%u\n", host_name,
|
printf("host: %s at %u.%u.%u.%u\n", host_name,
|
||||||
((uint8_t*)host_ent->h_addr)[0],
|
((uint8_t*)host_ent->h_addr)[0],
|
||||||
((uint8_t*)host_ent->h_addr)[1],
|
((uint8_t*)host_ent->h_addr)[1],
|
||||||
@@ -105,7 +105,7 @@ void bip_set_interface(char *ifname)
|
|||||||
if (bip_get_addr() == 0) {
|
if (bip_get_addr() == 0) {
|
||||||
bip_set_addr(inet_addr(ifname));
|
bip_set_addr(inet_addr(ifname));
|
||||||
}
|
}
|
||||||
#ifdef BIP_DEBUG
|
#if BIP_DEBUG
|
||||||
address.s_addr = htonl(bip_get_addr());
|
address.s_addr = htonl(bip_get_addr());
|
||||||
fprintf(stderr, "Interface: %s\n", ifname);
|
fprintf(stderr, "Interface: %s\n", ifname);
|
||||||
#endif
|
#endif
|
||||||
@@ -263,14 +263,14 @@ bool bip_init(char *ifname)
|
|||||||
}
|
}
|
||||||
bip_set_addr(address.s_addr);
|
bip_set_addr(address.s_addr);
|
||||||
}
|
}
|
||||||
#ifdef BIP_DEBUG
|
#if BIP_DEBUG
|
||||||
fprintf(stderr, "IP Address: %s\n", inet_ntoa(address));
|
fprintf(stderr, "IP Address: %s\n", inet_ntoa(address));
|
||||||
#endif
|
#endif
|
||||||
/* has broadcast address been set? */
|
/* has broadcast address been set? */
|
||||||
if (bip_get_broadcast_addr() == 0) {
|
if (bip_get_broadcast_addr() == 0) {
|
||||||
set_broadcast_address(address.s_addr);
|
set_broadcast_address(address.s_addr);
|
||||||
}
|
}
|
||||||
#ifdef BIP_DEBUG
|
#if BIP_DEBUG
|
||||||
broadcast_address.s_addr = htonl(bip_get_broadcast_addr());
|
broadcast_address.s_addr = htonl(bip_get_broadcast_addr());
|
||||||
fprintf(stderr, "IP Broadcast Address: %s\n",
|
fprintf(stderr, "IP Broadcast Address: %s\n",
|
||||||
inet_ntoa(broadcast_address));
|
inet_ntoa(broadcast_address));
|
||||||
|
|||||||
Reference in New Issue
Block a user