PUD: remove debug code
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 15 Mar 2012 10:28:30 +0000 (11:28 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 15 Mar 2012 10:31:16 +0000 (11:31 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/Makefile
lib/pud/src/dedup.c
lib/pud/src/dump.c [deleted file]
lib/pud/src/dump.h [deleted file]
lib/pud/src/posAvg.c
lib/pud/src/pud.c
lib/pud/src/receiver.c

index b2defe9..857dcca 100644 (file)
@@ -10,19 +10,6 @@ TOPDIR = ../..
 include $(TOPDIR)/Makefile.inc
 
 
-#CFLAGS += -DPUD_DUMP_GPS_PACKETS_RX_NON_OLSR
-#CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_OLSR
-#CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_UPLINK
-#CFLAGS += -DPUD_DUMP_GPS_PACKETS_RX_DOWNLINK
-#CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_DOWNLINK
-
-#CFLAGS += -DPUD_DUMP_GPS_PACKETS_RX_OLSR
-#CFLAGS += -DPUD_DUMP_GPS_PACKETS_TX_NON_OLSR
-
-#CFLAGS += -DPUD_DUMP_AVERAGING
-#CFLAGS += -DPUD_DUMP_DEDUP
-
-
 CFLAGS += -Werror -D_GNU_SOURCE
 
 
index 1eb0d40..05cc852 100644 (file)
@@ -8,10 +8,6 @@
 /* System includes */
 #include <assert.h>
 
-#ifdef PUD_DUMP_DEDUP
-#include <arpa/inet.h>
-#endif
-
 /* Defines */
 
 #define LISTSIZE(x)                    ((x)->entriesMaxCount) /* always valid */
@@ -114,12 +110,6 @@ void addToDeDup(DeDupList * deDupList, union olsr_message *olsrMessage) {
        incomingIndex = INCOMINGINDEX(deDupList);
        newEntry = &deDupList->entries[incomingIndex];
 
-#ifdef PUD_DUMP_DEDUP
-       olsr_printf(0, "addToDeDup: entriesCount=%llu, newestEntryIndex=%llu,"
-                       " incomingIndex=%llu (before)\n", deDupList->entriesCount,
-                       deDupList->newestEntryIndex, INCOMINGINDEX(deDupList));
-#endif
-
        memset(newEntry, 0, sizeof(DeDupEntry));
        if (olsr_cnf->ip_version == AF_INET) {
                newEntry->seqno = olsrMessage->v4.seqno;
@@ -134,19 +124,6 @@ void addToDeDup(DeDupList * deDupList, union olsr_message *olsrMessage) {
                deDupList ->entriesCount++;
        }
 
-#ifdef PUD_DUMP_DEDUP
-       {
-               char addr[64];
-               olsr_printf(0, "addToDeDup: added seqno %u from %s\n", newEntry->seqno,
-                               inet_ntop(olsr_cnf->ip_version,
-                                               &newEntry->originator,
-                                               &addr[0],sizeof(addr)));
-               olsr_printf(0, "addToDeDup: entriesCount=%llu, newestEntryIndex=%llu,"
-                               " incomingIndex=%llu (after)\n\n", deDupList->entriesCount,
-                               deDupList->newestEntryIndex, INCOMINGINDEX(deDupList));
-       }
-#endif
-
        (void) pthread_mutex_unlock(&deDupList->mutex);
 }
 
@@ -173,41 +150,12 @@ bool isInDeDupList(DeDupList * deDupList, union olsr_message *olsrMessage) {
        iteratedIndex = NEWESTINDEX(deDupList);
        count = deDupList->entriesCount;
 
-#ifdef PUD_DUMP_DEDUP
-       olsr_printf(0, "isInDeDupList: count=%llu, iteratedIndex=%llu"
-                       " maxCount=%llu (iteration start)\n", count, iteratedIndex,
-                       deDupList->entriesMaxCount);
-#endif
-
        /* we iterate from newest until oldest: we have a higher probability to
         * match on the newest entries */
 
        while (count > 0) {
                DeDupEntry * iteratedEntry = &deDupList->entries[iteratedIndex];
-
-#ifdef PUD_DUMP_DEDUP
-               olsr_printf(0, "isInDeDupList: count=%llu, iteratedIndex=%llu"
-                               " (iteration)\n", count, iteratedIndex);
-#endif
-
                if (olsr_cnf->ip_version == AF_INET) {
-#ifdef PUD_DUMP_DEDUP
-                       {
-                               char iteratedAddr[64];
-                               char olsrMessageAddr[64];
-
-                               olsr_printf(0, "isInDeDupList: iterated.seqno %u ==?"
-                                               " olsrMessage.seqno %u\n", iteratedEntry->seqno,
-                                               olsrMessage->v4.seqno);
-                               olsr_printf(0, "isInDeDupList: iterated.addr %s ==?"
-                                               " olsrMessage.addr %s\n", inet_ntop(olsr_cnf->ip_version,
-                                                               &iteratedEntry->originator.v4,
-                                                               &iteratedAddr[0],sizeof(iteratedAddr)),
-                                                               inet_ntop(olsr_cnf->ip_version,
-                                                               &olsrMessage->v4.originator,
-                                                               &olsrMessageAddr[0],sizeof(olsrMessageAddr)));
-                       }
-#endif
                        if ((iteratedEntry->seqno == olsrMessage->v4.seqno) && (memcmp(
                                        &iteratedEntry->originator.v4, &olsrMessage->v4.originator,
                                        sizeof(iteratedEntry->originator.v4))) == 0) {
@@ -215,23 +163,6 @@ bool isInDeDupList(DeDupList * deDupList, union olsr_message *olsrMessage) {
                                break;
                        }
                } else {
-#ifdef PUD_DUMP_DEDUP
-                       {
-                               char iteratedAddr[64];
-                               char olsrMessageAddr[64];
-
-                               olsr_printf(0, "isInDeDupList: iterated.seqno %u ==?"
-                                               " olsrMessage.seqno %u\n", iteratedEntry->seqno,
-                                               olsrMessage->v6.seqno);
-                               olsr_printf(0, "isInDeDupList: iterated.addr %s ==?"
-                                               " olsrMessage.addr %s\n", inet_ntop(olsr_cnf->ip_version,
-                                                               &iteratedEntry->originator.v6,
-                                                               &iteratedAddr[0],sizeof(iteratedAddr)),
-                                                               inet_ntop(olsr_cnf->ip_version,
-                                                               &olsrMessage->v6.originator,
-                                                               &olsrMessageAddr[0],sizeof(olsrMessageAddr)));
-                       }
-#endif
                        if ((iteratedEntry->seqno == olsrMessage->v6.seqno) && (memcmp(
                                        &iteratedEntry->originator.v6, &olsrMessage->v6.originator,
                                        sizeof(iteratedEntry->originator.v6)) == 0)) {
@@ -244,10 +175,6 @@ bool isInDeDupList(DeDupList * deDupList, union olsr_message *olsrMessage) {
                count--;
        }
 
-#ifdef PUD_DUMP_DEDUP
-       olsr_printf(0,"isInDeDupList: result = %s\n\n", retval ? "true" : "false");
-#endif
-
        (void) pthread_mutex_unlock(&deDupList->mutex);
 
        return retval;
diff --git a/lib/pud/src/dump.c b/lib/pud/src/dump.c
deleted file mode 100644 (file)
index 1724145..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "dump.h"
-
-#ifdef PUD_DUMP_GPS_PACKETS
-
-/* Plugin includes */
-#include "pud.h"
-
-/* OLSRD includes */
-#include "olsr.h"
-
-/* System includes */
-#include <string.h>
-
-/** the number of bytes/characters per line */
-#define PUD_DUMP_GPS_PACKETS_CHARSPERLINE 16
-
-/**
- Prints a packet in hex/ascii.
-
- @param packet
- a pointer to the packet
- @param length
- the number of bytes in the packet
- */
-void dump_packet(unsigned char* packet, unsigned int length) {
-       unsigned int packetPos;
-       unsigned int linePos;
-       unsigned char line[PUD_DUMP_GPS_PACKETS_CHARSPERLINE + 1];
-
-       for (packetPos = 0; packetPos < length; packetPos
-                       += PUD_DUMP_GPS_PACKETS_CHARSPERLINE) {
-               unsigned int copyLength = PUD_DUMP_GPS_PACKETS_CHARSPERLINE;
-               if ((packetPos + copyLength) > length) {
-                       copyLength = length - packetPos;
-               }
-
-               memcpy(&line[0], &packet[packetPos], copyLength);
-               line[copyLength] = '\0';
-
-               olsr_printf(0, "%s: ", PUD_PLUGIN_ABBR);
-               for (linePos = 0; linePos < PUD_DUMP_GPS_PACKETS_CHARSPERLINE; linePos++) {
-                       if (linePos >= copyLength) {
-                               olsr_printf(0, "   ");
-                       } else {
-                               olsr_printf(0, "%2.2X ", packet[packetPos + linePos]);
-                               if ((line[linePos] < 32) || (line[linePos] > 126)) {
-                                       line[linePos] = '.';
-                               }
-                       }
-               }
-               olsr_printf(0, " %s\n", line);
-       }
-}
-
-#endif /* PUD_DUMP_GPS_PACKETS */
-
-#ifdef PUD_DUMP_NMEA
-
-/* Plugin includes */
-
-/* OLSRD includes */
-#include "olsr.h"
-
-/* System includes */
-#include <nmea/info.h>
-#include <nmea/sentence.h>
-
-void dump_nmeaInfo(nmeaINFO * nmeaInfo, const char * prefix) {
-       olsr_printf(0,
-                       "%s (%p)\n" /* prefix */
-                       "  smask = %02x%s%s%s%s%s\n"
-                       "  utc   = %04u%02u%02u %02u:%02u:%02u.%02u\n"
-                       "  sig   = %s (%u)\n"
-                       "  fix   = %s (%u)\n"
-                       "  PDOP  = %fm\n"
-                       "  HDOP  = %fm\n"
-                       "  VDOP  = %fm\n"
-                       "  lat   = %f\n"
-                       "  lon   = %f\n"
-                       "  alt   = %f\n"
-                       "  speed = %f\n"
-                       "  track = %f\n"
-                       "  decl  = %f\n"
-                       "\n",
-                       prefix, nmeaInfo,
-                       nmeaInfo->smask,
-                       ((nmeaInfo->smask & GPGGA) != 0) ? " GPGGA" : "",
-                       ((nmeaInfo->smask & GPGSA) != 0) ? " GPGSA" : "",
-                       ((nmeaInfo->smask & GPGSV) != 0) ? " GPGSV" : "",
-                       ((nmeaInfo->smask & GPRMC) != 0) ? " GPRMC" : "",
-                       ((nmeaInfo->smask & GPVTG) != 0) ? " GPVTG" : "",
-                       (nmeaInfo->utc.year + 1900), nmeaInfo->utc.mon, nmeaInfo->utc.day,
-                       nmeaInfo->utc.hour, nmeaInfo->utc.min, nmeaInfo->utc.sec, nmeaInfo->utc.hsec,
-                       (nmeaInfo->sig == NMEA_SIG_BAD) ? "BAD" : (nmeaInfo->sig == NMEA_SIG_LOW) ? "LOW" : (nmeaInfo->sig == NMEA_SIG_MID) ? "MID" : (nmeaInfo->sig == NMEA_SIG_HIGH) ? "HIGH" : "UNKNOWN", nmeaInfo->sig,
-                       (nmeaInfo->fix == NMEA_FIX_BAD) ? "BAD" : (nmeaInfo->fix == NMEA_FIX_2D) ? "2D" : (nmeaInfo->fix == NMEA_FIX_3D) ? "3D" : "UNKNOWN", nmeaInfo->fix,
-                       nmeaInfo->PDOP,
-                       nmeaInfo->HDOP,
-                       nmeaInfo->VDOP,
-                       nmeaInfo->lat,
-                       nmeaInfo->lon,
-                       nmeaInfo->elv,
-                       nmeaInfo->speed,
-                       nmeaInfo->direction,
-                       nmeaInfo->declination
-       );
-}
-
-#endif /* PUD_DUMP_NMEA */
diff --git a/lib/pud/src/dump.h b/lib/pud/src/dump.h
deleted file mode 100644 (file)
index bf95d12..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _PUD_DUMP_H_
-#define _PUD_DUMP_H_
-
-#if defined(PUD_DUMP_GPS_PACKETS_RX_NON_OLSR) || \
-       defined(PUD_DUMP_GPS_PACKETS_RX_OLSR) || \
-       defined(PUD_DUMP_GPS_PACKETS_TX_OLSR) || \
-       defined(PUD_DUMP_GPS_PACKETS_TX_UPLINK) || \
-       defined(PUD_DUMP_GPS_PACKETS_RX_DOWNLINK) || \
-       defined(PUD_DUMP_GPS_PACKETS_TX_DOWNLINK) || \
-       defined(PUD_DUMP_GPS_PACKETS_TX_NON_OLSR) || \
-       defined(PUD_DUMP_GPS_PACKETS)
-
-#ifndef PUD_DUMP_GPS_PACKETS
-#define PUD_DUMP_GPS_PACKETS
-#endif
-
-void dump_packet(unsigned char* packet, unsigned int length);
-
-#endif /* PUD_DUMP_GPS_PACKETS_* */
-
-
-#if defined(PUD_DUMP_AVERAGING) || \
-       defined(PUD_DUMP_NMEA)
-
-#ifndef PUD_DUMP_NMEA
-#define PUD_DUMP_NMEA
-#endif
-
-#include <nmea/info.h>
-
-void dump_nmeaInfo(nmeaINFO * nmeaInfo, const char * prefix);
-
-#endif /* PUD_DUMP_AVERAGING */
-
-#endif /* _PUD_DUMP_H_ */
index a7555ad..7442fdc 100644 (file)
@@ -1,7 +1,6 @@
 #include "posAvg.h"
 
 /* Plugin includes */
-#include "dump.h"
 
 /* OLSR includes */
 #include "olsr.h"
@@ -33,10 +32,6 @@ void flushPositionAverageList(PositionAverageList * positionAverageList) {
 
        nmea_zero_INFO(&positionAverageList->positionAverageCumulative.nmeaInfo);
        nmea_zero_INFO(&positionAverageList->positionAverage.nmeaInfo);
-
-#if defined(PUD_DUMP_AVERAGING)
-       olsr_printf(0, "flushPositionAverageList: Flushed the averaging list\n");
-#endif /* PUD_DUMP_AVERAGING */
 }
 
 /**
@@ -306,39 +301,6 @@ static void addOrRemoveEntryToFromCumulativeAverage(
        PositionUpdateEntry * cumulative =
                        &positionAverageList->positionAverageCumulative;
 
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&entry->nmeaInfo, "addOrRemoveEntryToFromCumulativeAverage: entry");
-       dump_nmeaInfo(&cumulative->nmeaInfo, "addOrRemoveEntryToFromCumulativeAverage: positionAverageList->positionAverageCumulative (before)");
-       olsr_printf(0,
-                       "addOrRemoveEntryToFromCumulativeAverage: positionAverageList->counters (before)\n"
-                       "  gpgga   = %llu\n"
-                       "  gpgsa   = %llu\n"
-                       "  gpgsv   = %llu\n"
-                       "  gprmc   = %llu\n"
-                       "  gpvtg   = %llu\n"
-                       "  sigBad  = %llu\n"
-                       "  sigLow  = %llu\n"
-                       "  sigMid  = %llu\n"
-                       "  sigHigh = %llu\n"
-                       "  fixBad  = %llu\n"
-                       "  fix2d   = %llu\n"
-                       "  fix3d   = %llu\n"
-                       "\n",
-                       positionAverageList->counters.gpgga,
-                       positionAverageList->counters.gpgsa,
-                       positionAverageList->counters.gpgsv,
-                       positionAverageList->counters.gprmc,
-                       positionAverageList->counters.gpvtg,
-                       positionAverageList->counters.sigBad,
-                       positionAverageList->counters.sigLow,
-                       positionAverageList->counters.sigMid,
-                       positionAverageList->counters.sigHigh,
-                       positionAverageList->counters.fixBad,
-                       positionAverageList->counters.fix2d,
-                       positionAverageList->counters.fix3d
-       );
-#endif /* PUD_DUMP_AVERAGING */
-
        if (!add) {
                assert(positionAverageList->entriesCount >= positionAverageList->entriesMaxCount);
                assert(entry == getPositionAverageEntry(positionAverageList, OLDEST));
@@ -395,38 +357,6 @@ static void addOrRemoveEntryToFromCumulativeAverage(
 
        updateCounters(positionAverageList, entry, add);
        determineCumulativeSmaskSigFix(positionAverageList);
-
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&cumulative->nmeaInfo, "addOrRemoveEntryToFromCumulativeAverage: positionAverageList->positionAverageCumulative (after)");
-       olsr_printf(0,
-                       "addOrRemoveEntryToFromCumulativeAverage: positionAverageList->counters (before)\n"
-                       "  gpgga   = %llu\n"
-                       "  gpgsa   = %llu\n"
-                       "  gpgsv   = %llu\n"
-                       "  gprmc   = %llu\n"
-                       "  gpvtg   = %llu\n"
-                       "  sigBad  = %llu\n"
-                       "  sigLow  = %llu\n"
-                       "  sigMid  = %llu\n"
-                       "  sigHigh = %llu\n"
-                       "  fixBad  = %llu\n"
-                       "  fix2d   = %llu\n"
-                       "  fix3d   = %llu\n"
-                       "\n",
-                       positionAverageList->counters.gpgga,
-                       positionAverageList->counters.gpgsa,
-                       positionAverageList->counters.gpgsv,
-                       positionAverageList->counters.gprmc,
-                       positionAverageList->counters.gpvtg,
-                       positionAverageList->counters.sigBad,
-                       positionAverageList->counters.sigLow,
-                       positionAverageList->counters.sigMid,
-                       positionAverageList->counters.sigHigh,
-                       positionAverageList->counters.fixBad,
-                       positionAverageList->counters.fix2d,
-                       positionAverageList->counters.fix3d
-       );
-#endif /* PUD_DUMP_AVERAGING */
 }
 
 /**
@@ -440,10 +370,6 @@ static void updatePositionAverageFromCumulative(
                PositionAverageList * positionAverageList) {
        double divider = positionAverageList->entriesCount;
 
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&positionAverageList->positionAverage.nmeaInfo, "updatePositionAverageFromCumulative: positionAverageList->positionAverage (before)");
-#endif /* PUD_DUMP_AVERAGING */
-
        positionAverageList->positionAverage = positionAverageList->positionAverageCumulative;
 
        /* smask: use from cumulative average */
@@ -468,10 +394,6 @@ static void updatePositionAverageFromCumulative(
        }
 
        /* satinfo: use from average */
-
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&positionAverageList->positionAverage.nmeaInfo, "updatePositionAverageFromCumulative: positionAverageList->positionAverage (after)");
-#endif /* PUD_DUMP_AVERAGING */
 }
 
 /**
@@ -488,12 +410,6 @@ void addNewPositionToAverage(PositionAverageList * positionAverageList,
        assert (positionAverageList != NULL);
        assert (newEntry == getPositionAverageEntry(positionAverageList, INCOMING));
 
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&newEntry->nmeaInfo, "addNewPositionToAverage: newEntry");
-       olsr_printf(0, "addNewPositionToAverage: positionAverageList->newestEntryIndex = %llu (before)\n", NEWESTINDEX(positionAverageList));
-       dump_nmeaInfo(&positionAverageList->positionAverageCumulative.nmeaInfo, "addNewPositionToAverage: positionAverageList->positionAverageCumulative.nmeaInfo (before)");
-#endif /* PUD_DUMP_AVERAGING */
-
        if (positionAverageList->entriesCount
                        >= positionAverageList->entriesMaxCount) {
                /* list is full, so first remove the oldest from the average */
@@ -508,15 +424,6 @@ void addNewPositionToAverage(PositionAverageList * positionAverageList,
        positionAverageList->newestEntryIndex
                        = WRAPINDEX(positionAverageList, NEWESTINDEX(positionAverageList) + 1);
 
-#if defined(PUD_DUMP_AVERAGING)
-       olsr_printf(0, "addNewPositionToAverage: positionAverageList->newestEntryIndex = %llu (after)\n", NEWESTINDEX(positionAverageList));
-       dump_nmeaInfo(&positionAverageList->positionAverageCumulative.nmeaInfo, "addNewPositionToAverage: positionAverageList->positionAverageCumulative.nmeaInfo (before)");
-#endif /* PUD_DUMP_AVERAGING */
-
        /* update average position */
        updatePositionAverageFromCumulative(positionAverageList);
-
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&positionAverageList->positionAverage.nmeaInfo, "addNewPositionToAverage: positionAverageList->positionAverage.nmeaInfo (after)");
-#endif /* PUD_DUMP_AVERAGING */
 }
index 7cba8a9..6d49d5c 100644 (file)
@@ -7,7 +7,6 @@
 #include "gpsConversion.h"
 #include "receiver.h"
 #include "state.h"
-#include "dump.h"
 
 /* OLSRD includes */
 #include "olsr.h"
@@ -86,13 +85,6 @@ static void sendToAllTxInterfaces(unsigned char *buffer,
        TRxTxNetworkInterface *txNetworkInterfaces = getTxNetworkInterfaces();
        while (txNetworkInterfaces != NULL) {
                TRxTxNetworkInterface *networkInterface = txNetworkInterfaces;
-
-#ifdef PUD_DUMP_GPS_PACKETS_TX_NON_OLSR
-               olsr_printf(0, "%s: packet sent to non-OLSR interface %s (%u bytes)\n",
-                               PUD_PLUGIN_ABBR, &networkInterface->name[0], bufferLength);
-               dump_packet(&buffer[0], bufferLength);
-#endif
-
                errno = 0;
                txAddress = getTxMcAddr();
                if (sendto(networkInterface->socketFd, buffer, bufferLength, 0,
@@ -127,11 +119,6 @@ bool packetReceivedFromOlsr(union olsr_message *olsrMessage,
        unsigned int transmitStringLength;
        unsigned char buffer[BUFFER_SIZE_TX_OLSR];
 
-#ifdef PUD_DUMP_GPS_PACKETS_RX_OLSR
-       unsigned short olsrMessageSize =
-                       getOlsrMessageSize(olsr_cnf->ip_version, olsrMessage);
-#endif
-
        /* when we do not loopback then check if the message originated from this
         * node: back off */
        if (!getUseLoopback() && ipequal(originator, &olsr_cnf->main_addr)) {
@@ -148,12 +135,6 @@ bool packetReceivedFromOlsr(union olsr_message *olsrMessage,
                addToDeDup(&deDupList, olsrMessage);
        }
 
-#ifdef PUD_DUMP_GPS_PACKETS_RX_OLSR
-       olsr_printf(0, "\n%s: packet received from OLSR interface %s (%u bytes)\n",
-                       PUD_PLUGIN_ABBR, in_if->int_name, olsrMessageSize);
-       dump_packet((unsigned char *) olsrMessage, olsrMessageSize);
-#endif
-
        transmitStringLength = gpsFromOlsr(olsrMessage, &buffer[0], sizeof(buffer));
        if (unlikely(transmitStringLength == 0)) {
                return false;
@@ -194,27 +175,6 @@ static void packetReceivedFromDownlink(int skfd, void *data __attribute__ ((unus
                        return;
                }
 
-#ifdef PUD_DUMP_GPS_PACKETS_RX_DOWNLINK
-               {
-                       void * src;
-                       in_port_t port;
-                       char fromAddr[64];
-
-                       if (olsr_cnf->ip_version == AF_INET) {
-                               src = &((struct sockaddr_in*) &sender)->sin_addr;
-                               port = ntohs(((struct sockaddr_in*) &sender)->sin_port);
-                       } else {
-                               src = &((struct sockaddr_in6*) &sender)->sin6_addr;
-                               port = ntohs(((struct sockaddr_in6*) &sender)->sin6_port);
-                       }
-
-                       inet_ntop(olsr_cnf->ip_version, src, &fromAddr[0], sizeof(fromAddr));
-                       olsr_printf(0, "\n%s: downlink packet received from %s, port %u (%lu bytes)\n",
-                                       PUD_PLUGIN_ABBR, &fromAddr[0],
-                                       port, (size_t) rxCount);
-               }
-#endif
-
                while (rxIndex < rxCount) {
                        UplinkMessage * msg = (UplinkMessage *) &rxBuffer[rxIndex];
                        uint8_t type;
@@ -274,48 +234,10 @@ static void packetReceivedFromDownlink(int skfd, void *data __attribute__ ((unus
                                                                        (r == 0) ? "there was not enough room in the buffer" :
                                                                                        "unknown reason"), olsrMessageLength, r);
                                        }
-#ifdef PUD_DUMP_GPS_PACKETS_TX_DOWNLINK
-                                       else {
-                                               olsr_printf(0, "%s: downlink position update sent"
-                                                               " to OLSR interface %s (%d bytes)\n",
-                                                               PUD_PLUGIN_ABBR, ifn->int_name, olsrMessageLength);
-                                       }
-#endif
                                }
 
                                /* send out over tx interfaces */
                                (void) packetReceivedFromOlsr(olsrMessage, NULL, NULL);
-#ifdef PUD_DUMP_GPS_PACKETS_TX_DOWNLINK
-                               olsr_printf(0, "%s: downlink position update sent"
-                                               " to tx interfaces (%d bytes)\n", PUD_PLUGIN_ABBR,
-                                               olsrMessageLength);
-#endif
-
-#ifdef PUD_DUMP_GPS_PACKETS_TX_DOWNLINK
-                       {
-                               void * src;
-                               char fromAddr[64];
-                               union olsr_ip_addr * originator = getOlsrMessageOriginator(
-                                               olsr_cnf->ip_version, olsrMessage);
-
-                               if (olsr_cnf->ip_version == AF_INET) {
-                                       src = &originator->v4;
-                               } else {
-                                       src = &originator->v6;
-                               }
-
-                               inet_ntop(olsr_cnf->ip_version, src, &fromAddr[0],
-                                               sizeof(fromAddr));
-                               olsr_printf(
-                                               0,
-                                               "%s: downlink position update from %s (%u bytes)\n",
-                                               PUD_PLUGIN_ABBR, &fromAddr[0], uplinkMessageLength);
-
-                               dump_packet((unsigned char *) msg, uplinkMessageLength);
-
-                               olsr_printf(0, "\n");
-                       }
-#endif
                        }
                        rxIndex += uplinkMessageLength;
                }
@@ -334,11 +256,7 @@ static void packetReceivedFromDownlink(int skfd, void *data __attribute__ ((unus
  @param flags
  unused
  */
-#ifdef PUD_DUMP_GPS_PACKETS_RX_NON_OLSR
-static void packetReceivedForOlsr(int skfd, void *data, unsigned int flags __attribute__ ((unused))) {
-#else
 static void packetReceivedForOlsr(int skfd, void *data __attribute__ ((unused)), unsigned int flags __attribute__ ((unused))) {
-#endif
        if (skfd >= 0) {
                unsigned char rxBuffer[BUFFER_SIZE_RX_NMEA];
                ssize_t rxCount;
@@ -365,30 +283,6 @@ static void packetReceivedForOlsr(int skfd, void *data __attribute__ ((unused)),
                        return;
                }
 
-#ifdef PUD_DUMP_GPS_PACKETS_RX_NON_OLSR
-               {
-                       TRxTxNetworkInterface * networkInterface = data;
-                       void * src;
-                       in_port_t port;
-                       char fromAddr[64];
-
-                       if (olsr_cnf->ip_version == AF_INET) {
-                               src = &((struct sockaddr_in*) &sender)->sin_addr;
-                               port = ntohs(((struct sockaddr_in*) &sender)->sin_port);
-                       } else {
-                               src = &((struct sockaddr_in6*) &sender)->sin6_addr;
-                               port = ntohs(((struct sockaddr_in6*) &sender)->sin6_port);
-                       }
-
-                       inet_ntop(olsr_cnf->ip_version, src, &fromAddr[0], sizeof(fromAddr));
-                       olsr_printf(0, "\n%s: packet received from %s, port %u on non-OLSR"
-                                       " interface %s (%lu bytes)\n", PUD_PLUGIN_ABBR, &fromAddr[0],
-                                       port, &networkInterface->name[0], (size_t) rxCount);
-
-                       dump_packet(&rxBuffer[0], (size_t)rxCount);
-               }
-#endif
-
                /* we have the received string in the rxBuffer now */
 
                /* hand the NMEA information to the receiver */
index f94e3ee..06610ec 100644 (file)
@@ -9,7 +9,6 @@
 #include "networkInterfaces.h"
 #include "timers.h"
 #include "uplinkGateway.h"
-#include "dump.h"
 
 /* OLSRD includes */
 #include "olsr_types.h"
 #include <nmea/sentence.h>
 #include <OlsrdPudWireFormat/wireFormat.h>
 
-/* Debug includes */
-#if defined(PUD_DUMP_GPS_PACKETS_TX_OLSR) || \
-       defined(PUD_DUMP_GPS_PACKETS_TX_UPLINK) || \
-       defined(PUD_DUMP_AVERAGING)
-#include "olsr.h"
-#endif
-
 /*
  * NMEA parser
  */
@@ -192,13 +184,6 @@ static void txToAllOlsrInterfaces(TimedTxInterface interfaces) {
                                                ((r == -1) ? "no buffer was found" :
                                                        (r == 0) ? "there was not enough room in the buffer" : "unknown reason"), pu_size, r);
                        }
-#ifdef PUD_DUMP_GPS_PACKETS_TX_OLSR
-                       else {
-                               olsr_printf(0, "%s: packet sent to OLSR interface %s (%d bytes)\n",
-                                               PUD_PLUGIN_ABBR, ifn->int_name, pu_size);
-                               dump_packet((unsigned char *)pu, pu_size);
-                       }
-#endif
                }
 
                /* loopback to tx interface when so configured */
@@ -269,13 +254,6 @@ static void txToAllOlsrInterfaces(TimedTxInterface interfaces) {
                                        sizeof(uplink_addr->in)) < 0) {
                                pudError(true, "Could not send to uplink (size=%u)", txBufferBytesUsed);
                        }
-#ifdef PUD_DUMP_GPS_PACKETS_TX_UPLINK
-                       else {
-                               olsr_printf(0, "%s: packet sent to uplink (%d bytes)\n",
-                                               PUD_PLUGIN_ABBR, pu_size);
-                               dump_packet((unsigned char *)&txBuffer, txBufferBytesUsed);
-                       }
-#endif
                }
        }
 }
@@ -708,11 +686,6 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
        nmea_parse(&nmeaParser, (char *) rxBuffer, rxCount,
                        &incomingEntry->nmeaInfo);
 
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&incomingEntry->nmeaInfo,
-                       "receiverUpdateGpsInformation: incoming entry");
-#endif /* PUD_DUMP_AVERAGING */
-
        /* ignore when no useful information */
        if (incomingEntry->nmeaInfo.smask == GPNON) {
                retval = true;
@@ -721,19 +694,9 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
 
        nmea_INFO_sanitise(&incomingEntry->nmeaInfo);
 
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&incomingEntry->nmeaInfo,
-                       "receiverUpdateGpsInformation: incoming entry after sanitise");
-#endif /* PUD_DUMP_AVERAGING */
-
        /* we always work with latitude, longitude in degrees and DOPs in meters */
        nmea_INFO_unit_conversion(&incomingEntry->nmeaInfo);
 
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&incomingEntry->nmeaInfo,
-                       "receiverUpdateGpsInformation: incoming entry after unit conversion");
-#endif /* PUD_DUMP_AVERAGING */
-
        /*
         * Averaging
         */
@@ -745,11 +708,6 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
        addNewPositionToAverage(&positionAverageList, incomingEntry);
        posAvgEntry = getPositionAverageEntry(&positionAverageList, AVERAGE);
 
-#if defined(PUD_DUMP_AVERAGING)
-       dump_nmeaInfo(&posAvgEntry->nmeaInfo,
-                       "receiverUpdateGpsInformation: posAvgEntry");
-#endif /* PUD_DUMP_AVERAGING */
-
        /*
         * Movement detection
         */
@@ -779,11 +737,6 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
        if ((externalState == MOVEMENT_STATE_MOVING) || updateTransmitGpsInformation) {
                transmitGpsInformation.txPosition.nmeaInfo = posAvgEntry->nmeaInfo;
                transmitGpsInformation.positionUpdated = true;
-
-#if defined(PUD_DUMP_AVERAGING)
-               dump_nmeaInfo(&posAvgEntry->nmeaInfo,
-                       "receiverUpdateGpsInformation: transmitGpsInformation");
-#endif /* PUD_DUMP_AVERAGING */
        }
 
        (void) pthread_mutex_unlock(&transmitGpsInformation.mutex);