Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Revision:
110:8ab752842d25
Parent:
103:91194cc19bbb
Child:
142:b472ba95b018
diff -r 3e82f62c7e1f -r 8ab752842d25 base/net/web-net6-ajax.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/net/web-net6-ajax.c	Tue Apr 30 12:45:08 2019 +0000
@@ -0,0 +1,38 @@
+#include   <stdio.h>
+
+#include "http.h"
+#include "ndp.h"
+#include "slaac.h"
+#include "ar6.h"
+#include "nr6.h"
+
+void WebNet6Ajax()
+{
+    HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL);
+    
+    char nibble;
+    nibble = 0;
+    if (NdpManagedConfiguration) nibble |= 1; //4
+    if (NdpOtherConfiguration  ) nibble |= 2; //4
+    if (NdpPrefixFlagL         ) nibble |= 4; //4
+    if (NdpPrefixFlagA         ) nibble |= 8; //4
+    HttpAddNibbleAsHex(nibble);                                                            HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpHopLimit);                                                        HttpAddChar('\n');
+    for (char* p = NdpRouterMac; p < NdpRouterMac + 6; p++) HttpAddByteAsHex(*p);          HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpPrefixLength);                                                    HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpPrefixValidLifetime);                                             HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpPrefixPreferredLifetime);                                         HttpAddChar('\n');
+    for (char* p = NdpPrefix; p < NdpPrefix + 16; p++) HttpAddByteAsHex(*p);               HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpDnsLifetime);                                                     HttpAddChar('\n');
+    for (char* p = NdpDnsServer; p < NdpDnsServer + 16; p++) HttpAddByteAsHex(*p);         HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpGetLease());                                                      HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpGetElapsedLife());                                                HttpAddChar('\n');
+    for (char* p = SlaacLinkLocalIp; p < SlaacLinkLocalIp + 16; p++) HttpAddByteAsHex(*p); HttpAddChar('\n');
+    HttpAddInt32AsHex(NdpMtu);                                                             HttpAddChar('\n');
+    HttpAddChar('\f');
+    
+    Ar6SendAjax();
+    HttpAddChar('\f');
+    
+    Nr6SendAjax();
+}