Central Heating controller using the real time clock, PHY module, 1-wire interface for temperature sensors, a system log and a configuration file

Dependencies:   clock mbed log net time

/media/uploads/andrewboyson/heating.sch

/media/uploads/andrewboyson/heating.brd

/media/uploads/andrewboyson/eagle.epf

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Tue Nov 14 17:50:25 2017 +0000
Parent:
35:fbc2d622273c
Commit message:
Updated libraries

Changed in this revision

http-server/html-ajax.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-boiler.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-css.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-favicon.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-heating.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-home.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-log.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-net.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-not-found.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-not-modified.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-ok.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-program.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-script.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-system.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/html-trace.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/page.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/query-ajax.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/query-boiler.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/query-heating.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/query-log.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/query-program.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/query-system.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/script.cpp Show annotated file Show diff for this revision Revisions of this file
http-server/server-http.cpp Show annotated file Show diff for this revision Revisions of this file
main/main.cpp Show annotated file Show diff for this revision Revisions of this file
main/main.h Show annotated file Show diff for this revision Revisions of this file
main/trace.cpp Show annotated file Show diff for this revision Revisions of this file
main/trace.h Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
net.lib Show annotated file Show diff for this revision Revisions of this file
ntp-client/ntp-client.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/http-server/html-ajax.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-ajax.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,6 +1,5 @@
 #include       "mbed.h"
 #include       "http.h"
-#include "http-reply.h"
 #include     "boiler.h"
 #include   "radiator.h"
 #include    "ds18b20.h"
@@ -16,7 +15,8 @@
 #include        "ntp.h"
 #include       "dhcp.h"
 #include         "ns.h"
-#include         "nr.h"
+#include        "nr4.h"
+#include        "nr6.h"
 #include "ntp-client.h"
 #include       "sync.h"
 #include     "1-wire.h"
@@ -29,15 +29,14 @@
 #include        "arp.h"
 #include        "ip4.h"
 #include        "ip6.h"
+#include        "udp.h"
+#include        "tcp.h"
+#include       "http.h"
 
-static void addBoolean(bool value)
-{
-    HttpReplyAddChar(value ? '1' : '0');
-}
 static void addNibble(char nibble)
 {
     char c = nibble < 0xA ? nibble + '0' : nibble - 0xA + 'A';
-    HttpReplyAddChar(c);
+    HttpAddChar(c);
 }
 static void addInt16(int16_t value)
 {
@@ -62,37 +61,51 @@
     addInt16(DS18B20ValueFromRom(BoilerGetTankRom  ()));
     addInt16(DS18B20ValueFromRom(BoilerGetOutputRom()));
     addInt16(DS18B20ValueFromRom(BoilerGetReturnRom()));
-    addBoolean(ProgramTimerOutput);
-    addBoolean(RadiatorGetMode());
-    addBoolean(RadiatorGetOverride());
-    addBoolean(IoRadiatorPump);
-    addBoolean(IoBoilerCall);
-    addBoolean(IoBoilerPump);
-    addBoolean(      NetTraceStack);
-    addBoolean(      NetTraceNewLine);
-    addBoolean(      NetTraceVerbose);
-    addBoolean(      PhyTrace);
-    addBoolean(  DnsNameTrace);
-    addBoolean( DnsQueryTrace);
-    addBoolean( DnsReplyTrace);
-    addBoolean(DnsServerTrace);
-    addBoolean(      NtpTrace);
-    addBoolean(     DhcpTrace);
-    addBoolean(       NsTraceRecvSol);
-    addBoolean(       NsTraceRecvAdv);
-    addBoolean(       NsTraceSendSol);
-    addBoolean(       NrTrace);
-    addBoolean(NtpClientTrace);
-    addBoolean(     SyncTrace);
-    addBoolean(  OneWireTrace);
-    addBoolean(    Echo4Trace);
-    addBoolean(    Echo6Trace);
-    addBoolean(       RaTrace);
-    addBoolean(       RsTrace);
-    addBoolean(      Ar4Trace);
-    addBoolean(      Ar6Trace);
-    addBoolean(      ArpTrace);
-    addBoolean(      Ip4Trace);
-    addBoolean(      Ip6Trace);
+    char nibble;
+    nibble  = ProgramTimerOutput    << 0;
+    nibble |= RadiatorGetMode()     << 1;
+    nibble |= RadiatorGetOverride() << 2;
+    nibble |=     IoRadiatorPump    << 3;
+    addNibble(nibble);
+    nibble  =     IoBoilerCall      << 0;
+    nibble |=     IoBoilerPump      << 1;
+    nibble |=       NetTraceStack   << 2;
+    nibble |=       NetTraceNewLine << 3;
+    addNibble(nibble);
+    nibble  =       NetTraceVerbose << 0;
+    nibble |=       PhyTrace        << 1;
+    nibble |=   DnsNameTrace        << 2;
+    nibble |=  DnsQueryTrace        << 3;
+    addNibble(nibble);
+    nibble  =  DnsReplyTrace        << 0;
+    nibble |= DnsServerTrace        << 1;
+    nibble |=       NtpTrace        << 2;
+    nibble |=      DhcpTrace        << 3;
+    addNibble(nibble);
+    nibble  =        NsTraceRecvSol << 0;
+    nibble |=        NsTraceRecvAdv << 1;
+    nibble |=        NsTraceSendSol << 2;
+    nibble |=       Nr4Trace        << 3;
+    addNibble(nibble);
+    nibble  =       Nr6Trace        << 0;
+    nibble |= NtpClientTrace        << 1;
+    nibble |=      SyncTrace        << 2;
+    nibble |=   OneWireTrace        << 3;
+    addNibble(nibble);
+    nibble  =     Echo4Trace        << 0;
+    nibble |=     Echo6Trace        << 1;
+    nibble |=        RaTrace        << 2;
+    nibble |=        RsTrace        << 3;
+    addNibble(nibble);
+    nibble  =       Ar4Trace        << 0;
+    nibble |=       Ar6Trace        << 1;
+    nibble |=       ArpTrace        << 2;
+    nibble |=       Ip4Trace        << 3;
+    addNibble(nibble);
+    nibble  =       Ip6Trace        << 0;
+    nibble |=       UdpTrace        << 1;
+    nibble |=       TcpTrace        << 2;
+    nibble |=      HttpTrace        << 3;
+    addNibble(nibble);
 }
 
--- a/http-server/html-boiler.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-boiler.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,6 +1,5 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "page.h"
 #include "boiler.h"
 #include "ds18b20.h"
@@ -13,23 +12,23 @@
     PageAddHeader("Heating - Boiler", "settings.css", NULL);
     PageAddNav(BOILER_PAGE);
     
-    HttpReplyAddText("<h1>Inputs</h1>\r\n");
+    HttpAddText("<h1>Inputs</h1>\r\n");
     int16_t temp;
     temp = DS18B20ValueFromRom(BoilerGetTankRom());    PageAddLabelledTemp("Tank",          10, temp);
     temp = DS18B20ValueFromRom(BoilerGetOutputRom());  PageAddLabelledTemp("Boiler output", 10, temp);
     temp = DS18B20ValueFromRom(BoilerGetReturnRom());  PageAddLabelledTemp("Boiler return", 10, temp);
     
-    HttpReplyAddText("<h1>Parameters</h1>\r\n");
+    HttpAddText("<h1>Parameters</h1>\r\n");
     PageAddIntInput("/boiler", 0, "Tank set point",         10, "tanksetpoint",   2, BoilerGetTankSetPoint());
     PageAddIntInput("/boiler", 0, "Tank hysteresis",        10, "tankhysteresis", 2, BoilerGetTankHysteresis());
     PageAddIntInput("/boiler", 0, "Boiler run on residual", 10, "boilerresidual", 2, BoilerGetRunOnResidual());
     PageAddIntInput("/boiler", 0, "Boiler run on time",     10, "boilerrunon",    2, BoilerGetRunOnTime());
     
-    HttpReplyAddText("<h1>Outputs</h1>\r\n");
+    HttpAddText("<h1>Outputs</h1>\r\n");
     PageAddLabelledOnOff("Boiler call", 10, IoBoilerCall);
     PageAddLabelledOnOff("Boiler pump", 10, IoBoilerPump);
 
-    HttpReplyAddText("</body>\r\n"
+    HttpAddText("</body>\r\n"
                      "</html>\r\n");
     
 }
\ No newline at end of file
--- a/http-server/html-css.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-css.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,6 +1,5 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "css-base.h"
 #include "css-settings.h"
 #include "html.h"
@@ -8,10 +7,10 @@
 void HtmlCssBase()
 {
     HtmlOk("text/css; charset=UTF-8", "max-age=3600", CssBaseDate, CssBaseTime);
-    HttpReplyAddText(CssBase);
+    HttpAddText(CssBase);
 }
 void HtmlCssSettings()
 {
     HtmlOk("text/css; charset=UTF-8", "max-age=3600", CssSettingsDate, CssSettingsTime);
-    HttpReplyAddText(CssSettings);
+    HttpAddText(CssSettings);
 }
--- a/http-server/html-favicon.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-favicon.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,11 +1,10 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "favicon.h"
 #include "html.h"
 
 void HtmlFavicon()
 {
     HtmlOk("image/x-icon", "max-age=3600", FaviconDate, FaviconTime);
-    HttpReplyAddData(Favicon, FaviconSize);
+    HttpAddData(Favicon, FaviconSize);
 }
--- a/http-server/html-heating.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-heating.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,6 +1,5 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "page.h"
 #include "ds18b20.h"
 #include "radiator.h"
@@ -14,19 +13,19 @@
     PageAddHeader("Heating - Radiators", "settings.css", "main.js");
     PageAddNav(HEATING_PAGE);
     
-    HttpReplyAddText("<h1>Inputs</h1>\r\n");
+    HttpAddText("<h1>Inputs</h1>\r\n");
     int16_t temp = DS18B20ValueFromRom(RadiatorGetHallRom());
     PageAddLabelledTemp("Hall"     , 10, temp);
     PageAddLabelledOnOff("Winter mode"    , 10, RadiatorGetMode());
     
-    HttpReplyAddText("<h1>Parameters</h1>\r\n");
+    HttpAddText("<h1>Parameters</h1>\r\n");
     PageAddIntInput("/heating", 0, "Winter (night)", 10, "nighttemp", 2, RadiatorGetNightTemperature());
     PageAddIntInput("/heating", 0, "Summer (frost)", 10, "frosttemp", 2, RadiatorGetFrostTemperature());
     
-    HttpReplyAddText("<h1>Output</h1>\r\n");
+    HttpAddText("<h1>Output</h1>\r\n");
     PageAddLabelledOnOff("Radiator pump" , 10, IoRadiatorPump);
     
-    HttpReplyAddText("</body>\r\n"
+    HttpAddText("</body>\r\n"
                      "</html>\r\n");
 
 }
--- a/http-server/html-home.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-home.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,6 +1,5 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "page.h"
 #include "clock.h"
 #include "radiator.h"
@@ -14,15 +13,15 @@
     HtmlOk("text/html; charset=UTF-8", "no-cache", NULL, NULL);
     PageAddHeader("Heating - Home", NULL, "main.js");
     
-    HttpReplyAddText("<a id='nav-toggle' href='/system'>&#9776;</a>"); //Hamburger link to settings
-    HttpReplyAddText("<div id='ajax-date-html'></div>");
+    HttpAddText("<a id='nav-toggle' href='/system'>&#9776;</a>"); //Hamburger link to settings
+    HttpAddText("<div id='ajax-date-html'></div>");
         
     PageAddLabelledName("Hall", 4, "ajax-hall-html", "&deg;C");
     
     PageAddToggle(10.0, "Mode: Summer|Winter", "ajax-mode-toggle"    , "htg-chg-mode"  );
     PageAddToggle(10.0, "Radiators: Off|On"  , "ajax-radiator-toggle", "htg-chg-output");
 
-    HttpReplyAddText("</body>\r\n"
+    HttpAddText("</body>\r\n"
                      "</html>\r\n");
 }
 
--- a/http-server/html-log.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-log.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,6 +1,5 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "page.h"
 #include  "log.h"
 #include "html.h"
@@ -11,15 +10,15 @@
     PageAddHeader("Heating - Log", "settings.css", NULL);
     PageAddNav(LOG_PAGE);
     
-    HttpReplyAddText("\r\n"
+    HttpAddText("\r\n"
                      "<h1>GPS Clock - Log</h1>\r\n");
-    HttpReplyAddText("<h2>");
+    HttpAddText("<h2>");
     PageAddCheckInput("/log", "Log", "clearlog", "clear");
-    HttpReplyAddText("</h2>\r\n");
+    HttpAddText("</h2>\r\n");
     
-    HttpReplyAddText("<code>");
-    HttpReplyAddStream(LogEnumerateStart, LogEnumerate);
-    HttpReplyAddText("</code>\r\n"
+    HttpAddText("<code>");
+    HttpAddStream(LogEnumerateStart, LogEnumerate);
+    HttpAddText("</code>\r\n"
                      "</body>\r\n"
                      "</html>\r\n");
 
--- a/http-server/html-net.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-net.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,19 +1,19 @@
-#include    "mbed.h"
-#include "http.h"
-#include "http-reply.h"
-#include     "page.h"
-#include      "net.h"
-#include      "mac.h"
-#include      "ip4.h"
-#include      "ip6.h"
-#include      "ar4.h"
-#include      "ar6.h"
-#include       "nr.h"
-#include      "ndp.h"
-#include      "ndp.h"
-#include     "dhcp.h"
-#include    "slaac.h"
-#include     "html.h"
+#include  "mbed.h"
+#include  "http.h"
+#include  "page.h"
+#include   "net.h"
+#include   "mac.h"
+#include   "ip4.h"
+#include   "ip6.h"
+#include   "ar4.h"
+#include   "ar6.h"
+#include   "nr4.h"
+#include   "nr6.h"
+#include   "ndp.h"
+#include   "ndp.h"
+#include  "dhcp.h"
+#include "slaac.h"
+#include  "html.h"
 
 #define WIDTH 16
 
@@ -23,50 +23,51 @@
     PageAddHeader("Heating - Net", "settings.css", NULL);
     PageAddNav(NET_PAGE);
     
-    HttpReplyAddText("\r\n"
+    HttpAddText("\r\n"
                      "<h1>Heating - Net</h1>\r\n");
                      
-    HttpReplyAddText("<h2>Ethernet</h2>\r\n");
-    PageAddLabelledMac  ("MAC",                 WIDTH, MacLocal);
+    HttpAddText("<h2>Ethernet</h2>\r\n");
+    PageAddLabelledMac  ("MAC",                   WIDTH, MacLocal);
     
-    HttpReplyAddText("<h2>IP4 DHCP</h2>\r\n");
-    PageAddLabelledIp4  ("IP4 address",         WIDTH, DhcpLocalIp);
-    PageAddLabelledValue("Domain",              WIDTH, DhcpDomainName);
-    PageAddLabelledValue("Host name",           WIDTH, DhcpHostName);
-    PageAddLabelledIp4  ("NTP server",          WIDTH, DhcpNtp);
-    PageAddLabelledIp4  ("DNS server",          WIDTH, DhcpDnsServer);
-    PageAddLabelledIp4  ("DHCP server",         WIDTH, DhcpServer);
-    PageAddLabelledIp4  ("Router",              WIDTH, DhcpRouter);
-    PageAddLabelledIp4  ("Subnet mask",         WIDTH, DhcpSubnetMask);
-    PageAddLabelledIp4  ("Broadcast IP",        WIDTH, DhcpBroadcastIp);
-    PageAddLabelledInt  ("Lease time IP",       WIDTH, DhcpLeaseTime);
-    PageAddLabelledInt  ("Renewal T1",          WIDTH, DhcpRenewalT1);
-    PageAddLabelledInt  ("Renewal T2",          WIDTH, DhcpRenewalT2);
-    PageAddLabelledInt  ("Elapsed",             WIDTH, DhcpElapsedTime);
+    HttpAddText("<h2>IP4 DHCP</h2>\r\n");
+    PageAddLabelledIp4  ("IP4 address",           WIDTH, DhcpLocalIp);
+    PageAddLabelledValue("Domain",                WIDTH, DhcpDomainName);
+    PageAddLabelledValue("Host name",             WIDTH, DhcpHostName);
+    PageAddLabelledIp4  ("NTP server",            WIDTH, DhcpNtp);
+    PageAddLabelledIp4  ("DNS server",            WIDTH, DhcpDnsServer);
+    PageAddLabelledIp4  ("DHCP server",           WIDTH, DhcpServer);
+    PageAddLabelledIp4  ("Router",                WIDTH, DhcpRouter);
+    PageAddLabelledIp4  ("Subnet mask",           WIDTH, DhcpSubnetMask);
+    PageAddLabelledIp4  ("Broadcast IP",          WIDTH, DhcpBroadcastIp);
+    PageAddLabelledInt  ("Lease time IP",         WIDTH, DhcpLeaseTime);
+    PageAddLabelledInt  ("Renewal T1",            WIDTH, DhcpRenewalT1);
+    PageAddLabelledInt  ("Renewal T2",            WIDTH, DhcpRenewalT2);
+    PageAddLabelledInt  ("Elapsed",               WIDTH, DhcpElapsedTime);
     
-    HttpReplyAddText("<h2>IP6 NDP</h2>\r\n");
-    PageAddLabelledInt  ("Hop limit",           WIDTH, NdpHopLimit);
-    PageAddLabelledOnOff("Managed address",     WIDTH, NdpManagedConfiguration);
-    PageAddLabelledOnOff("Other configuration", WIDTH, NdpOtherConfiguration);
-    PageAddLabelledMac  ("Router MAC",          WIDTH, NdpRouterMac);
-    PageAddLabelledInt  ("Prefix length",       WIDTH, NdpPrefixLength);
-    PageAddLabelledInt  ("Prefix LA",           WIDTH, NdpPrefixLA);
-    PageAddLabelledInt  ("Prefix valid secs",   WIDTH, NdpPrefixValidLifetime);
-    PageAddLabelledInt  ("Prefix preferred s",  WIDTH, NdpPrefixPreferredLifetime);
-    PageAddLabelledIp6  ("Prefix",              WIDTH, NdpPrefix);
-    PageAddLabelledInt  ("DNS life secs",       WIDTH, NdpDnsLifetime);
-    PageAddLabelledIp6  ("DNS server",          WIDTH, NdpDnsServer);
-    PageAddLabelledInt  ("Lease time",          WIDTH, NdpLifetime);
-    PageAddLabelledInt  ("Elapsed",             WIDTH, NdpElapsedTime);
-    PageAddLabelledIp6  ("SLAAC",               WIDTH, SlaacLinkLocalIp);
-    PageAddLabelledInt  ("MTU",                 WIDTH, NdpMtu);
+    HttpAddText("<h2>IP6 NDP</h2>\r\n");
+    PageAddLabelledInt  ("Hop limit",             WIDTH, NdpHopLimit);
+    PageAddLabelledOnOff("Managed address",       WIDTH, NdpManagedConfiguration);
+    PageAddLabelledOnOff("Other configuration",   WIDTH, NdpOtherConfiguration);
+    PageAddLabelledMac  ("Router MAC",            WIDTH, NdpRouterMac);
+    PageAddLabelledInt  ("Prefix length",         WIDTH, NdpPrefixLength);
+    PageAddLabelledOnOff("Prefix flag L",         WIDTH, NdpPrefixFlagL);
+    PageAddLabelledOnOff("Prefix flag A",         WIDTH, NdpPrefixFlagA);
+    PageAddLabelledInt  ("Prefix valid secs",     WIDTH, NdpPrefixValidLifetime);
+    PageAddLabelledInt  ("Prefix preferred secs", WIDTH, NdpPrefixPreferredLifetime);
+    PageAddLabelledIp6  ("Prefix",                WIDTH, NdpPrefix);
+    PageAddLabelledInt  ("DNS life secs",         WIDTH, NdpDnsLifetime);
+    PageAddLabelledIp6  ("DNS server",            WIDTH, NdpDnsServer);
+    PageAddLabelledInt  ("Lease time",            WIDTH, NdpLifetime);
+    PageAddLabelledInt  ("Elapsed",               WIDTH, NdpElapsedTime);
+    PageAddLabelledIp6  ("SLAAC",                 WIDTH, SlaacLinkLocalIp);
+    PageAddLabelledInt  ("MTU",                   WIDTH, NdpMtu);
                
-    HttpReplyAddText("<h2>ARP 4</h2>\r\n<code>"); Ar4SendHttp(); HttpReplyAddText("</code>\r\n");
-    HttpReplyAddText("<h2>DNS 4</h2>\r\n<code>"); NrSendHttp4(); HttpReplyAddText("</code>\r\n");
-    HttpReplyAddText("<h2>ARP 6</h2>\r\n<code>"); Ar6SendHttp(); HttpReplyAddText("</code>\r\n");
-    HttpReplyAddText("<h2>DNS 6</h2>\r\n<code>"); NrSendHttp6(); HttpReplyAddText("</code>\r\n");
+    HttpAddText("<h2>ARP 4</h2>\r\n<code>"); Ar4SendHttp(); HttpAddText("</code>\r\n");
+    HttpAddText("<h2>DNS 4</h2>\r\n<code>"); Nr4SendHttp(); HttpAddText("</code>\r\n");
+    HttpAddText("<h2>ARP 6</h2>\r\n<code>"); Ar6SendHttp(); HttpAddText("</code>\r\n");
+    HttpAddText("<h2>DNS 6</h2>\r\n<code>"); Nr6SendHttp(); HttpAddText("</code>\r\n");
     
-    HttpReplyAddText("</body>\r\n"
+    HttpAddText("</body>\r\n"
                      "</html>\r\n");
                         
 }
--- a/http-server/html-not-found.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-not-found.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,8 +1,8 @@
 #include "mbed.h"
-#include "http-reply.h"
+#include "http.h"
 
 void HtmlNotFound()
 {
-    HttpReplyAddText("HTTP/1.1 404 Not Found\r\n"
+    HttpAddText("HTTP/1.1 404 Not Found\r\n"
                     "\r\n");
 }
--- a/http-server/html-not-modified.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-not-modified.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,14 +1,13 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 
 void HtmlNotModified()
 {
-    HttpReplyAddText("HTTP/1.1 304 Not Modified\r\n"
+    HttpAddText("HTTP/1.1 304 Not Modified\r\n"
                      "Date: ");
     char pDate[HTTP_DATE_LENGTH];
     HttpDateFromNow(pDate);
-    HttpReplyAddText(pDate);
-    HttpReplyAddText("\r\n"
+    HttpAddText(pDate);
+    HttpAddText("\r\n"
                      "\r\n");
 }
--- a/http-server/html-ok.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-ok.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,36 +1,35 @@
 #include "mbed.h"
 #include "log.h"
 #include "http.h"
-#include "http-reply.h"
 
 void HtmlOk(const char* contentType, const char* cacheControl, const char* lastModifiedDate, const char* lastModifiedTime)
 {
     if (!contentType)  LogTimeF("HtmlOk - missing Content-Type info\r\n");
     if (!cacheControl) LogTimeF("HtmlOk - missing Cache-Control info\r\n");
     
-    HttpReplyAddText("HTTP/1.1 200 OK\r\n"
+    HttpAddText("HTTP/1.1 200 OK\r\n"
                      "Connection: close\r\n"
                      "Content-Type: ");
-    HttpReplyAddText(contentType);
+    HttpAddText(contentType);
     
-    HttpReplyAddText("\r\n"
+    HttpAddText("\r\n"
                      "Cache-Control: ");
-    HttpReplyAddText(cacheControl);
+    HttpAddText(cacheControl);
     
-    HttpReplyAddText("\r\n"
+    HttpAddText("\r\n"
                      "Date: ");
     char pDate[HTTP_DATE_LENGTH];
     HttpDateFromNow(pDate);
-    HttpReplyAddText(pDate);
+    HttpAddText(pDate);
     
     if (lastModifiedDate)
     {
-        HttpReplyAddText("\r\n"
+        HttpAddText("\r\n"
                          "Last-Modified: ");   
         HttpDateFromDateTime(lastModifiedDate, lastModifiedTime, pDate);
-        HttpReplyAddText(pDate);
+        HttpAddText(pDate);
     }
     
-    HttpReplyAddText("\r\n"
+    HttpAddText("\r\n"
                      "\r\n");
 }
--- a/http-server/html-program.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-program.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,7 +1,6 @@
 #include "mbed.h"
 #include "page.h"
 #include "http.h"
-#include "http-reply.h"
 #include "program.h"
 #include "html.h"
 
@@ -11,27 +10,27 @@
     PageAddHeader("Heating - Program", "settings.css", NULL);
     PageAddNav(PROGRAM_PAGE);
     
-    HttpReplyAddText("<h1>Programs</h1>\r\n");
+    HttpAddText("<h1>Programs</h1>\r\n");
     const int PROGRAM_CHARACTER_LENGTH = 30;
     char value[PROGRAM_CHARACTER_LENGTH];
     ProgramToString(0, PROGRAM_CHARACTER_LENGTH, value); PageAddTextInput("/program", 0, "1", 1, "program1", 15, value);
     ProgramToString(1, PROGRAM_CHARACTER_LENGTH, value); PageAddTextInput("/program", 0, "2", 1, "program2", 15, value);
     ProgramToString(2, PROGRAM_CHARACTER_LENGTH, value); PageAddTextInput("/program", 0, "3", 1, "program3", 15, value);
     
-    HttpReplyAddText("<h1>Days</h1>\r\n");
-    HttpReplyAddText("<div>\r\n");
+    HttpAddText("<h1>Days</h1>\r\n");
+    HttpAddText("<div>\r\n");
     PageAddIntInput("/program", 3.3, "Mon", 2.3, "mon", 1, ProgramGetDay(1) + 1);
     PageAddIntInput("/program", 3.3, "Tue", 2.3, "tue", 1, ProgramGetDay(2) + 1);
     PageAddIntInput("/program", 3.3, "Wed", 2.3, "wed", 1, ProgramGetDay(3) + 1);
     PageAddIntInput("/program", 3.3, "Thu", 2.3, "thu", 1, ProgramGetDay(4) + 1);
     PageAddIntInput("/program", 3.3, "Fri", 2.3, "fri", 1, ProgramGetDay(5) + 1);
-    HttpReplyAddText("</div>\r\n");
+    HttpAddText("</div>\r\n");
     
-    HttpReplyAddText("<div>\r\n");
+    HttpAddText("<div>\r\n");
     PageAddIntInput("/program", 3.3, "Sat", 2.3, "sat", 1, ProgramGetDay(6) + 1);
     PageAddIntInput("/program", 3.3, "Sun", 2.3, "sun", 1, ProgramGetDay(0) + 1);
-    HttpReplyAddText("</div>\r\n");
+    HttpAddText("</div>\r\n");
     
-    HttpReplyAddText("</body>\r\n"
+    HttpAddText("</body>\r\n"
                      "</html>\r\n");
 }
--- a/http-server/html-script.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-script.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,11 +1,10 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "script.h"
 #include "html.h"
 
 void HtmlScript()
 {
     HtmlOk("application/javascript; charset=UTF-8", "max-age=3600", ScriptDate, ScriptTime);
-    HttpReplyAddText(Script);
+    HttpAddText(Script);
 }
--- a/http-server/html-system.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-system.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,6 +1,5 @@
 #include "mbed.h"
 #include "http.h"
-#include "http-reply.h"
 #include "html.h"
 #include "page.h"
 #include "clock.h"
@@ -26,17 +25,17 @@
     PageAddHeader("Heating - System", "settings.css", "main.js");
     PageAddNav(SYSTEM_PAGE);
     
-    HttpReplyAddText("<h1>Ajax</h1>\r\n");
-    HttpReplyAddText("<code id='ajax-headers-html'></code>\r\n");
-    HttpReplyAddText("<code id='ajax-response-html'></code>\r\n");
-    HttpReplyAddText("<h1>Scan times</h1>\r\n");
+    HttpAddText("<h1>Ajax</h1>\r\n");
+    HttpAddText("<code id='ajax-headers-html'></code>\r\n");
+    HttpAddText("<code id='ajax-response-html'></code>\r\n");
+    HttpAddText("<h1>Scan times</h1>\r\n");
     PageAddLabelledInt("Program &micro;s", 10, IoScanAverage / 96);
     PageAddLabelledInt("Devices ms",       10, DeviceScanMs);
 
-    HttpReplyAddText("<h1>FRAM</h1>\r\n");
+    HttpAddText("<h1>FRAM</h1>\r\n");
     PageAddLabelledInt("Used",             10, FramUsed);
 
-    HttpReplyAddText("<h1>Last reset</h1>\r\n");
+    HttpAddText("<h1>Last reset</h1>\r\n");
     if (WatchdogFlag)
     {
         PageAddCheckInput("/system", "Watchdog bit", "watchdogflagoff", "clear it");
@@ -44,50 +43,50 @@
     }
     else
     {
-        HttpReplyAddText("<div>Normal</div>\r\n");
+        HttpAddText("<div>Normal</div>\r\n");
     }
 
-    HttpReplyAddText("<h1>1-wire bus start tweaks</h1>\r\n");
+    HttpAddText("<h1>1-wire bus start tweaks</h1>\r\n");
     PageAddLabelledInt("Low",     10, OneWireBusLowTweak);
     PageAddLabelledInt("Float",   10, OneWireBusFloatTweak);
     PageAddLabelledInt("Read",    10, OneWireBusReadTweak);
     PageAddLabelledInt("High",    10, OneWireBusHighTweak);
     PageAddLabelledInt("Release", 10, OneWireBusReleaseTweak);
 
-    HttpReplyAddText("<h1>DS18B20 1-wire devices</h1>\r\n");
+    HttpAddText("<h1>DS18B20 1-wire devices</h1>\r\n");
     for (int device = 0; device < DeviceCount; device++)
     {
         char addressbuffer[DEVICE_ADDRESS_STRING_LENGTH];   DeviceAddressToString(DeviceList + device * 8, addressbuffer);
         char   valuebuffer[DS18B20_VALUE_STRING_LENGTH];     DS18B20ValueToString(DS18B20Value[device]   ,   valuebuffer);
         char text[200];
         snprintf(text, sizeof(text), "<div style='width:15em;'>%s<span style='float:right;'>&rarr; %s&deg;C</span></div>\r\n", addressbuffer, valuebuffer);
-        HttpReplyAddText(text);
+        HttpAddText(text);
     }
     
-    HttpReplyAddText("<h1>ROMs</h1>\r\n");
+    HttpAddText("<h1>ROMs</h1>\r\n");
     char text[DEVICE_ADDRESS_STRING_LENGTH];
     DeviceAddressToString(BoilerGetTankRom(),   text); PageAddTextInput("/system", 0, "Tank",          6, "tankrom",         11, text);
     DeviceAddressToString(BoilerGetOutputRom(), text); PageAddTextInput("/system", 0, "Boiler output", 6, "boileroutputrom", 11, text);
     DeviceAddressToString(BoilerGetReturnRom(), text); PageAddTextInput("/system", 0, "Boiler return", 6, "boilerreturnrom", 11, text);
     DeviceAddressToString(RadiatorGetHallRom(), text); PageAddTextInput("/system", 0, "Hall",          6, "hallrom",         11, text);
         
-    HttpReplyAddText("<h1>Program new day start time</h1>\r\n");
-    HttpReplyAddText("<div>\r\n");
+    HttpAddText("<h1>Program new day start time</h1>\r\n");
+    HttpAddText("<div>\r\n");
     PageAddIntInput("/system", 0, "Hour", 15, "newdayhour", 2, ProgramGetNewDayHour());
-    HttpReplyAddText("</div>\r\n");
+    HttpAddText("</div>\r\n");
     
-    HttpReplyAddText("<h1>Time</h1>\r\n");
-    if (!  RtcIsSet()) HttpReplyAddText("<div>RTC   is not set!</div>\r\n");
-    if (!ClockIsSet()) HttpReplyAddText("<div>Clock is not set!</div>\r\n");
+    HttpAddText("<h1>Time</h1>\r\n");
+    if (!  RtcIsSet()) HttpAddText("<div>RTC   is not set!</div>\r\n");
+    if (!ClockIsSet()) HttpAddText("<div>Clock is not set!</div>\r\n");
     struct tm tm;
-    ClockTmUtc(&tm);   HttpReplyAddText("<div>\r\n"); PageAddTm(&tm); HttpReplyAddText("</div>\r\n");
-    ClockTmLocal(&tm); HttpReplyAddText("<div>\r\n"); PageAddTm(&tm); HttpReplyAddText("</div>\r\n");
+    ClockTmUtc(&tm);   HttpAddText("<div>\r\n"); PageAddTm(&tm); HttpAddText("</div>\r\n");
+    ClockTmLocal(&tm); HttpAddText("<div>\r\n"); PageAddTm(&tm); HttpAddText("</div>\r\n");
     
-    HttpReplyAddText("<h1>Net</h1>\r\n");
+    HttpAddText("<h1>Net</h1>\r\n");
     if (NetPreferIp4Polled) PageAddCheckInput("/system", "Ip4 preferred", "preferip6", "prefer IP6");
     else                    PageAddCheckInput("/system", "Ip6 preferred", "preferip4", "prefer IP4");
     
-    HttpReplyAddText("<h1>NTP</h1>\r\n");
+    HttpAddText("<h1>NTP</h1>\r\n");
     PageAddTextInput("/system", 0, "Server url",              12, "ntpserver",      5, NtpClientGetServerName()             );
     PageAddIntInput ("/system", 0, "Initial interval (s)",    12, "clockinitial",   5, NtpClientGetInitialInterval()        );
     PageAddIntInput ("/system", 0, "Normal interval (m)",     12, "clocknormal",    5, NtpClientGetNormalInterval() / 60    );
@@ -95,7 +94,7 @@
     PageAddIntInput ("/system", 0, "Offset (ms)",             12, "clockoffset",    5, NtpClientGetOffsetMs()               );
     PageAddIntInput ("/system", 0, "Max delay (ms)",          12, "clockmaxdelay",  5, NtpClientGetMaxDelayMs()             );
     
-    HttpReplyAddText("<h1>Clock</h1>\r\n");
+    HttpAddText("<h1>Clock</h1>\r\n");
     PageAddIntInput ("/system", 0, "Ppb",                     12, "ppb",            5, TickGetPpb()                    );
     PageAddIntInput ("/system", 0, "Ppb divisor",             12, "ppbdivisor",     5, ClockPpbDivisor                 );
     PageAddIntInput ("/system", 0, "Ppb max change",          12, "ppbmaxchange",   5, ClockPpbChangeMax               );
@@ -108,7 +107,7 @@
     PageAddIntInput ("/system", 0, "Offset synced hys (ms)",  12, "syncedhysns",    5, ClockSyncedHysterisNs / 1000000 );
     PageAddIntInput ("/system", 0, "Offset reset limit (s)",  12, "maxoffsetsecs",  5, ClockMaxOffsetSecs              );
         
-    HttpReplyAddText("</body>\r\n"
+    HttpAddText("</body>\r\n"
                      "</html>\r\n");
 
 }
--- a/http-server/html-trace.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/html-trace.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "html.h"
 #include "page.h"
-#include "http-reply.h"
+#include "http.h"
 
 
 void HtmlTrace()
@@ -10,40 +10,44 @@
     PageAddHeader("Heating - Trace", "settings.css", "main.js");
     PageAddNav(TRACE_PAGE);
     
-    HttpReplyAddText("<h1>Trace</h1>\r\n");
-    HttpReplyAddText("<h2>General</h2>\r\n");
+    HttpAddText("<h1>Trace</h1>\r\n");
+    HttpAddText("<h2>General</h2>\r\n");
     PageAddToggle(10.0, "Trace stack"       , "ajax-trace-net-stack"  , "trace-chg-net-stack"  );
     PageAddToggle(10.0, "Trace new line"    , "ajax-trace-net-newline", "trace-chg-net-newline");
     PageAddToggle(10.0, "Trace verbose"     , "ajax-trace-net-verbose", "trace-chg-net-verbose");
     PageAddToggle(10.0, "1-Wire"            , "ajax-trace-1-wire"     , "trace-chg-1-wire"     );
-    HttpReplyAddText("<h2>Net</h2>\r\n");
+    HttpAddText("<h2>Net</h2>\r\n");
     PageAddToggle(10.0, "MAC"               , "ajax-trace-phy"        , "trace-chg-phy"        );
     PageAddToggle(10.0, "Ip4 filtered"      , "ajax-trace-ip4"        , "trace-chg-ip4"        );
     PageAddToggle(10.0, "Ip6 filtered"      , "ajax-trace-ip6"        , "trace-chg-ip6"        );
+    PageAddToggle(10.0, "Udp filtered"      , "ajax-trace-udp"        , "trace-chg-udp"        );
+    PageAddToggle(10.0, "Tcp filtered"      , "ajax-trace-tcp"        , "trace-chg-tcp"        );
     PageAddToggle(10.0, "Echo4 (ping4)"     , "ajax-trace-echo4"      , "trace-chg-echo4"      );
     PageAddToggle(10.0, "Echo6 (ping6)"     , "ajax-trace-echo6"      , "trace-chg-echo6"      );
-    HttpReplyAddText("<h2>Router Resolution</h2>\r\n");
+    PageAddToggle(10.0, "HTTP"              , "ajax-trace-http"       , "trace-chg-http"       );
+    HttpAddText("<h2>Router Resolution</h2>\r\n");
     PageAddToggle(10.0, "Router advertise"  , "ajax-trace-ra"         , "trace-chg-ra"         );
     PageAddToggle(10.0, "Router solicit"    , "ajax-trace-rs"         , "trace-chg-rs"         );
     PageAddToggle(10.0, "DHCP"              , "ajax-trace-dhcp"       , "trace-chg-dhcp"       );
-    HttpReplyAddText("<h2>Address Resolution</h2>\r\n");
+    HttpAddText("<h2>Address Resolution</h2>\r\n");
     PageAddToggle(10.0, "IP4 cache"         , "ajax-trace-ar4"        , "trace-chg-ar4"        );
     PageAddToggle(10.0, "IP6 cache"         , "ajax-trace-ar6"        , "trace-chg-ar6"        );
     PageAddToggle(10.0, "ARP"               , "ajax-trace-arp"        , "trace-chg-arp"        );
     PageAddToggle(10.0, "NS server"         , "ajax-trace-ns-recv-sol", "trace-chg-ns-recv-sol");
     PageAddToggle(10.0, "NS client reply"   , "ajax-trace-ns-recv-adv", "trace-chg-ns-recv-adv");
     PageAddToggle(10.0, "NS client query"   , "ajax-trace-ns-send-sol", "trace-chg-ns-send-sol");
-    HttpReplyAddText("<h2>Name Resolution</h2>\r\n");
-    PageAddToggle(10.0, "Name resolution"   , "ajax-trace-nr"         , "trace-chg-nr"         );
+    HttpAddText("<h2>Name Resolution</h2>\r\n");
+    PageAddToggle(10.0, "IP4 cache"         , "ajax-trace-nr4"        , "trace-chg-nr4"        );
+    PageAddToggle(10.0, "IP6 cache"         , "ajax-trace-nr6"        , "trace-chg-nr6"        );
     PageAddToggle(10.0, "DNS name"          , "ajax-trace-dns-name"   , "trace-chg-dns-name"   );
     PageAddToggle(10.0, "DNS client query"  , "ajax-trace-dns-query"  , "trace-chg-dns-query"  );
     PageAddToggle(10.0, "DNS client reply"  , "ajax-trace-dns-reply"  , "trace-chg-dns-reply"  );
     PageAddToggle(10.0, "DNS server"        , "ajax-trace-dns-server" , "trace-chg-dns-server" );
-    HttpReplyAddText("<h2>NTP</h2>\r\n");
+    HttpAddText("<h2>NTP</h2>\r\n");
     PageAddToggle(10.0, "NTP"               , "ajax-trace-ntp"        , "trace-chg-ntp"        );
     PageAddToggle(10.0, "NTP client"        , "ajax-trace-ntp-client" , "trace-chg-ntp-client" );
     PageAddToggle(10.0, "Clock sync"        , "ajax-trace-sync"       , "trace-chg-sync"       );
     
-    HttpReplyAddText("</body>\r\n</html>\r\n");
+    HttpAddText("</body>\r\n</html>\r\n");
     
 }
--- a/http-server/page.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/page.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,36 +1,36 @@
-#include "mbed.h"
-#include "http-reply.h"
-#include "page.h"
+#include    "mbed.h"
+#include    "http.h"
+#include    "page.h"
 #include "ds18b20.h"
-#include "mac.h"
-#include "ip4.h"
-#include "ip6.h"
+#include     "mac.h"
+#include "ip4addr.h"
+#include "ip6addr.h"
 
 void PageAddHeader(const char* title, const char* style, const char* script)
 {
-    HttpReplyAddText("<!DOCTYPE html>\r\n"
+    HttpAddText("<!DOCTYPE html>\r\n"
                      "<html>\r\n"
                      "<head>\r\n");
     if (title)
     {
-        HttpReplyAddText("   <title>");
-        HttpReplyAddText(title);
-        HttpReplyAddText("</title>\r\n");
+        HttpAddText("   <title>");
+        HttpAddText(title);
+        HttpAddText("</title>\r\n");
     }
-    HttpReplyAddText("   <link rel='stylesheet' href='/base.css' type='text/css'/>\r\n");
+    HttpAddText("   <link rel='stylesheet' href='/base.css' type='text/css'/>\r\n");
     if (style)
     {
-        HttpReplyAddText("   <link rel='stylesheet' href='/");
-        HttpReplyAddText(style);
-        HttpReplyAddText("' type='text/css'/>\r\n");
+        HttpAddText("   <link rel='stylesheet' href='/");
+        HttpAddText(style);
+        HttpAddText("' type='text/css'/>\r\n");
     }
     if (script)
     {
-        HttpReplyAddText("   <script src='/");
-        HttpReplyAddText(script);
-        HttpReplyAddText("' type='text/javascript'></script>\r\n");
+        HttpAddText("   <script src='/");
+        HttpAddText(script);
+        HttpAddText("' type='text/javascript'></script>\r\n");
     }
-    HttpReplyAddText("   <meta name='viewport' content='width=device-width, initial-scale=1'>\r\n"
+    HttpAddText("   <meta name='viewport' content='width=device-width, initial-scale=1'>\r\n"
                      "   <link rel='icon'       href='/favicon.ico' type='image/x-icon'/>\r\n"
                      "</head>\r\n"
                      "<body>\r\n");
@@ -40,20 +40,20 @@
 static void addNavItem(bool highlight, char* href, char* title)
 {
     char *p;
-    HttpReplyAddText("<li ");
+    HttpAddText("<li ");
     if (highlight) p = "class='this'";
     else           p = "            ";
-    HttpReplyAddText(p);
-    HttpReplyAddText("><a href='");
-    HttpReplyAddText(href);
-    HttpReplyAddText("'>");
-    HttpReplyAddText(title);
-    HttpReplyAddText("</a></li>\r\n");
+    HttpAddText(p);
+    HttpAddText("><a href='");
+    HttpAddText(href);
+    HttpAddText("'>");
+    HttpAddText(title);
+    HttpAddText("</a></li>\r\n");
 
 }
 void PageAddNav(int page)
 {
-    HttpReplyAddText("<nav><ul>\r\n");
+    HttpAddText("<nav><ul>\r\n");
     addNavItem(page ==    HOME_PAGE, "/",        "Home");
     addNavItem(page == PROGRAM_PAGE, "/program", "Program");
     addNavItem(page == HEATING_PAGE, "/heating", "Heating");
@@ -62,60 +62,60 @@
     addNavItem(page ==     NET_PAGE, "/net",     "Net");
     addNavItem(page ==     LOG_PAGE, "/log",     "Log");
     addNavItem(page ==   TRACE_PAGE, "/trace",   "Trace");
-    HttpReplyAddText("</ul></nav>\r\n");
+    HttpAddText("</ul></nav>\r\n");
 }
 
 void PageAddLabelledValue(char* label, float labelwidth, char* value)
 {
-    HttpReplyAddF   ("<div style='width:%.1fem;'>", labelwidth);
-    HttpReplyAddText(label);
-    HttpReplyAddText("<span style='float:right;'>");
-    HttpReplyAddText(value);
-    HttpReplyAddText("</span>");
-    HttpReplyAddText("</div>\r\n");
+    HttpAddF   ("<div style='width:%.1fem;'>", labelwidth);
+    HttpAddText(label);
+    HttpAddText("<span style='float:right;'>");
+    HttpAddText(value);
+    HttpAddText("</span>");
+    HttpAddText("</div>\r\n");
 }
 
 void PageAddLabelledMac(char* label, float labelwidth, char* mac)
 {
-    HttpReplyAddF   ("<div style='width:%.1fem;'>", labelwidth);
-    HttpReplyAddText(label);
-    HttpReplyAddText("<span style='float:right;'>");
+    HttpAddF   ("<div style='width:%.1fem;'>", labelwidth);
+    HttpAddText(label);
+    HttpAddText("<span style='float:right;'>");
     MacHttp         (mac);
-    HttpReplyAddText("</span>");
-    HttpReplyAddText("</div>\r\n");
+    HttpAddText("</span>");
+    HttpAddText("</div>\r\n");
 }
 
 void PageAddLabelledIp4(char* label, float labelwidth, uint32_t ip)
 {
-    HttpReplyAddF   ("<div style='width:%.1fem;'>", labelwidth);
-    HttpReplyAddText(label);
-    HttpReplyAddText("<span style='float:right;'>");
+    HttpAddF   ("<div style='width:%.1fem;'>", labelwidth);
+    HttpAddText(label);
+    HttpAddText("<span style='float:right;'>");
     Ip4AddressHttp  (ip);
-    HttpReplyAddText("</span>");
-    HttpReplyAddText ("</div>\r\n");
+    HttpAddText("</span>");
+    HttpAddText ("</div>\r\n");
 }
 
 void PageAddLabelledIp6(char* label, float labelwidth, char* ip)
 {
-    HttpReplyAddF   ("<div style='width:%.1fem;'>", labelwidth);
-    HttpReplyAddText(label);
-    HttpReplyAddText("<span style='float:right;'>");
+    HttpAddF   ("<div style='width:%.1fem;'>", labelwidth);
+    HttpAddText(label);
+    HttpAddText("<span style='float:right;'>");
     Ip6AddressHttp  (ip);
-    HttpReplyAddText("</span>");
-    HttpReplyAddText ("</div>\r\n");
+    HttpAddText("</span>");
+    HttpAddText ("</div>\r\n");
 }
 void PageAddLabelledName(char* label, float labelwidth, char* name, char* suffix)
 {
     char text[100];
-    HttpReplyAddText("<div>");
+    HttpAddText("<div>");
     snprintf(text, sizeof(text), "<div style='width:%.1fem; display:inline-block;'>", labelwidth);
-    HttpReplyAddText(text);
-    HttpReplyAddText(label);
-    HttpReplyAddText("</div><span id='");
-    HttpReplyAddText(name);
-    HttpReplyAddText("'></span>");
-    HttpReplyAddText(suffix);
-    HttpReplyAddText("</div>\r\n");
+    HttpAddText(text);
+    HttpAddText(label);
+    HttpAddText("</div><span id='");
+    HttpAddText(name);
+    HttpAddText("'></span>");
+    HttpAddText(suffix);
+    HttpAddText("</div>\r\n");
 }
 void PageAddLabelledOnOff(char* label, float labelwidth, bool value)
 {
@@ -136,24 +136,24 @@
 }
 void PageAddTextInput(char* action, float width, char* label, float labelwidth, char* name, float inputwidth, char* value)
 {
-    HttpReplyAddText("<form action='");    HttpReplyAddText(action);    HttpReplyAddText("' method='get'>\r\n");
+    HttpAddText("<form action='");    HttpAddText(action);    HttpAddText("' method='get'>\r\n");
     
     char text[100];
     if (width < 0.01)
     {
-        HttpReplyAddText("<div>");
+        HttpAddText("<div>");
     }
     else
     {
         snprintf(text, sizeof(text), "<div style='width:%.1fem; display:inline-block;'>", width);
-        HttpReplyAddText(text);
+        HttpAddText(text);
     }
     snprintf(text, sizeof(text), "<div style='width:%.1fem; display:inline-block;'>%s</div>", labelwidth, label);
-    HttpReplyAddText(text);
+    HttpAddText(text);
     snprintf(text, sizeof(text), "<input type='text' name='%s' style='width:%.1fem;' value='%s'>", name, inputwidth, value);
-    HttpReplyAddText(text);
-    HttpReplyAddText("</div>\r\n");
-    HttpReplyAddText("<input type='submit' value='Set' style='display:none;'>\r\n</form>\r\n");
+    HttpAddText(text);
+    HttpAddText("</div>\r\n");
+    HttpAddText("<input type='submit' value='Set' style='display:none;'>\r\n</form>\r\n");
 
 }
 void PageAddIntInput(char* action, float width, char* label, float labelwidth, char* name, float inputwidth, int value)
@@ -164,52 +164,52 @@
 }
 void PageAddCheckInput(char* action, char* label, char* name, char* button)
 {
-    HttpReplyAddText("<form action='");              HttpReplyAddText(action); HttpReplyAddText("' method='get'>\r\n");
-    HttpReplyAddText("<input type='hidden' name='"); HttpReplyAddText(name);   HttpReplyAddText("'>\r\n");
-    HttpReplyAddText(label); HttpReplyAddText("\r\n");
-    HttpReplyAddText("<input type='submit' value='"); HttpReplyAddText(button); HttpReplyAddText("'>\r\n");
-    HttpReplyAddText("</form>\r\n");
+    HttpAddText("<form action='");              HttpAddText(action); HttpAddText("' method='get'>\r\n");
+    HttpAddText("<input type='hidden' name='"); HttpAddText(name);   HttpAddText("'>\r\n");
+    HttpAddText(label); HttpAddText("\r\n");
+    HttpAddText("<input type='submit' value='"); HttpAddText(button); HttpAddText("'>\r\n");
+    HttpAddText("</form>\r\n");
 }
 void PageAddTm(struct tm* ptm)
 {
     char text[30];
     snprintf(text, sizeof(text), "%d-%02d-%02d ", ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday);
-    HttpReplyAddText(text);
+    HttpAddText(text);
     switch(ptm->tm_wday)
     {
-        case  0: HttpReplyAddText("Sun"); break;
-        case  1: HttpReplyAddText("Mon"); break;
-        case  2: HttpReplyAddText("Tue"); break;
-        case  3: HttpReplyAddText("Wed"); break;
-        case  4: HttpReplyAddText("Thu"); break;
-        case  5: HttpReplyAddText("Fri"); break;
-        case  6: HttpReplyAddText("Sat"); break;
-        default: HttpReplyAddText("???"); break;
+        case  0: HttpAddText("Sun"); break;
+        case  1: HttpAddText("Mon"); break;
+        case  2: HttpAddText("Tue"); break;
+        case  3: HttpAddText("Wed"); break;
+        case  4: HttpAddText("Thu"); break;
+        case  5: HttpAddText("Fri"); break;
+        case  6: HttpAddText("Sat"); break;
+        default: HttpAddText("???"); break;
     }
     snprintf(text, sizeof(text), " %02d:%02d:%02d", ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
-    HttpReplyAddText(text);
-    if      (ptm->tm_isdst  > 0) HttpReplyAddText(" BST");
-    else if (ptm->tm_isdst == 0) HttpReplyAddText(" GMT");
-    else                         HttpReplyAddText(" UTC");
+    HttpAddText(text);
+    if      (ptm->tm_isdst  > 0) HttpAddText(" BST");
+    else if (ptm->tm_isdst == 0) HttpAddText(" GMT");
+    else                         HttpAddText(" UTC");
 }
 void PageAddToggle(float labelwidth, char* label, char* id, char* request)
 {
     char text[100];
     
     snprintf(text, sizeof(text), "<div><div style='display: inline-block; width:%.1fem;'>", labelwidth);
-    HttpReplyAddText(text);
-    HttpReplyAddText(label);
-    HttpReplyAddText("</div>\r\n");
+    HttpAddText(text);
+    HttpAddText(label);
+    HttpAddText("</div>\r\n");
     
-    HttpReplyAddText("<div class='toggle' id='");
-    HttpReplyAddText(id);
-    HttpReplyAddText("' dir='ltr' onclick='AjaxRequest(\"");
-    HttpReplyAddText(request);
-    HttpReplyAddText("=1\")'>\r\n");
+    HttpAddText("<div class='toggle' id='");
+    HttpAddText(id);
+    HttpAddText("' dir='ltr' onclick='AjaxRequest(\"");
+    HttpAddText(request);
+    HttpAddText("=1\")'>\r\n");
     
-    HttpReplyAddText("<div class='slot'></div><div class='knob'></div>\r\n");
+    HttpAddText("<div class='slot'></div><div class='knob'></div>\r\n");
     
-    HttpReplyAddText("</div></div>\r\n");
+    HttpAddText("</div></div>\r\n");
 }
 
 
--- a/http-server/query-ajax.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/query-ajax.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "http-request.h"
+#include "http.h"
 #include "radiator.h"
 #include "trace.h"
 
@@ -9,7 +9,7 @@
     {
         char* pName;
         char* pValue;
-        pQuery = HttpRequestSplitQuery(pQuery, &pName, &pValue);
+        pQuery = HttpSplitQuery(pQuery, &pName, &pValue);
                     
         if (strcmp(pName,   "htg-chg-mode"        ) == 0) RadiatorChgMode();
         if (strcmp(pName,   "htg-chg-output"      ) == 0) RadiatorChgOverride();
@@ -26,7 +26,8 @@
         if (strcmp(pName, "trace-chg-ns-recv-sol" ) == 0) TraceChgNsRecvSol();
         if (strcmp(pName, "trace-chg-ns-recv-adv" ) == 0) TraceChgNsRecvAdv();
         if (strcmp(pName, "trace-chg-ns-send-sol" ) == 0) TraceChgNsSendSol();
-        if (strcmp(pName, "trace-chg-nr"          ) == 0) TraceChgNr();
+        if (strcmp(pName, "trace-chg-nr4"         ) == 0) TraceChgNr4();
+        if (strcmp(pName, "trace-chg-nr6"         ) == 0) TraceChgNr6();
         if (strcmp(pName, "trace-chg-ntp-client"  ) == 0) TraceChgNtpClient();
         if (strcmp(pName, "trace-chg-sync"        ) == 0) TraceChgSync();
         if (strcmp(pName, "trace-chg-1-wire"      ) == 0) TraceChgOneWire();
@@ -39,6 +40,9 @@
         if (strcmp(pName, "trace-chg-arp"         ) == 0) TraceChgArp();
         if (strcmp(pName, "trace-chg-ip4"         ) == 0) TraceChgIp4();
         if (strcmp(pName, "trace-chg-ip6"         ) == 0) TraceChgIp6();
+        if (strcmp(pName, "trace-chg-udp"         ) == 0) TraceChgUdp();
+        if (strcmp(pName, "trace-chg-tcp"         ) == 0) TraceChgTcp();
+        if (strcmp(pName, "trace-chg-http"        ) == 0) TraceChgHttp();
     }
 }
 
--- a/http-server/query-boiler.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/query-boiler.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "http-request.h"
+#include "http.h"
 #include "boiler.h"
 
 void QueryBoiler(char* pQuery)
@@ -8,7 +8,7 @@
     {
         char* pName;
         char* pValue;
-        pQuery = HttpRequestSplitQuery(pQuery, &pName, &pValue);
+        pQuery = HttpSplitQuery(pQuery, &pName, &pValue);
 
         int value = 0;
         sscanf(pValue, "%d", &value);
--- a/http-server/query-heating.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/query-heating.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,5 +1,5 @@
-#include "mbed.h"
-#include "http-request.h"
+#include     "mbed.h"
+#include     "http.h"
 #include "radiator.h"
 
 void QueryHeating(char* pQuery)
@@ -8,7 +8,7 @@
     {
         char* pName;
         char* pValue;
-        pQuery = HttpRequestSplitQuery(pQuery, &pName, &pValue);
+        pQuery = HttpSplitQuery(pQuery, &pName, &pValue);
         
         int value = 0;           
         sscanf(pValue, "%d", &value);      
--- a/http-server/query-log.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/query-log.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "http-request.h"
+#include "http.h"
 #include "log.h"
 
 void QueryLog(char* pQuery)
@@ -8,7 +8,7 @@
     {
         char* pName;
         char* pValue;
-        pQuery = HttpRequestSplitQuery(pQuery, &pName, &pValue);                    
+        pQuery = HttpSplitQuery(pQuery, &pName, &pValue);                    
         if (strcmp(pName, "clearlog") == 0) LogInit();
     }
 }
--- a/http-server/query-program.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/query-program.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "http-request.h"
+#include "http.h"
 #include "program.h"
 
 void QueryProgram(char* pQuery)
@@ -8,12 +8,12 @@
     {
         char* pName;
         char* pValue;
-        pQuery = HttpRequestSplitQuery(pQuery, &pName, &pValue);
+        pQuery = HttpSplitQuery(pQuery, &pName, &pValue);
         
         int value = 0;           
         sscanf(pValue, "%d", &value);
         
-        HttpRequestDecodeValue(pValue);
+        HttpDecodeValue(pValue);
                     
         if (strcmp(pName, "program1") == 0) ProgramParse(0, pValue);
         if (strcmp(pName, "program2") == 0) ProgramParse(1, pValue);
--- a/http-server/query-system.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/query-system.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -1,5 +1,5 @@
 #include "mbed.h"
-#include "http-request.h"
+#include "http.h"
 #include "watchdog.h"
 #include "1-wire-device.h"
 #include "boiler.h"
@@ -16,7 +16,7 @@
     {
         char* pName;
         char* pValue;
-        pQuery = HttpRequestSplitQuery(pQuery, &pName, &pValue);
+        pQuery = HttpSplitQuery(pQuery, &pName, &pValue);
 
         int value = 0;
         sscanf(pValue, "%d", &value);
--- a/http-server/script.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/script.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -59,49 +59,57 @@
 "    return value.toFixed(1);\r\n"
 "}\r\n"
 "\r\n"
+"function hexToBit(iChar, iBit)\r\n"
+"{\r\n"
+"   var value = parseInt(response.charAt(iChar), 16);\r\n"
+"   value >>= iBit;\r\n"
+"   return value & 1;\r\n"
+"}\r\n"
 "function display()\r\n"
 "{\r\n"
 "   var elem;\r\n"
 "   elem = document.getElementById('ajax-response-html'     ); if (elem) elem.innerHTML         = response;\r\n"
 "   elem = document.getElementById('ajax-headers-html'      ); if (elem) elem.innerHTML         = headers;\r\n"
-"   elem = document.getElementById('ajax-hall-html'         ); if (elem) elem.innerHTML         = DS18B20ToString( 0);\r\n"                         //RadiatorGetHallRom
-"   elem = document.getElementById('ajax-tank-html'         ); if (elem) elem.innerHTML         = DS18B20ToString( 4);\r\n"                         //BoilerGetTankRom
-"   elem = document.getElementById('ajax-blr-out-html'      ); if (elem) elem.innerHTML         = DS18B20ToString( 8);\r\n"                         //BoilerGetOutputRom
-"   elem = document.getElementById('ajax-blr-rtn-html'      ); if (elem) elem.innerHTML         = DS18B20ToString(12);\r\n"                         //BoilerGetReturnRom
-"   elem = document.getElementById('ajax-prg-call-html'     ); if (elem) elem.innerHTML         = response.charAt(16);\r\n"                         //ProgramTimerOutput
-"   elem = document.getElementById('ajax-mode-html'         ); if (elem) elem.innerHTML         = response.charAt(17);\r\n"                         //RadiatorGetMode
-"   elem = document.getElementById('ajax-mode-toggle'       ); if (elem) elem.setAttribute('dir', response.charAt(17) != '0' ? 'rtl' : 'ltr');\r\n" //RadiatorGetMode
-"   elem = document.getElementById('ajax-override-html'     ); if (elem) elem.innerHTML         = response.charAt(18);\r\n"                         //RadiatorGetOverride
-"   elem = document.getElementById('ajax-radiator-html'     ); if (elem) elem.innerHTML         = response.charAt(19);\r\n"                         //IoRadiatorPump
-"   elem = document.getElementById('ajax-radiator-toggle'   ); if (elem) elem.setAttribute('dir', response.charAt(19) != '0' ? 'rtl' : 'ltr');\r\n" //IoRadiatorPump
-"   elem = document.getElementById('ajax-blr-call-html'     ); if (elem) elem.innerHTML         = response.charAt(20);\r\n"                         //IoBoilerCall
-"   elem = document.getElementById('ajax-blr-pump-html'     ); if (elem) elem.innerHTML         = response.charAt(21);\r\n"                         //IoBoilerPump
-"   elem = document.getElementById('ajax-trace-net-stack'   ); if (elem) elem.setAttribute('dir', response.charAt(22) != '0' ? 'rtl' : 'ltr');\r\n" //DnsNetTraceStack
-"   elem = document.getElementById('ajax-trace-net-newline' ); if (elem) elem.setAttribute('dir', response.charAt(23) != '0' ? 'rtl' : 'ltr');\r\n" //DnsNetTraceNewLine
-"   elem = document.getElementById('ajax-trace-net-verbose' ); if (elem) elem.setAttribute('dir', response.charAt(24) != '0' ? 'rtl' : 'ltr');\r\n" //DnsNetTraceVerbose
-"   elem = document.getElementById('ajax-trace-phy'         ); if (elem) elem.setAttribute('dir', response.charAt(25) != '0' ? 'rtl' : 'ltr');\r\n" //PhyTrace
-"   elem = document.getElementById('ajax-trace-dns-name'    ); if (elem) elem.setAttribute('dir', response.charAt(26) != '0' ? 'rtl' : 'ltr');\r\n" //DnsNameTrace
-"   elem = document.getElementById('ajax-trace-dns-query'   ); if (elem) elem.setAttribute('dir', response.charAt(27) != '0' ? 'rtl' : 'ltr');\r\n" //DnsQueryTrace
-"   elem = document.getElementById('ajax-trace-dns-reply'   ); if (elem) elem.setAttribute('dir', response.charAt(28) != '0' ? 'rtl' : 'ltr');\r\n" //DnsReplyTrace
-"   elem = document.getElementById('ajax-trace-dns-server'  ); if (elem) elem.setAttribute('dir', response.charAt(29) != '0' ? 'rtl' : 'ltr');\r\n" //DnsServerTrace
-"   elem = document.getElementById('ajax-trace-ntp'         ); if (elem) elem.setAttribute('dir', response.charAt(30) != '0' ? 'rtl' : 'ltr');\r\n" //NtpTrace
-"   elem = document.getElementById('ajax-trace-dhcp'        ); if (elem) elem.setAttribute('dir', response.charAt(31) != '0' ? 'rtl' : 'ltr');\r\n" //DhcpTrace
-"   elem = document.getElementById('ajax-trace-ns-recv-sol' ); if (elem) elem.setAttribute('dir', response.charAt(32) != '0' ? 'rtl' : 'ltr');\r\n" //NsTraceRecvSol
-"   elem = document.getElementById('ajax-trace-ns-recv-adv' ); if (elem) elem.setAttribute('dir', response.charAt(33) != '0' ? 'rtl' : 'ltr');\r\n" //NsTraceRecvAdv
-"   elem = document.getElementById('ajax-trace-ns-send-sol' ); if (elem) elem.setAttribute('dir', response.charAt(34) != '0' ? 'rtl' : 'ltr');\r\n" //NsTraceSendSol
-"   elem = document.getElementById('ajax-trace-nr'          ); if (elem) elem.setAttribute('dir', response.charAt(35) != '0' ? 'rtl' : 'ltr');\r\n" //NrTrace
-"   elem = document.getElementById('ajax-trace-ntp-client'  ); if (elem) elem.setAttribute('dir', response.charAt(36) != '0' ? 'rtl' : 'ltr');\r\n" //NtpClientTrace
-"   elem = document.getElementById('ajax-trace-sync'        ); if (elem) elem.setAttribute('dir', response.charAt(37) != '0' ? 'rtl' : 'ltr');\r\n" //SyncTrace
-"   elem = document.getElementById('ajax-trace-1-wire'      ); if (elem) elem.setAttribute('dir', response.charAt(38) != '0' ? 'rtl' : 'ltr');\r\n" //OneWireTrace
-"   elem = document.getElementById('ajax-trace-echo4'       ); if (elem) elem.setAttribute('dir', response.charAt(39) != '0' ? 'rtl' : 'ltr');\r\n" //Echo4Trace
-"   elem = document.getElementById('ajax-trace-echo6'       ); if (elem) elem.setAttribute('dir', response.charAt(40) != '0' ? 'rtl' : 'ltr');\r\n" //Echo6Trace
-"   elem = document.getElementById('ajax-trace-ra'          ); if (elem) elem.setAttribute('dir', response.charAt(41) != '0' ? 'rtl' : 'ltr');\r\n" //RaTrace
-"   elem = document.getElementById('ajax-trace-rs'          ); if (elem) elem.setAttribute('dir', response.charAt(42) != '0' ? 'rtl' : 'ltr');\r\n" //RsTrace
-"   elem = document.getElementById('ajax-trace-ar4'         ); if (elem) elem.setAttribute('dir', response.charAt(43) != '0' ? 'rtl' : 'ltr');\r\n" //Ar4Trace
-"   elem = document.getElementById('ajax-trace-ar6'         ); if (elem) elem.setAttribute('dir', response.charAt(44) != '0' ? 'rtl' : 'ltr');\r\n" //Ar6Trace
-"   elem = document.getElementById('ajax-trace-arp'         ); if (elem) elem.setAttribute('dir', response.charAt(45) != '0' ? 'rtl' : 'ltr');\r\n" //ArpTrace
-"   elem = document.getElementById('ajax-trace-ip4'         ); if (elem) elem.setAttribute('dir', response.charAt(46) != '0' ? 'rtl' : 'ltr');\r\n" //Ip4Trace
-"   elem = document.getElementById('ajax-trace-ip6'         ); if (elem) elem.setAttribute('dir', response.charAt(47) != '0' ? 'rtl' : 'ltr');\r\n" //Ip6Trace
+"   elem = document.getElementById('ajax-hall-html'         ); if (elem) elem.innerHTML         = DS18B20ToString( 0);\r\n"              //RadiatorGetHallRom
+"   elem = document.getElementById('ajax-tank-html'         ); if (elem) elem.innerHTML         = DS18B20ToString( 4);\r\n"              //BoilerGetTankRom
+"   elem = document.getElementById('ajax-blr-out-html'      ); if (elem) elem.innerHTML         = DS18B20ToString( 8);\r\n"              //BoilerGetOutputRom
+"   elem = document.getElementById('ajax-blr-rtn-html'      ); if (elem) elem.innerHTML         = DS18B20ToString(12);\r\n"              //BoilerGetReturnRom
+""                                                                                                                                       //ProgramTimerOutput
+"   elem = document.getElementById('ajax-mode-toggle'       ); if (elem) elem.setAttribute('dir', hexToBit(16, 1) ? 'rtl' : 'ltr');\r\n" //RadiatorGetMode
+""                                                                                                                                       //RadiatorGetOverride
+"   elem = document.getElementById('ajax-radiator-toggle'   ); if (elem) elem.setAttribute('dir', hexToBit(16, 3) ? 'rtl' : 'ltr');\r\n" //IoRadiatorPump
+""                                                                                                                                       //IoBoilerCall
+""                                                                                                                                       //IoBoilerPump
+"   elem = document.getElementById('ajax-trace-net-stack'   ); if (elem) elem.setAttribute('dir', hexToBit(17, 2) ? 'rtl' : 'ltr');\r\n" //DnsNetTraceStack
+"   elem = document.getElementById('ajax-trace-net-newline' ); if (elem) elem.setAttribute('dir', hexToBit(17, 3) ? 'rtl' : 'ltr');\r\n" //DnsNetTraceNewLine
+"   elem = document.getElementById('ajax-trace-net-verbose' ); if (elem) elem.setAttribute('dir', hexToBit(18, 0) ? 'rtl' : 'ltr');\r\n" //DnsNetTraceVerbose
+"   elem = document.getElementById('ajax-trace-phy'         ); if (elem) elem.setAttribute('dir', hexToBit(18, 1) ? 'rtl' : 'ltr');\r\n" //PhyTrace
+"   elem = document.getElementById('ajax-trace-dns-name'    ); if (elem) elem.setAttribute('dir', hexToBit(18, 2) ? 'rtl' : 'ltr');\r\n" //DnsNameTrace
+"   elem = document.getElementById('ajax-trace-dns-query'   ); if (elem) elem.setAttribute('dir', hexToBit(18, 3) ? 'rtl' : 'ltr');\r\n" //DnsQueryTrace
+"   elem = document.getElementById('ajax-trace-dns-reply'   ); if (elem) elem.setAttribute('dir', hexToBit(19, 0) ? 'rtl' : 'ltr');\r\n" //DnsReplyTrace
+"   elem = document.getElementById('ajax-trace-dns-server'  ); if (elem) elem.setAttribute('dir', hexToBit(19, 1) ? 'rtl' : 'ltr');\r\n" //DnsServerTrace
+"   elem = document.getElementById('ajax-trace-ntp'         ); if (elem) elem.setAttribute('dir', hexToBit(19, 2) ? 'rtl' : 'ltr');\r\n" //NtpTrace
+"   elem = document.getElementById('ajax-trace-dhcp'        ); if (elem) elem.setAttribute('dir', hexToBit(19, 3) ? 'rtl' : 'ltr');\r\n" //DhcpTrace
+"   elem = document.getElementById('ajax-trace-ns-recv-sol' ); if (elem) elem.setAttribute('dir', hexToBit(20, 0) ? 'rtl' : 'ltr');\r\n" //NsTraceRecvSol
+"   elem = document.getElementById('ajax-trace-ns-recv-adv' ); if (elem) elem.setAttribute('dir', hexToBit(20, 1) ? 'rtl' : 'ltr');\r\n" //NsTraceRecvAdv
+"   elem = document.getElementById('ajax-trace-ns-send-sol' ); if (elem) elem.setAttribute('dir', hexToBit(20, 2) ? 'rtl' : 'ltr');\r\n" //NsTraceSendSol
+"   elem = document.getElementById('ajax-trace-nr4'         ); if (elem) elem.setAttribute('dir', hexToBit(20, 3) ? 'rtl' : 'ltr');\r\n" //Nr4Trace
+"   elem = document.getElementById('ajax-trace-nr6'         ); if (elem) elem.setAttribute('dir', hexToBit(21, 0) ? 'rtl' : 'ltr');\r\n" //Nr6Trace
+"   elem = document.getElementById('ajax-trace-ntp-client'  ); if (elem) elem.setAttribute('dir', hexToBit(21, 1) ? 'rtl' : 'ltr');\r\n" //NtpClientTrace
+"   elem = document.getElementById('ajax-trace-sync'        ); if (elem) elem.setAttribute('dir', hexToBit(21, 2) ? 'rtl' : 'ltr');\r\n" //SyncTrace
+"   elem = document.getElementById('ajax-trace-1-wire'      ); if (elem) elem.setAttribute('dir', hexToBit(21, 3) ? 'rtl' : 'ltr');\r\n" //OneWireTrace
+"   elem = document.getElementById('ajax-trace-echo4'       ); if (elem) elem.setAttribute('dir', hexToBit(22, 0) ? 'rtl' : 'ltr');\r\n" //Echo4Trace
+"   elem = document.getElementById('ajax-trace-echo6'       ); if (elem) elem.setAttribute('dir', hexToBit(22, 1) ? 'rtl' : 'ltr');\r\n" //Echo6Trace
+"   elem = document.getElementById('ajax-trace-ra'          ); if (elem) elem.setAttribute('dir', hexToBit(22, 2) ? 'rtl' : 'ltr');\r\n" //RaTrace
+"   elem = document.getElementById('ajax-trace-rs'          ); if (elem) elem.setAttribute('dir', hexToBit(22, 3) ? 'rtl' : 'ltr');\r\n" //RsTrace
+"   elem = document.getElementById('ajax-trace-ar4'         ); if (elem) elem.setAttribute('dir', hexToBit(23, 0) ? 'rtl' : 'ltr');\r\n" //Ar4Trace
+"   elem = document.getElementById('ajax-trace-ar6'         ); if (elem) elem.setAttribute('dir', hexToBit(23, 1) ? 'rtl' : 'ltr');\r\n" //Ar6Trace
+"   elem = document.getElementById('ajax-trace-arp'         ); if (elem) elem.setAttribute('dir', hexToBit(23, 2) ? 'rtl' : 'ltr');\r\n" //ArpTrace
+"   elem = document.getElementById('ajax-trace-ip4'         ); if (elem) elem.setAttribute('dir', hexToBit(23, 3) ? 'rtl' : 'ltr');\r\n" //Ip4Trace
+"   elem = document.getElementById('ajax-trace-ip6'         ); if (elem) elem.setAttribute('dir', hexToBit(24, 0) ? 'rtl' : 'ltr');\r\n" //Ip6Trace
+"   elem = document.getElementById('ajax-trace-udp'         ); if (elem) elem.setAttribute('dir', hexToBit(24, 1) ? 'rtl' : 'ltr');\r\n" //UdpTrace
+"   elem = document.getElementById('ajax-trace-tcp'         ); if (elem) elem.setAttribute('dir', hexToBit(24, 2) ? 'rtl' : 'ltr');\r\n" //TcpTrace
+"   elem = document.getElementById('ajax-trace-http'        ); if (elem) elem.setAttribute('dir', hexToBit(24, 3) ? 'rtl' : 'ltr');\r\n" //HttpTrace
 "   elem = document.getElementById('ajax-date-html');\r\n"
 "   if (elem)\r\n"
 "   {\r\n"
--- a/http-server/server-http.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/http-server/server-http.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -5,8 +5,6 @@
 #include  "css-settings.h"
 #include   "script.h"
 #include "http.h"
-#include "http-request.h"
-#include "http-reply.h"
 #include "io.h"
 #include "query.h"
 
--- a/main/main.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/main/main.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -14,13 +14,13 @@
 #include         "trace.h"
 
 int MainLastProgramPosition;
-static volatile int position = 0;
+volatile int MainThisProgramPosition = 0;
 static int iPosition = 0;
 
 static void saveProgramPositionAndReset()
 {
     if (iPosition <= 0) return; //Don't overwrite the fram
-    int32_t posn = position;
+    int32_t posn = MainThisProgramPosition;
     FramWrite(iPosition, 4, &posn);
     NVIC_SystemReset();
 }
@@ -53,15 +53,15 @@
     while (1)
     {        
         //Scan each module
-        position =  1; r =  WatchdogMain(); if (r) break;
-        position =  2; r =        IoMain(); if (r) break;
-        position =  3; r =       NetMain(); if (r) break;
-        position =  4; r =     ClockMain(); if (r) break;
-        position =  5; r = NtpClientMain(); if (r) break;
-        position =  6; r =   OneWireMain(); if (r) break;
-        position =  7; r =    DeviceMain(); if (r) break;
-        position =  8; r =   HeatingMain(); if (r) break;
-        position = 12; 
+        MainThisProgramPosition =  1; r =  WatchdogMain(); if (r) break;
+        MainThisProgramPosition =  2; r =        IoMain(); if (r) break;
+        MainThisProgramPosition =  3; r =       NetMain(); if (r) break;
+        MainThisProgramPosition =  4; r =     ClockMain(); if (r) break;
+        MainThisProgramPosition =  5; r = NtpClientMain(); if (r) break;
+        MainThisProgramPosition =  6; r =   OneWireMain(); if (r) break;
+        MainThisProgramPosition =  7; r =    DeviceMain(); if (r) break;
+        MainThisProgramPosition =  8; r =   HeatingMain(); if (r) break;
+        MainThisProgramPosition = 12; 
         
     }
     
--- a/main/main.h	Tue Oct 31 21:26:22 2017 +0000
+++ b/main/main.h	Tue Nov 14 17:50:25 2017 +0000
@@ -1,1 +1,2 @@
+extern volatile int MainThisProgramPosition;
 extern int MainLastProgramPosition;
\ No newline at end of file
--- a/main/trace.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/main/trace.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -9,7 +9,8 @@
 #include        "ntp.h"
 #include       "dhcp.h"
 #include         "ns.h"
-#include         "nr.h"
+#include        "nr4.h"
+#include        "nr6.h"
 #include "ntp-client.h"
 #include       "sync.h"
 #include     "1-wire.h"
@@ -22,6 +23,9 @@
 #include        "arp.h"
 #include        "ip4.h"
 #include        "ip6.h"
+#include        "udp.h"
+#include        "tcp.h"
+#include       "http.h"
 
 static int iNetStack;
 static int iNetNewLine;
@@ -36,7 +40,8 @@
 static int iNsRecvSol;
 static int iNsRecvAdv;
 static int iNsSendSol;
-static int iNr;
+static int iNr4;
+static int iNr6;
 static int iNtpClient;
 static int iSync;
 static int iOneWire;
@@ -49,6 +54,9 @@
 static int iArp;
 static int iIp4;
 static int iIp6;
+static int iUdp;
+static int iTcp;
+static int iHttp;
 
 void TraceChgNetStack  () {       NetTraceStack   =       !NetTraceStack;   FramWrite(iNetStack,    1,       &NetTraceStack ); }
 void TraceChgNetNewLine() {       NetTraceNewLine =       !NetTraceNewLine; FramWrite(iNetNewLine, 1,       &NetTraceNewLine); }
@@ -63,7 +71,8 @@
 void TraceChgNsRecvSol () {        NsTraceRecvSol =        !NsTraceRecvSol; FramWrite(iNsRecvSol,  1,        &NsTraceRecvSol); }
 void TraceChgNsRecvAdv () {        NsTraceRecvAdv =        !NsTraceRecvAdv; FramWrite(iNsRecvAdv,  1,        &NsTraceRecvAdv); }
 void TraceChgNsSendSol () {        NsTraceSendSol =        !NsTraceSendSol; FramWrite(iNsSendSol,  1,        &NsTraceSendSol); }
-void TraceChgNr        () {        NrTrace        =        !NrTrace       ; FramWrite(iNr,         1,        &NrTrace       ); }
+void TraceChgNr4       () {       Nr4Trace        =       !Nr4Trace       ; FramWrite(iNr4,        1,       &Nr4Trace       ); }
+void TraceChgNr6       () {       Nr6Trace        =       !Nr6Trace       ; FramWrite(iNr6,        1,       &Nr6Trace       ); }
 void TraceChgNtpClient () { NtpClientTrace        = !NtpClientTrace       ; FramWrite(iNtpClient,  1, &NtpClientTrace       ); }
 void TraceChgSync      () {      SyncTrace        =      !SyncTrace       ; FramWrite(iSync,       1,      &SyncTrace       ); }
 void TraceChgOneWire   () {   OneWireTrace        =   !OneWireTrace       ; FramWrite(iOneWire,    1,   &OneWireTrace       ); }
@@ -76,6 +85,9 @@
 void TraceChgArp       () {       ArpTrace        =       !ArpTrace       ; FramWrite(iArp,        1,       &ArpTrace       ); }
 void TraceChgIp4       () {       Ip4Trace        =       !Ip4Trace       ; FramWrite(iIp4,        1,       &Ip4Trace       ); }
 void TraceChgIp6       () {       Ip6Trace        =       !Ip6Trace       ; FramWrite(iIp6,        1,       &Ip6Trace       ); }
+void TraceChgUdp       () {       UdpTrace        =       !UdpTrace       ; FramWrite(iUdp,        1,       &UdpTrace       ); }
+void TraceChgTcp       () {       TcpTrace        =       !TcpTrace       ; FramWrite(iTcp,        1,       &TcpTrace       ); }
+void TraceChgHttp      () {      HttpTrace        =      !HttpTrace       ; FramWrite(iHttp,       1,      &HttpTrace       ); }
 
 int TraceInit()
 {
@@ -94,7 +106,8 @@
     address = FramLoad( 1,        &NsTraceRecvSol, NULL); if (address < 0) return -1; iNsRecvSol  = address;
     address = FramLoad( 1,        &NsTraceRecvAdv, NULL); if (address < 0) return -1; iNsRecvAdv  = address;
     address = FramLoad( 1,        &NsTraceSendSol, NULL); if (address < 0) return -1; iNsSendSol  = address;
-    address = FramLoad( 1,        &NrTrace       , NULL); if (address < 0) return -1; iNr         = address;
+    address = FramLoad( 1,       &Nr4Trace       , NULL); if (address < 0) return -1; iNr4        = address;
+    address = FramLoad( 1,       &Nr6Trace       , NULL); if (address < 0) return -1; iNr6        = address;
     address = FramLoad( 1, &NtpClientTrace       , NULL); if (address < 0) return -1; iNtpClient  = address;
     address = FramLoad( 1,      &SyncTrace       , NULL); if (address < 0) return -1; iSync       = address;
     address = FramLoad( 1,   &OneWireTrace       , NULL); if (address < 0) return -1; iOneWire    = address;
@@ -107,6 +120,9 @@
     address = FramLoad( 1,       &ArpTrace       , NULL); if (address < 0) return -1; iArp        = address;
     address = FramLoad( 1,       &Ip4Trace       , NULL); if (address < 0) return -1; iIp4        = address;
     address = FramLoad( 1,       &Ip6Trace       , NULL); if (address < 0) return -1; iIp6        = address;
+    address = FramLoad( 1,       &UdpTrace       , NULL); if (address < 0) return -1; iUdp        = address;
+    address = FramLoad( 1,       &TcpTrace       , NULL); if (address < 0) return -1; iTcp        = address;
+    address = FramLoad( 1,      &HttpTrace       , NULL); if (address < 0) return -1; iHttp       = address;
     
     return 0;
 }
--- a/main/trace.h	Tue Oct 31 21:26:22 2017 +0000
+++ b/main/trace.h	Tue Nov 14 17:50:25 2017 +0000
@@ -13,7 +13,8 @@
 extern void TraceChgNsRecvSol ();
 extern void TraceChgNsRecvAdv ();
 extern void TraceChgNsSendSol ();
-extern void TraceChgNr        ();
+extern void TraceChgNr4       ();
+extern void TraceChgNr6       ();
 extern void TraceChgNtpClient ();
 extern void TraceChgSync      ();
 extern void TraceChgOneWire   ();
@@ -25,4 +26,7 @@
 extern void TraceChgAr6       ();
 extern void TraceChgArp       ();
 extern void TraceChgIp4       ();
-extern void TraceChgIp6       ();
\ No newline at end of file
+extern void TraceChgIp6       ();
+extern void TraceChgUdp       ();
+extern void TraceChgTcp       ();
+extern void TraceChgHttp      ();
\ No newline at end of file
--- a/mbed.bld	Tue Oct 31 21:26:22 2017 +0000
+++ b/mbed.bld	Tue Nov 14 17:50:25 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/fb8e0ae1cceb
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file
--- a/net.lib	Tue Oct 31 21:26:22 2017 +0000
+++ b/net.lib	Tue Nov 14 17:50:25 2017 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/andrewboyson/code/net/#952dddb74b8b
+http://developer.mbed.org/users/andrewboyson/code/net/#35117a8b5c65
--- a/ntp-client/ntp-client.cpp	Tue Oct 31 21:26:22 2017 +0000
+++ b/ntp-client/ntp-client.cpp	Tue Nov 14 17:50:25 2017 +0000
@@ -92,7 +92,7 @@
     int64_t limit        = NtpClientGetMaxDelayMs();
     if (delayMs > limit)
     {
-        LogTimeF("NtpClient error: delay %ll ms is greater than limit %ll ms\r\n", delayMs, limit);
+        LogTimeF("NtpClient error: delay %lld ms is greater than limit %lld ms\r\n", delayMs, limit);
         return; 
     }