Updated output of whois demo. Began implementing the datalink-all concept.

This commit is contained in:
skarg
2008-01-01 23:17:28 +00:00
parent af6490c6cd
commit 8b99c8c85b
5 changed files with 73 additions and 43 deletions
+7
View File
@@ -110,6 +110,13 @@ int main(
/* allow the device ID to be set */
if (argc > 1)
Device_Set_Object_Instance_Number(strtol(argv[1], NULL, 0));
#if defined(BACDL_ALL)
pEnv = getenv("BACNET_DATALINK");
if (pEnv) {
datalink_set(pEnv));
} else {
datalink_set("bip");
#endif
#if defined(BACDL_BIP)
pEnv = getenv("BACNET_IP_PORT");
if (pEnv) {
+23 -7
View File
@@ -109,16 +109,32 @@ static void print_address_cache(
uint32_t device_id = 0;
unsigned max_apdu = 0;
fprintf(stderr, "Device\tMAC\tMaxAPDU\tNet\n");
printf("%-7s %-14s %-4s %-5s %-14s\n",
"Device","MAC","APDU","SNET","SADR");
printf("------- -------------- ---- ----- --------------\n");
for (i = 0; i < MAX_ADDRESS_CACHE; i++) {
if (address_get_by_index(i, &device_id, &max_apdu, &address)) {
fprintf(stderr, "%u\t", device_id);
for (j = 0; j < address.mac_len; j++) {
fprintf(stderr, "%02X", address.mac[j]);
printf("%7u ", device_id);
for (j = 0; j < 7; j++) {
if (j < address.mac_len) {
printf("%02X", address.mac[j]);
} else {
printf(" ");
}
}
fprintf(stderr, "\t");
fprintf(stderr, "%hu\t", max_apdu);
fprintf(stderr, "%hu\n", address.net);
printf(" %4hu ", max_apdu);
printf("%5hu ", address.net);
if (address.net) {
for (j = 0; j < 7; j++) {
if (j < address.len) {
printf("%02X", address.adr[j]);
} else {
printf(" ");
}
printf(" ");
}
}
printf("\n");
}
}
}