PUD: remove PUD_HWADDR_SIZE, just use IFHWADDRLEN
authorFerry Huberts <f.huberts@mindef.nl>
Thu, 21 Jul 2011 09:59:28 +0000 (10:59 +0100)
committerFerry Huberts <f.huberts@mindef.nl>
Mon, 25 Jul 2011 06:13:42 +0000 (08:13 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/networkInterfaces.h
lib/pud/src/nodeIdConversion.c
lib/pud/src/receiver.c

index 5ea2042..4bdaca0 100644 (file)
@@ -12,9 +12,6 @@
 #include <stdbool.h>
 #include <net/if.h>
 
-/** The size of the hardware address */
-#define PUD_HWADDR_SIZE IFHWADDRLEN
-
 /** A list of TRxTxNetworkInterface objects, used for non-OLSR interfaces */
 typedef struct _TRxTxNetworkInterface {
                /** The socket file descriptor for the non-OLSR interface*/
@@ -27,7 +24,7 @@ typedef struct _TRxTxNetworkInterface {
                union olsr_sockaddr ipAddress;
 
                /** The hardware address of the interface */
-               unsigned char hwAddress[PUD_HWADDR_SIZE];
+               unsigned char hwAddress[IFHWADDRLEN];
 
                /** The next TRxTxNetworkInterface in the list */
                struct _TRxTxNetworkInterface * next;
@@ -39,7 +36,7 @@ typedef struct _TOLSRNetworkInterface {
                struct interface * olsrIntf;
 
                /** The hardware address of the interface */
-               unsigned char hwAddress[PUD_HWADDR_SIZE];
+               unsigned char hwAddress[IFHWADDRLEN];
 
                /** The next TOLSRNetworkInterface in the list */
                struct _TOLSRNetworkInterface * next;
index 2205580..4ef9ffd 100644 (file)
@@ -11,6 +11,7 @@
 /* System includes */
 #include <assert.h>
 #include <arpa/inet.h>
+#include <net/if.h>
 
 /* ************************************************************************
  * Node Information
@@ -139,7 +140,7 @@ size_t setupNodeInfoForOlsr(PudOlsrWireFormat * olsrGpsMessage,
                case PUD_NODEIDTYPE_MAC: /* hardware address */
                        /* handled when the message is actually sent into OLSR, in the
                         * pre-transmit hook */
-                       length = PUD_HWADDR_SIZE;
+                       length = IFHWADDRLEN;
                        break;
 
                case PUD_NODEIDTYPE_MSISDN: /* an MSISDN number */
@@ -269,7 +270,7 @@ void getNodeInfoFromOlsr(const union olsr_message *olsrMessage,
                        {
                                unsigned char * hwAddr = &olsrGpsMessage->nodeInfo.nodeId;
 
-                               assert (PUD_HWADDR_SIZE == 6);
+                               assert (IFHWADDRLEN == 6);
 
                                chars = snprintf(nodeIdBuffer, nodeIdBufferSize,
                                                "%02x:%02x:%02x:%02x:%02x:%02x", hwAddr[0], hwAddr[1],
index d178d09..8abe129 100644 (file)
@@ -23,6 +23,7 @@
 #include <nmea/sentence.h>
 #include <sys/timeb.h>
 #include <math.h>
+#include <net/if.h>
 
 /*
  * NMEA parser
@@ -144,11 +145,11 @@ static void nodeIdPreTransmitHook(union olsr_message *olsrMessage,
 
                if (likely(olsrIf != NULL)) {
                        memcpy(&olsrGpsMessage->nodeInfo.nodeId, &olsrIf->hwAddress[0],
-                                       PUD_HWADDR_SIZE);
+                                       IFHWADDRLEN);
                } else {
                        pudError(false, "Could not find OLSR interface %s, cleared its"
                                " MAC address in the OLSR message\n", ifn->int_name);
-                       memset(&olsrGpsMessage->nodeInfo.nodeId, 0, PUD_HWADDR_SIZE);
+                       memset(&olsrGpsMessage->nodeInfo.nodeId, 0, IFHWADDRLEN);
                }
        }
 }