std::ostream& operator<<(std::ostream& ostr, DDS_Locator_t const& rhs) { std::string kind = "<\?\?\?>"; if (rhs.kind == DDS_LOCATOR_KIND_UDPv4) { kind = "UDPv4"; } else if (rhs.kind == DDS_LOCATOR_KIND_UDPv6) { kind = "UDPv6"; } else if (rhs.kind == 2) { kind = "SHMEM"; } ostr << "protocol: " << rhs.kind << " - " << kind << " "; if (kind == "UDPv4") { int ip; memcpy(&ip, &rhs.address[12], sizeof(ip)); ostr << PrintIp(ntohl(ip)) << ":" << rhs.port; } else /* if (kind == "UDPv6") */ { for (int j = 0; j < 16; ++j) { ostr.width(2); ostr.fill('0'); ostr << std::hex <<(int) rhs.address[j] << " "; } ostr << std::dec; } return ostr; }
void PrintRouter(void) { if( RouterExist() == -1 ) return; printf("=-=-=-=-=Router=-=-=-=-=\n"); printf("Router mac = "); PrintMac(router->mac); printf("Router ip = "); PrintIp(router->ip); printf("=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"); printf("_____________________________________________________\n"); }
void PrintClients() { struct client *tmp; register int i = 0; if( ClientExist() == -1 ) return; printf("_____________________________________________________\n"); tmp = c; printf("=-=-=-=-=Clients=-=-=-=-=\n"); do { printf("client mac [%d] = ", i); PrintMac(tmp->mac); printf("client ip [%d] = ", i); PrintIp(tmp->ip); tmp = tmp -> next; i++; }while (tmp != (struct client *)NULL); printf("=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"); }
void SubscriptionPrinter::Printer::operator()(DDS_SubscriptionBuiltinTopicData const * event) throw() { string key = guidString(event->key); string participantKey = guidString(event->participant_key); string subscriberKey = guidString(event->subscriber_key); const char* subName = event->subscription_name.name; if (!s_key.empty()) { if (s_key != key) return; } if (!s_participantKey.empty()) { if (s_participantKey != participantKey) return; } if (!s_subscriberKey.empty()) { if (s_subscriberKey != subscriberKey) return; } if (!s_topicName.empty()) { if (s_topicName != event->topic_name) return; } if (s_verbose < 4) { if (s_verbose < 3) { // only print topics for matching partitions bool match = false; for (int i = 0; i < event->partition.name.length(); ++i) { if (Miro::RobotParameters::instance()->name == event->partition.name[i]) { match = true; break; } } if (!match) { return; } } if (s_verbose > 1) { if (s_key.empty()) { cout << "key: " << key << " - IP " << PrintIp(event->key.value[0]) << endl; } if (s_participantKey.empty()) { cout << "participant key: " << participantKey << " - IP " << PrintIp(event->participant_key.value[0]) << endl; } if (s_subscriberKey.empty()) { cout << "subscriber key: " << subscriberKey << " - IP " << PrintIp(event->subscriber_key.value[0]) << endl; } } cout << "{ "; if (s_verbose > 2) { cout << "["; for (int i = 0; i < event->partition.name.length(); ++i) { if (i > 0) { cout << ", "; } cout << event->partition.name[i]; } cout << "], " << endl << " "; } cout << event->topic_name; if (s_verbose > 0) { cout << ", " << event->type_name; } if (s_verbose > 2) { cout << ", " << endl << " version: " << event->product_version; } if (s_verbose > 2 && subName) { cout << ", " << endl << " subscription_name: " << subName << endl; } else { cout << endl; } cout << " }" << endl; if (s_verbose > 1) { cout << endl; } } else { DDSSubscriptionBuiltinTopicDataTypeSupport::print_data(event); } }