Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Revision 143:cc2e148cb96a, committed 2020-12-26
- Comitter:
- andrewboyson
- Date:
- Sat Dec 26 19:38:40 2020 +0000
- Parent:
- 142:b472ba95b018
- Child:
- 144:7106252b7abf
- Commit message:
- First part of moving DNs from ipv6 to net
Changed in this revision
--- a/base/net/web-net-ajax.c Wed Dec 23 09:57:17 2020 +0000
+++ b/base/net/web-net-ajax.c Sat Dec 26 19:38:40 2020 +0000
@@ -2,6 +2,7 @@
#include "http.h"
#include "mac.h"
#include "tcb.h"
+#include "nr.h"
void WebNetAjax()
{
@@ -12,4 +13,7 @@
HttpAddChar('\f');
TcbSendAjax();
+ HttpAddChar('\f');
+
+ NrSendAjax();
}
--- a/base/net/web-net-html.c Wed Dec 23 09:57:17 2020 +0000
+++ b/base/net/web-net-html.c Sat Dec 26 19:38:40 2020 +0000
@@ -14,6 +14,8 @@
HttpAddText("<code id='ajax-mac'></code>\r\n");
WebAddH2("TCP connections");
HttpAddText("<code id='ajax-tcp'></code>\r\n");
+ WebAddH2("Name resolution");
+ HttpAddText("<code id='ajax-dns'></code>\r\n");
WebAddEnd();
--- a/base/net/web-net-script.inc Wed Dec 23 09:57:17 2020 +0000
+++ b/base/net/web-net-script.inc Sat Dec 26 19:38:40 2020 +0000
@@ -3,6 +3,7 @@
"\n"
"let mac = '';\n"
"let tcp = '';\n"
+"let dns = '';\n"
"\n"
"function parseTcpLine(line)\n"
"{\n"
@@ -19,9 +20,9 @@
" \n"
" switch (state)\n"
" {\n"
-" case 1: tcp += \" Syn\"; break;\n"
-" case 2: tcp += \" Est\"; break;\n"
-" case 3: tcp += \" Wait\"; break;\n"
+" case 1: tcp += \" Syn\"; break;\n"
+" case 2: tcp += \" Est\"; break;\n"
+" case 3: tcp += \" Wait\"; break;\n"
" default: tcp += state.toString().padStart(5, ' '); break;\n"
" }\n"
" \n"
@@ -45,6 +46,22 @@
" tcp = \"State Idle Protocol ARI Port-Loc Port-Rem Rcvd Sent\\n\";\n"
" text.split('\\n').forEach(parseTcpLine);\n"
"}\n"
+"function parseDnsLine(line)\n"
+"{\n"
+" if (line.length == 0) return;\n"
+" let fields = line.split('\\t');\n"
+" \n"
+" dns += parseInt(fields[0], 16).toString().padStart(2, ' ');\n"
+" let minutes = parseInt(fields[1], 16) / 1000 / 60;\n"
+" dns += Math.floor(minutes).toString().padStart(4, ' ');\n"
+" dns += ' ';\n"
+" dns += Net.makeIp6(fields[2]).padEnd(40, ' ');\n"
+" dns += ' ';\n"
+" dns += fields[3];\n"
+" dns += ' ';\n"
+" dns += fields[4];\n"
+" dns += '\\r\\n';\n"
+"}\n"
"function parseGenLines(text)\n"
"{\n"
" let lines = text.split('\\n');\n"
@@ -55,6 +72,7 @@
" let topics = Ajax.response.split('\\f');\n"
" parseGenLines(topics[0]);\n"
" parseTcpLines(topics[1]);\n"
+" parseDnsLines(topics[2]);\n"
"}\n"
"function display()\n"
"{\n"
@@ -62,6 +80,7 @@
"\n"
" elem = Ajax.getElementOrNull('ajax-tcp' ); if (elem) elem.textContent = tcp;\n"
" elem = Ajax.getElementOrNull('ajax-mac' ); if (elem) elem.textContent = mac;\n"
+" elem = Ajax.getElementOrNull('ajax-dns' ); if (elem) elem.textContent = dns;\n"
"}\n"
"\n"
"Ajax.server = '/net-ajax';\n"
--- a/base/net/web-net-script.js Wed Dec 23 09:57:17 2020 +0000
+++ b/base/net/web-net-script.js Sat Dec 26 19:38:40 2020 +0000
@@ -3,6 +3,7 @@
let mac = '';
let tcp = '';
+let dns = '';
function parseTcpLine(line)
{
@@ -45,6 +46,22 @@
tcp = "State Idle Protocol ARI Port-Loc Port-Rem Rcvd Sent\n";
text.split('\n').forEach(parseTcpLine);
}
+function parseDnsLine(line)
+{
+ if (line.length == 0) return;
+ let fields = line.split('\t');
+
+ dns += parseInt(fields[0], 16).toString().padStart(2, ' ');
+ let minutes = parseInt(fields[1], 16) / 1000 / 60;
+ dns += Math.floor(minutes).toString().padStart(4, ' ');
+ dns += ' ';
+ dns += Net.makeIp6(fields[2]).padEnd(40, ' ');
+ dns += ' ';
+ dns += fields[3];
+ dns += ' ';
+ dns += fields[4];
+ dns += '\r\n';
+}
function parseGenLines(text)
{
let lines = text.split('\n');
@@ -55,6 +72,7 @@
let topics = Ajax.response.split('\f');
parseGenLines(topics[0]);
parseTcpLines(topics[1]);
+ parseDnsLines(topics[2]);
}
function display()
{
@@ -62,6 +80,7 @@
elem = Ajax.getElementOrNull('ajax-tcp' ); if (elem) elem.textContent = tcp;
elem = Ajax.getElementOrNull('ajax-mac' ); if (elem) elem.textContent = mac;
+ elem = Ajax.getElementOrNull('ajax-dns' ); if (elem) elem.textContent = dns;
}
Ajax.server = '/net-ajax';