Merge pull request #80 from darconeous/mdns-resolv
Adds IPv6 and MDNS domain name resolution.
This commit is contained in:
commit
39e5a8c6dc
34 changed files with 1397 additions and 333 deletions
|
@ -114,7 +114,7 @@ PROCESS_THREAD(dhcp_process, ev, data)
|
|||
CTK_WIDGET_FOCUS(&window, &getbutton);
|
||||
|
||||
ctk_window_open(&window);
|
||||
dhcpc_init(uip_ethaddr.addr, sizeof(uip_ethaddr.addr));
|
||||
dhcpc_init(uip_lladdr.addr, sizeof(uip_lladdr.addr));
|
||||
|
||||
|
||||
while(1) {
|
||||
|
|
|
@ -191,8 +191,7 @@ applyconfig(void)
|
|||
addrptr = &addr;
|
||||
#if UIP_UDP
|
||||
if(uiplib_ipaddrconv(smtpserver, &addr) == 0) {
|
||||
addrptr = resolv_lookup(smtpserver);
|
||||
if(addrptr == NULL) {
|
||||
if(resolv_lookup(smtpserver, &addrptr) != RESOLV_STATUS_CACHED) {
|
||||
resolv_query(smtpserver);
|
||||
ctk_label_set_text(&statuslabel, "Resolving host...");
|
||||
return;
|
||||
|
@ -334,7 +333,7 @@ PROCESS_THREAD(email_process, ev, data)
|
|||
#if UIP_UDP
|
||||
} else if(ev == resolv_event_found) {
|
||||
if(strcmp(data, smtpserver) == 0) {
|
||||
if(resolv_lookup(smtpserver) != NULL) {
|
||||
if(resolv_lookup(smtpserver, NULL) == RESOLV_STATUS_CACHED) {
|
||||
applyconfig();
|
||||
ctk_label_set_text(&statuslabel, "");
|
||||
} else {
|
||||
|
|
|
@ -434,7 +434,7 @@ PROCESS_THREAD(ftp_process, ev, data)
|
|||
} else if(ev == resolv_event_found) {
|
||||
/* Either found a hostname, or not. */
|
||||
if((char *)data != NULL &&
|
||||
(ipaddrptr = resolv_lookup((char *)data)) != NULL) {
|
||||
resolv_lookup((char *)data, &ipaddrptr) == RESOLV_STATUS_CACHED) {
|
||||
connection = ftpc_connect(ipaddrptr, UIP_HTONS(21));
|
||||
show_statustext("Connecting to ", hostname);
|
||||
} else {
|
||||
|
@ -508,8 +508,7 @@ PROCESS_THREAD(ftp_process, ev, data)
|
|||
ptractive = 1;
|
||||
#if UIP_UDP
|
||||
if(uiplib_ipaddrconv(hostname, &ipaddr) == 0) {
|
||||
ipaddrptr = resolv_lookup(hostname);
|
||||
if(ipaddrptr == NULL) {
|
||||
if(resolv_lookup(hostname, &ipaddrptr) != RESOLV_STATUS_CACHED) {
|
||||
resolv_query(hostname);
|
||||
show_statustext("Resolving host ", hostname);
|
||||
break;
|
||||
|
|
|
@ -378,9 +378,7 @@ httpd_ws_request(char request_type, const char *host_ip, const char *host_hdr,
|
|||
ipaddr = &addr;
|
||||
if(uiplib_ipaddrconv(host_ip, &addr) == 0) {
|
||||
#if 0 && UIP_UDP
|
||||
ipaddr = resolv_lookup(host_ip);
|
||||
|
||||
if(ipaddr == NULL) {
|
||||
if(resolv_lookup(host, &ipaddr) != RESOLV_STATUS_CACHED) {
|
||||
return NULL;
|
||||
}
|
||||
#else /* UIP_UDP */
|
||||
|
|
|
@ -246,8 +246,7 @@ PROCESS_THREAD(irc_process, ev, data)
|
|||
ipaddr = &serveraddr;
|
||||
#if UIP_UDP
|
||||
if(uiplib_ipaddrconv(server, &serveraddr) == 0) {
|
||||
ipaddr = resolv_lookup(server);
|
||||
if(ipaddr == NULL) {
|
||||
if(resolv_lookup(server, &ipaddr) != RESOLV_STATUS_CACHED) {
|
||||
resolv_query(server);
|
||||
} else {
|
||||
uip_ipaddr_copy(&serveraddr, ipaddr);
|
||||
|
@ -264,8 +263,7 @@ PROCESS_THREAD(irc_process, ev, data)
|
|||
#if UIP_UDP
|
||||
} else if(ev == resolv_event_found) {
|
||||
|
||||
ipaddr = resolv_lookup(server);
|
||||
if(ipaddr == NULL) {
|
||||
if(resolv_lookup(server, &ipaddr) != RESOLV_STATUS_CACHED) {
|
||||
ircc_text_output(&s, server, "hostname not found");
|
||||
} else {
|
||||
uip_ipaddr_copy(&serveraddr, ipaddr);
|
||||
|
|
|
@ -157,7 +157,7 @@ PROCESS_THREAD(shell_irc_process, ev, data)
|
|||
} else if(ev == resolv_event_found) {
|
||||
/* Either found a hostname, or not. */
|
||||
if((char *)data != NULL &&
|
||||
resolv_lookup((char *)data) != NULL) {
|
||||
resolv_lookup((char *)data, &ipaddr) == RESOLV_STATUS_CACHED) {
|
||||
uip_ipaddr_copy(serveraddr, ipaddr);
|
||||
ircc_connect(&s, server, serveraddr, nick);
|
||||
} else {
|
||||
|
|
|
@ -166,7 +166,7 @@ PROCESS_THREAD(shell_ping_process, ev, data)
|
|||
} else if(ev == resolv_event_found) {
|
||||
/* Either found a hostname, or not. */
|
||||
if((char *)data != NULL &&
|
||||
resolv_lookup((char *)data) != NULL) {
|
||||
resolv_lookup((char *)data, &ipaddr) == RESOLV_STATUS_CACHED) {
|
||||
uip_ipaddr_copy(serveraddr, ipaddr);
|
||||
telnet_connect(&s, server, serveraddr, nick);
|
||||
} else {
|
||||
|
|
|
@ -173,7 +173,7 @@ PROCESS_THREAD(shell_tcpsend_process, ev, data)
|
|||
} else if(ev == resolv_event_found) {
|
||||
/* Either found a hostname, or not. */
|
||||
if((char *)data != NULL &&
|
||||
resolv_lookup((char *)data) != NULL) {
|
||||
resolv_lookup((char *)data, &ipaddr) == RESOLV_STATUS_CACHED) {
|
||||
uip_ipaddr_copy(serveraddr, ipaddr);
|
||||
telnet_connect(&s, server, serveraddr, nick);
|
||||
} else {
|
||||
|
|
|
@ -123,7 +123,7 @@ PROCESS_THREAD(shell_udpsend_process, ev, data)
|
|||
} else if(ev == resolv_event_found) {
|
||||
/* Either found a hostname, or not. */
|
||||
if((char *)data != NULL &&
|
||||
resolv_lookup((char *)data) != NULL) {
|
||||
resolv_lookup((char *)data, &ipaddr) == RESOLV_STATUS_CACHED) {
|
||||
uip_ipaddr_copy(serveraddr, ipaddr);
|
||||
telnet_connect(&s, server, serveraddr, nick);
|
||||
} else {
|
||||
|
|
|
@ -130,12 +130,14 @@ open_url(char *url)
|
|||
/* Try to lookup the hostname. If it fails, we initiate a hostname
|
||||
lookup and print out an informative message on the statusbar. */
|
||||
if(uiplib_ipaddrconv(host, &addr) == 0) {
|
||||
uip_ipaddr_t *addrptr;
|
||||
shell_output_str(&wget_command, "Not an IP address", "");
|
||||
if(resolv_lookup(host) == NULL) {
|
||||
if(resolv_lookup(host, &addrptr) == RESOLV_STATUS_UNCACHED) {
|
||||
shell_output_str(&wget_command, "Not resolved", "");
|
||||
resolv_query(host);
|
||||
return;
|
||||
}
|
||||
uip_ipaddr_copy(&addr, addrptr);
|
||||
}
|
||||
#else /* UIP_UDP */
|
||||
uiplib_ipaddrconv(host, &addr);
|
||||
|
@ -171,7 +173,7 @@ PROCESS_THREAD(shell_wget_process, ev, data)
|
|||
} else if(ev == resolv_event_found) {
|
||||
/* Either found a hostname, or not. */
|
||||
if((char *)data != NULL &&
|
||||
resolv_lookup((char *)data) != NULL) {
|
||||
resolv_lookup((char *)data, NULL) == RESOLV_STATUS_CACHED) {
|
||||
open_url(url);
|
||||
} else {
|
||||
shell_output_str(&wget_command, "Host not found.", "");
|
||||
|
|
|
@ -163,8 +163,7 @@ connect(void)
|
|||
addrptr = &addr;
|
||||
#if UIP_UDP
|
||||
if(uiplib_ipaddrconv(telnethost, &addr) == 0) {
|
||||
addrptr = resolv_lookup(telnethost);
|
||||
if(addrptr == NULL) {
|
||||
if(resolv_lookup(telnethost, &addrptr) == RESOLV_STATUS_UNCACHED) {
|
||||
resolv_query(telnethost);
|
||||
show("Resolving host...");
|
||||
return;
|
||||
|
@ -252,7 +251,7 @@ PROCESS_THREAD(simpletelnet_process, ev, data)
|
|||
#if UIP_UDP
|
||||
} else if(ev == resolv_event_found) {
|
||||
if(strcmp(data, telnethost) == 0) {
|
||||
if(resolv_lookup(telnethost) != NULL) {
|
||||
if(resolv_lookup(telnethost, NULL) == RESOLV_STATUS_CACHED) {
|
||||
connect();
|
||||
} else {
|
||||
show("Host not found");
|
||||
|
|
|
@ -134,8 +134,7 @@ connect(void)
|
|||
|
||||
addrptr = &addr;
|
||||
if(uiplib_ipaddrconv(host, &addr) == 0) {
|
||||
addrptr = resolv_lookup(host);
|
||||
if(addrptr == NULL) {
|
||||
if(resolv_lookup(host, &addrptr) == RESOLV_STATUS_UNCACHED) {
|
||||
resolv_query(host);
|
||||
show("Resolving host...");
|
||||
return;
|
||||
|
@ -198,7 +197,7 @@ PROCESS_THREAD(vnc_process, ev, data)
|
|||
LOADER_UNLOAD();
|
||||
} else if(ev == resolv_event_found) {
|
||||
if(strcmp(data, host) == 0) {
|
||||
if(resolv_lookup(host) != NULL) {
|
||||
if(resolv_lookup(host, NULL) == RESOLV_STATUS_CACHED) {
|
||||
connect();
|
||||
} else {
|
||||
show("Host not found");
|
||||
|
|
|
@ -140,9 +140,7 @@ webclient_get(const char *host, uint16_t port, const char *file)
|
|||
ipaddr = &addr;
|
||||
if(uiplib_ipaddrconv(host, &addr) == 0) {
|
||||
#if UIP_UDP
|
||||
ipaddr = resolv_lookup(host);
|
||||
|
||||
if(ipaddr == NULL) {
|
||||
if(resolv_lookup(host,&ipaddr) != RESOLV_STATUS_CACHED) {
|
||||
return 0;
|
||||
}
|
||||
#else /* UIP_UDP */
|
||||
|
@ -486,7 +484,7 @@ webclient_appcall(void *state)
|
|||
init_connection();
|
||||
}*/
|
||||
#if UIP_UDP
|
||||
if(resolv_lookup(s.host) == NULL) {
|
||||
if(resolv_lookup(s.host, NULL) != RESOLV_STATUS_CACHED) {
|
||||
resolv_query(s.host);
|
||||
}
|
||||
#endif /* UIP_UDP */
|
||||
|
|
|
@ -348,11 +348,13 @@ open_url(void)
|
|||
/* Try to lookup the hostname. If it fails, we initiate a hostname
|
||||
lookup and print out an informative message on the statusbar. */
|
||||
if(uiplib_ipaddrconv(host, &addr) == 0) {
|
||||
if(resolv_lookup(host) == NULL) {
|
||||
uip_ipaddr_t *addrptr;
|
||||
if(resolv_lookup(host, &addrptr) != RESOLV_STATUS_CACHED) {
|
||||
resolv_query(host);
|
||||
show_statustext("Resolving host...");
|
||||
return;
|
||||
}
|
||||
uip_ipaddr_copy(&addr, addrptr);
|
||||
}
|
||||
#else /* UIP_UDP */
|
||||
uiplib_ipaddrconv(host, &addr);
|
||||
|
@ -553,7 +555,8 @@ PROCESS_THREAD(www_process, ev, data)
|
|||
#if UIP_UDP
|
||||
} else if(ev == resolv_event_found) {
|
||||
/* Either found a hostname, or not. */
|
||||
if((char *)data != NULL && resolv_lookup((char *)data) != NULL) {
|
||||
if((char *)data != NULL &&
|
||||
resolv_lookup((char *)data, NULL) == RESOLV_STATUS_CACHED) {
|
||||
open_url();
|
||||
} else {
|
||||
show_statustext("Host not found");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue