std::unique_ptr<ClusteredObservation> ClusteredObservation::LoadFromVds(const std::string &vdsFilename) { VdsFile vdsFile(vdsFilename); std::unique_ptr<ClusteredObservation> cObs(new ClusteredObservation()); const size_t nParts = vdsFile.NParts(); for(size_t i=0;i!=nParts;++i) { cObs->AddItem(ClusteredObservationItem(cObs->Size(), vdsFile.Filename(i), Hostname(vdsFile.Host(i)))); } return cObs; /*LOFAR::CEP::VdsDesc vdsDesc(vdsFilename); const std::vector<LOFAR::CEP::VdsPartDesc> &parts = vdsDesc.getParts(); std::auto_ptr<ClusteredObservation> cObs(new ClusteredObservation()); for(std::vector<LOFAR::CEP::VdsPartDesc>::const_iterator i=parts.begin();i!=parts.end();++i) { const std::string &filename = i->getFileName(); const std::string &filesystem = i->getFileSys(); size_t separatorPos = filesystem.find(':'); if(separatorPos == std::string::npos || separatorPos == 0) throw std::runtime_error("One of the file system descriptors in the VDS file has an unexpected format"); const std::string hostname = filesystem.substr(0, separatorPos); ClusteredObservationItem newItem(cObs->Size(), filename, hostname); cObs->AddItem(newItem); } return cObs.release();*/ }
void ServerConnection::ReadBandTable(const std::string &msFilename, BandInfo &band) { _band = &band; std::cout << "Requesting band table from " << Hostname() << "...\n"; std::stringstream reqBuffer; RequestBlock requestBlock; ReadBandTableRequestOptions options; requestBlock.blockIdentifier = RequestId; requestBlock.blockSize = sizeof(requestBlock); requestBlock.dataSize = sizeof(options.flags) + msFilename.size(); requestBlock.request = ReadBandTableRequest; reqBuffer.write(reinterpret_cast<char *>(&requestBlock), sizeof(requestBlock)); options.flags = 0; options.msFilename = msFilename; reqBuffer.write(reinterpret_cast<char *>(&options.flags), sizeof(options.flags)); reqBuffer.write(reinterpret_cast<const char *>(options.msFilename.c_str()), options.msFilename.size()); boost::asio::write(_socket, boost::asio::buffer(reqBuffer.str())); prepareBuffer(sizeof(GenericReadResponseHeader)); boost::asio::async_read(_socket, boost::asio::buffer(_buffer, sizeof(GenericReadResponseHeader)), boost::bind(&ServerConnection::onReceiveBandTableResponseHeader, shared_from_this())); }
bool wxIPV6address::IsLocalHost() const { if ( Hostname() == "localhost" ) return true; wxString addr = IPAddress(); return addr == wxT("::1") || addr == wxT("0:0:0:0:0:0:0:1") || addr == wxT("::ffff:127.0.0.1"); }
bool wxIPV4address::Hostname(unsigned long addr) { if ( !GetImpl().SetHostAddress(addr) ) { m_origHostname.clear(); return false; } m_origHostname = Hostname(); return true; }
std::unique_ptr<ClusteredObservation> ClusteredObservation::LoadFromRef(const std::string &refFilename) { AOTools::RefFile refFile(refFilename); std::unique_ptr<ClusteredObservation> cObs(new ClusteredObservation()); for(AOTools::RefFile::const_iterator i=refFile.begin();i!=refFile.end();++i) { const AOTools::RefFileEntry &entry = *i; cObs->AddItem(ClusteredObservationItem(cObs->Size(), entry.Path(), Hostname(entry.Node()))); } return cObs; }
/******************************************************************** * Certain signals must be handled by this process. These * include those that indicate the child has gone down. *******************************************************************/ static void SignalAbort(int nSignal) { Feedback fb(sSlaveId + " signal handler"); if (nSignal == SIGPIPE) { fb.Warning("Received SIGPIPE signal on host ") << Hostname() << ". This probably means the slave process has died. The slave server on this host will now stop. " << "You may have to log in to the host and kill the processes manually. Slave server pid is " << getpid() << ", child (slave) pid is " << child_pid << "."; StopServer(); } else if (nSignal != SIGSTOP) { fb.Warning("Caught signal ") << nSignal << ". Exiting."; exit(nSignal); } }
bool wxIPV6address::Hostname(unsigned char addr[16]) { unsigned short wk[8]; for ( int i = 0; i < 8; ++i ) { wk[i] = addr[2*i]; wk[i] <<= 8; wk[i] |= addr[2*i+1]; } return Hostname ( wxString::Format ( "%x:%x:%x:%x:%x:%x:%x:%x", wk[0], wk[1], wk[2], wk[3], wk[4], wk[5], wk[6], wk[7] ) ); }
/// creates a provenance that uniquely identifies the leap connected to the /// machine running splash using the hostname static const Str DefaultProvenance () { return "leap-" + Hostname (); }
bool wxIPV4address::IsLocalHost() const { return Hostname() == "localhost" || IPAddress() == "127.0.0.1"; }
bool wxIPaddress::operator==(const wxIPaddress& addr) const { return Hostname().Cmp(addr.Hostname()) == 0 && Service() == addr.Service(); }
bool wxIPaddress::LocalHost() { return Hostname("localhost"); }
char *HostID(char *id) // Generic ID { //static char ret[CGN_BUFSIZE]; //snprintf(ret,CGN_BUFSIZE,"host identity %s",id); return Hostname(id); }
char *WhereGr(FILE *fp,char *address, char *uqhn, char *domain, char *ipv4, char *ipv6) { // This model of "where?" is based on IP addresses and portnumbers, for cloud services // alternative models for "other worlds" can be added... static char where[CGN_BUFSIZE] = {0}; char attr[CGN_BUFSIZE]; if (domain == NULL || strlen(domain) == 0) { domain = "unknown domain"; } if (ipv6 && strlen(ipv6) > 0) { snprintf(where,CGN_BUFSIZE,"host location %s.%s IPv4 %s ipv6 %s",uqhn,domain,ipv4,ipv6); } else { snprintf(where,CGN_BUFSIZE,"host location %s.%s IPv4 %s",uqhn,domain,ipv4); } if (address && strlen(address) > 0) { snprintf(attr,CGN_BUFSIZE,"%s,%s,%s,%s,address %s",Hostname(uqhn),Domain(domain),IPv4(ipv4),IPv6(ipv6),address); } else { snprintf(attr,CGN_BUFSIZE,"%s,%s,%s,%s",Hostname(uqhn),Domain(domain),IPv4(ipv4),IPv6(ipv6)); } RoleGr(fp,where,"where",attr, "host location identification"); RoleGr(fp,Domain(domain),"dns domain name",domain,"host location identification"); char *hostname = Hostname(uqhn); RoleGr(fp,hostname,"hostname",uqhn,"host location identification"); Gr(fp,where,a_alias,hostname,"host location identification"); // Alias for quick association Gr(fp,Domain(domain),a_contains,hostname,"host location identification"); char *identity = HostID(uqhn); Gr(fp,hostname,a_alias,identity,"host location identification"); RoleGr(fp,IPv4(ipv4),"ipv4 address", ipv4,"host location identification"); Gr(fp,where,a_alias,IPv4(ipv4),"host location identification"); // Alias for quick association Gr(fp,Domain(domain),a_contains,IPv4(ipv4),"host location identification"); Gr(fp,IPv4(ipv4),a_alias,HostID(ipv4),"host location identification"); if (ipv6 && strlen(ipv6) > 0) { RoleGr(fp,IPv6(ipv6),"ipv6 address", ipv6,"host location identification"); Gr(fp,where,a_alias,IPv6(ipv6),"host location identification"); // Alias for quick association Gr(fp,Domain(domain),a_contains,IPv6(ipv6),"host location identification"); identity = HostID(ipv6); Gr(fp,IPv6(ipv6),a_alias,identity,"host location identification"); Gr(fp,hostname,a_alias,IPv6(ipv6),"host location identification"); } if (address && address > 0) { char addressx[CGN_BUFSIZE]; snprintf(addressx,CGN_BUFSIZE,"description address %s",address); RoleGr(fp,addressx,"description address",address,"host location identification"); Gr(fp,Domain(domain),a_origin,addressx,"host location identification"); Gr(fp,"description address",a_related_to,"street address","host location identification"); } Gr(fp,hostname,a_alias,IPv4(ipv4),"host location identification"); return where; }