PUD: replace inline nodeIdType limits by defines
authorFerry Huberts <f.huberts@mindef.nl>
Wed, 26 Oct 2011 14:32:43 +0000 (16:32 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 14 Feb 2012 13:32:58 +0000 (14:32 +0100)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/configuration.c
lib/pud/wireformat/include/OlsrdPudWireFormat/wireFormat.h

index 1d08e76..6c15e36 100644 (file)
@@ -402,34 +402,35 @@ static bool setupNodeIdBinaryAndValidate(NodeIdType nodeIdTypeNumber) {
                        return setupNodeIdBinaryMAC();
 
                case PUD_NODEIDTYPE_MSISDN: /* an MSISDN number */
-                       return setupNodeIdBinaryLongLong(0LL, 999999999999999LL,
-                               PUD_NODEIDTYPE_MSISDN_BYTES);
+                       return setupNodeIdBinaryLongLong(PUD_NODEIDTYPE_MSISDN_MIN,
+                               PUD_NODEIDTYPE_MSISDN_MAX, PUD_NODEIDTYPE_MSISDN_BYTES);
 
                case PUD_NODEIDTYPE_TETRA: /* a Tetra number */
-                       return setupNodeIdBinaryLongLong(0LL, 99999999999999999LL,
-                               PUD_NODEIDTYPE_TETRA_BYTES);
+                       return setupNodeIdBinaryLongLong(PUD_NODEIDTYPE_TETRA_MIN,
+                               PUD_NODEIDTYPE_TETRA_MAX, PUD_NODEIDTYPE_TETRA_BYTES);
 
                case PUD_NODEIDTYPE_DNS: /* DNS name */
                        return setupNodeIdBinaryString();
 
                case PUD_NODEIDTYPE_MMSI: /* an AIS MMSI number */
-                       return setupNodeIdBinaryLongLong(0LL, 999999999LL,
-                               PUD_NODEIDTYPE_MMSI_BYTES);
+                       return setupNodeIdBinaryLongLong(PUD_NODEIDTYPE_MMSI_MIN,
+                               PUD_NODEIDTYPE_MMSI_MAX, PUD_NODEIDTYPE_MMSI_BYTES);
 
                case PUD_NODEIDTYPE_URN: /* a URN number */
-                       return setupNodeIdBinaryLongLong(0LL, 16777215LL,
-                               PUD_NODEIDTYPE_URN_BYTES);
+                       return setupNodeIdBinaryLongLong(PUD_NODEIDTYPE_URN_MIN,
+                               PUD_NODEIDTYPE_URN_MAX, PUD_NODEIDTYPE_URN_BYTES);
 
                case PUD_NODEIDTYPE_192:
-                       return setupNodeIdBinaryLongLong(0LL, 9999999LL,
-                               PUD_NODEIDTYPE_192_BYTES);
+                       return setupNodeIdBinaryLongLong(PUD_NODEIDTYPE_192_MIN,
+                               PUD_NODEIDTYPE_192_MAX, PUD_NODEIDTYPE_192_BYTES);
 
                case PUD_NODEIDTYPE_193:
-                       return setupNodeIdBinaryLongLong(0LL, 999999LL,
-                               PUD_NODEIDTYPE_193_BYTES);
+                       return setupNodeIdBinaryLongLong(PUD_NODEIDTYPE_193_MIN,
+                               PUD_NODEIDTYPE_193_MAX, PUD_NODEIDTYPE_193_BYTES);
 
                case PUD_NODEIDTYPE_194:
-                       return setupNodeIdBinaryLongLong(1LL, 8191LL, PUD_NODEIDTYPE_194_BYTES);
+                       return setupNodeIdBinaryLongLong(PUD_NODEIDTYPE_194_MIN,
+                               PUD_NODEIDTYPE_194_MAX, PUD_NODEIDTYPE_194_BYTES);
 
                case PUD_NODEIDTYPE_IPV4: /* IPv4 address */
                case PUD_NODEIDTYPE_IPV6: /* IPv6 address */
index 16d11e7..628c84e 100644 (file)
@@ -181,24 +181,38 @@ typedef enum _NodeIdType {
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_MSISDN */
 #define PUD_NODEIDTYPE_MSISDN_BYTES            7
+#define PUD_NODEIDTYPE_MSISDN_MIN              0LL
+#define PUD_NODEIDTYPE_MSISDN_MAX              999999999999999LL
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_TETRA */
 #define PUD_NODEIDTYPE_TETRA_BYTES             8
+#define PUD_NODEIDTYPE_TETRA_MIN               0LL
+#define PUD_NODEIDTYPE_TETRA_MAX               99999999999999999LL
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_MMSI */
 #define PUD_NODEIDTYPE_MMSI_BYTES              4
+#define PUD_NODEIDTYPE_MMSI_MIN                        0LL
+#define PUD_NODEIDTYPE_MMSI_MAX                        999999999LL
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_URN */
 #define PUD_NODEIDTYPE_URN_BYTES               3
+#define PUD_NODEIDTYPE_URN_MIN                 0LL
+#define PUD_NODEIDTYPE_URN_MAX                 16777215LL
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_192 */
 #define PUD_NODEIDTYPE_192_BYTES               3
+#define PUD_NODEIDTYPE_192_MIN                 0LL
+#define PUD_NODEIDTYPE_192_MAX                 9999999LL
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_193 */
 #define PUD_NODEIDTYPE_193_BYTES               3
+#define PUD_NODEIDTYPE_193_MIN                 0LL
+#define PUD_NODEIDTYPE_193_MAX                 999999LL
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_194 */
 #define PUD_NODEIDTYPE_194_BYTES               2
+#define PUD_NODEIDTYPE_194_MIN                 1LL
+#define PUD_NODEIDTYPE_194_MAX                 8191LL
 
 /** the number of nodeId bytes for PUD_NODEIDTYPE_IPV4 (sizeof(struct in_addr)) */
 #define PUD_NODEIDTYPE_IPV4_BYTES              4