Common stuff for all my devices' web server pages: css, login, log, ipv4, ipv6, firmware update, clock, reset info etc.

Dependents:   oldheating gps motorhome heating

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers web-net6-ajax.c Source File

web-net6-ajax.c

00001 #include   <stdio.h>
00002 
00003 #include "http.h"
00004 #include "ndp.h"
00005 #include "slaac.h"
00006 #include "ar6.h"
00007 #include  "nr.h"
00008 
00009 void WebNet6Ajax()
00010 {
00011     HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL);
00012     
00013     char nibble;
00014     
00015     //Slaac address
00016     for (char* p = SlaacLinkLocalIp; p < SlaacLinkLocalIp + 16; p++) HttpAddByteAsHex(*p);         HttpAddChar('\n');
00017     
00018     //NDP
00019     HttpAddInt32AsHex(NdpHopLimit);                                                                HttpAddChar('\n');
00020     HttpAddInt32AsHex(NdpMtu);                                                                     HttpAddChar('\n');
00021     nibble = 0;
00022     if (NdpManagedConfiguration  ) nibble |= 1; //4
00023     if (NdpOtherConfiguration    ) nibble |= 2; //4
00024     HttpAddNibbleAsHex(nibble);                                                                    HttpAddChar('\n');
00025     for (char* p = NdpRouterMac; p < NdpRouterMac + 6; p++) HttpAddByteAsHex(*p);                  HttpAddChar('\n');
00026     HttpAddInt32AsHex(NdpGetLease());                                                              HttpAddChar('\n');
00027     HttpAddInt32AsHex(NdpGetElapsedLife());                                                        HttpAddChar('\n');
00028     
00029     //DNS address
00030     for (char* p = NdpDnsServer; p < NdpDnsServer + 16; p++) HttpAddByteAsHex(*p);                 HttpAddChar('\n');
00031     HttpAddInt32AsHex(NdpDnsLifetime);                                                             HttpAddChar('\n');
00032     
00033     //Unique local prefix
00034     nibble = 0;
00035     if (NdpUniqueLocalPrefixFlagL) nibble |= 1; //4
00036     if (NdpUniqueLocalPrefixFlagA) nibble |= 2; //4
00037     HttpAddNibbleAsHex(nibble);                                                                    HttpAddChar('\n');
00038     HttpAddInt32AsHex(NdpUniqueLocalPrefixLength);                                                 HttpAddChar('\n');
00039     for (char* p = NdpUniqueLocalPrefix; p < NdpUniqueLocalPrefix + 16; p++) HttpAddByteAsHex(*p); HttpAddChar('\n');
00040     HttpAddInt32AsHex(NdpUniqueLocalPrefixValidLifetime);                                          HttpAddChar('\n');
00041     HttpAddInt32AsHex(NdpUniqueLocalPrefixPreferredLifetime);                                      HttpAddChar('\n');
00042     
00043     //Global prefix
00044     nibble = 0;
00045     if (NdpGlobalPrefixFlagL     ) nibble |= 1; //4
00046     if (NdpGlobalPrefixFlagA     ) nibble |= 2; //4
00047     HttpAddNibbleAsHex(nibble);                                                                    HttpAddChar('\n');
00048     HttpAddInt32AsHex(NdpGlobalPrefixLength);                                                      HttpAddChar('\n');
00049     for (char* p = NdpGlobalPrefix; p < NdpGlobalPrefix + 16; p++) HttpAddByteAsHex(*p);           HttpAddChar('\n');
00050     HttpAddInt32AsHex(NdpGlobalPrefixValidLifetime);                                               HttpAddChar('\n');
00051     HttpAddInt32AsHex(NdpGlobalPrefixPreferredLifetime);                                           HttpAddChar('\n');
00052     
00053     
00054     HttpAddChar('\f');
00055     
00056     Ar6SendAjax();
00057 }