Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

net/web-net6-ajax.c

Committer:
andrewboyson
Date:
2019-04-27
Revision:
103:91194cc19bbb
Parent:
net/http-net6-ajax.c@ 89:615fb951df69

File content as of revision 103:91194cc19bbb:

#include   <stdio.h>

#include "http.h"
#include "web-base.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();
}