int Endpoint::set_address(const char* host, const int port) { reset_address(); // IP Address char address[5]; char *p_address = address; // Dot-decimal notation int result = std::sscanf(host, "%3u.%3u.%3u.%3u", (unsigned int*)&address[0], (unsigned int*)&address[1], (unsigned int*)&address[2], (unsigned int*)&address[3]); if (result != 4) { // Resolve address with DNS struct hostent *host_address = lwip_gethostbyname(host); if (host_address == NULL) return -1; //Could not resolve address p_address = (char*)host_address->h_addr_list[0]; } std::memcpy((char*)&_remoteHost.sin_addr.s_addr, p_address, 4); // Address family _remoteHost.sin_family = AF_INET; // Set port _remoteHost.sin_port = htons(port); return 0; }
void IssBootRedirect<CpuIss>::reset() { typename CpuIss::addr_t addr = reset_address(); typename CpuIss::InstructionResponse irsp = ISS_IRSP_INITIALIZER; typename CpuIss::DataResponse drsp = ISS_DRSP_INITIALIZER; assert(addr != ((typename CpuIss::addr_t)-1) && "Invalid reset address"); CpuIss::reset(); CpuIss::debugSetRegisterValue(CpuIss::s_pc_register_no, addr); CpuIss::executeNCycles(0,irsp,drsp,0); }
Endpoint::Endpoint() { reset_address(); }
Ethernet_Endpoint::Ethernet_Endpoint() { reset_address(); }