Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Tue Jan 19 19:00:18 2021 +0000
Parent:
187:122fc1996c86
Child:
189:e1c7990486c4
Commit message:
Net NR added eth and dns protocols to the received messages.

Changed in this revision

resolve/nr.c Show annotated file Show diff for this revision Revisions of this file
--- a/resolve/nr.c	Mon Jan 18 18:23:46 2021 +0000
+++ b/resolve/nr.c	Tue Jan 19 19:00:18 2021 +0000
@@ -209,7 +209,7 @@
         }
         if (NrTrace)
         {
-            LogTimeF("NR - renew name of ");
+            LogTimeF("NR -- record %d - renew name of ", i);
             addrLog(addrType, address);
             Log("\r\n");
         }
@@ -220,13 +220,13 @@
     else
     {
         //If a record does not exist then find the first empty slot and add the IP and date
+        i = getOldest();
         if (NrTrace)
         {
-            LogTimeF("NR - request name of ");
+            LogTimeF("NR -- record %d - request name of ", i);
             addrLog(addrType, address);
             Log("\r\n");
         }
-        i = getOldest();
         addrCopy(addrType, records[i].address, address);  //Set the address
         records[i].name[0]  = 0;                          //Clear the name
         records[i].ageMs    = MsTimerCount;               //Start age
@@ -259,8 +259,8 @@
         }
         if (NrTrace)
         {
-            if (addrType == ADDR_TYPE_A) LogTimeF("NR - renew A of %s\r\n", name);
-            else                         LogTimeF("NR - renew AAAA of %s\r\n", name);
+            if (addrType == ADDR_TYPE_A) LogTimeF("NR -- record %d - renew A of %s\r\n", i, name);
+            else                         LogTimeF("NR -- record %d - renew AAAA of %s\r\n", i, name);
         }
         //Leave name as is
         //Leave the address as is
@@ -269,12 +269,12 @@
     else
     {   
         //If a record does not exist then find the first empty slot and add the name and date
+        i = getOldest();
         if (NrTrace)
         {
-            if (addrType == ADDR_TYPE_A) LogTimeF("NR - request A of %s\r\n", name);
-            else                         LogTimeF("NR - request AAAA of %s\r\n", name);
+            if (addrType == ADDR_TYPE_A) LogTimeF("NR -- record %d - request A of %s\r\n", i, name);
+            else                         LogTimeF("NR -- record %d - request AAAA of %s\r\n", i, name);
         }
-        i = getOldest();
         strncpy(records[i].name, name, NR_NAME_MAX_LENGTH); //Set the name
         records[i].name[NR_NAME_MAX_LENGTH - 1] = 0;
         addrClear(addrType, records[i].address);            //Clear the address
@@ -307,6 +307,10 @@
     if (NrTrace)
     {
         LogTimeF("NR - received ");
+        EthProtocolLog(ipProtocol);
+        Log(" ");
+        DnsProtocolLog(dnsProtocol);
+        Log(" ");
         addrLog(addrType, address);
         Log(" == '");
         Log(name);
@@ -451,12 +455,12 @@
 {
     if (addrIsEmpty(pr->addrType, pr->address))
     {
-        LogTime("NR -- queryNameFromIp has no address\r\n");
+        LogTimeF("NR -- record %d - queryNameFromIp has no address\r\n", pr - records);
         return;
     }
     if (NrTrace)
     {
-        LogTime("NR -- send ");
+        LogTimeF("NR -- record %d - send ", pr - records);
         EthProtocolLog(pr->ipProtocol);
         Log(" ");
         DnsProtocolLog(pr->dnsProtocol);
@@ -478,7 +482,7 @@
 {
     if (NrTrace)
     {
-        LogTime("NR -- send ");
+        LogTimeF("NR -- record %d - send ", pr - records);
         EthProtocolLog(pr->ipProtocol);
         Log(" ");
         DnsProtocolLog(pr->dnsProtocol);