apps/dtnquery/dtnquery.c
changeset 28 406d4f7eb00d
parent 23 18b4c80456cf
child 32 64b5c8f5be17
--- a/apps/dtnquery/dtnquery.c	Thu Jun 30 15:32:09 2011 +0100
+++ b/apps/dtnquery/dtnquery.c	Wed Aug 03 14:35:09 2011 +0100
@@ -39,17 +39,11 @@
 #define DTN_BPQ_BASE64 2
 #define DTN_BPQ_FILE 3
 
-#define DTN_BPQ_EXACT 1
-
 #define DTN_BPQ_SEND 1
 #define DTN_BPQ_RECV 2
 #define DTN_BPQ_SEND_RECV 3
 
 #define DTN_BPQ_BLOCK_TYPE 0xC8
-#define DTN_BPQ_BLOCK_FLAGS 0x00
-
-#define DTN_BPQ_KIND_QUERY 0x00
-#define DTN_BPQ_KIND_RESPONSE 0x01
 
 // Find the maximum commandline length
 #ifdef __FreeBSD__
@@ -249,7 +243,7 @@
             }
         case 'u':
             if (!strcasecmp(optarg, "exact")) {
-                *matching_rule = DTN_BPQ_EXACT;
+                *matching_rule = BPQ_MATCHING_RULE_EXACT;
                 break;
             } else {
                 fprintf(stderr, "invalid query type '%s'\n", optarg);
@@ -440,7 +434,8 @@
             query_type == DTN_BPQ_BASE64  ||
             query_type == DTN_BPQ_FILE, "-t <query type> invalid type\n");
 
-    REQUIRE(matching_rule == DTN_BPQ_EXACT, "-u <matching rule> invalid rule\n");
+    REQUIRE(matching_rule == BPQ_MATCHING_RULE_EXACT,
+         "-u <matching rule> invalid rule\n");
     REQUIRE(bundle_expiry > 0, "-e <expiry> must be a positive integer\n");
 #undef REQUIRE
 //todo: check this is ok
@@ -780,7 +775,7 @@
     memset(&payload,        0, sizeof(dtn_bundle_payload_t));
     
     // set the bpq block data
-    bpq_block_data.kind = DTN_BPQ_KIND_QUERY;
+    bpq_block_data.kind = BPQ_BLOCK_KIND_QUERY;
     bpq_block_data.matching_rule = matching_rule;
     bpq_block_data.query.query_len = strlen(query) + 1;     // include the null char at the end
     bpq_block_data.query.query_val = query; 
@@ -792,7 +787,7 @@
 
     // set the bpq block
     bpq_block.type = DTN_BPQ_BLOCK_TYPE;
-    bpq_block.flags = DTN_BPQ_BLOCK_FLAGS;
+    bpq_block.flags = BLOCK_FLAG_REPLICATE;
     bpq_block.data.data_len = buf_len;
     bpq_block.data.data_val = buf;
     
@@ -949,7 +944,7 @@
     char filename[PATH_MAX];
     char query[PATH_MAX];
     int query_type = DTN_BPQ_LITERAL;
-    int matching_rule = DTN_BPQ_EXACT;
+    int matching_rule = BPQ_MATCHING_RULE_EXACT;
     int mode = DTN_BPQ_SEND_RECV;
     int count = 1;
     dtn_timeval_t timeout = DTN_TIMEOUT_INF;    //forever