Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

base/net/web-net6-ajax.c

Committer:
andrewboyson
Date:
2020-03-11
Revision:
133:98c6bf14bc37
Parent:
110:8ab752842d25
Child:
142:b472ba95b018

File content as of revision 133:98c6bf14bc37:

#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();
}