apps/dtnquery/dtnquery.c
changeset 23 18b4c80456cf
parent 20 7fd5f0de6c59
child 28 406d4f7eb00d
--- a/apps/dtnquery/dtnquery.c	Thu Jun 30 13:13:10 2011 +0100
+++ b/apps/dtnquery/dtnquery.c	Thu Jun 30 14:28:19 2011 +0100
@@ -843,6 +843,7 @@
     int verbose)
 {
     int ret = 0, err = 0, num_blocks, i, j;
+    int has_bpq_block = 0;
     dtn_bundle_spec_t               bundle_spec;
     dtn_extension_block_t*          bpq_blocks;
     dtn_bpq_extension_block_data_t  bpq_block_data;
@@ -868,6 +869,10 @@
                              bundle_spec.source.uri,
                              bundle_spec.creation_ts.secs,
                              bundle_spec.creation_ts.seqno);
+
+            fprintf(stdout, "Source: %s\n", bundle_spec.source.uri);
+            fprintf(stdout, "Destination: %s\n", bundle_spec.dest.uri);
+            fprintf(stdout, "Reply-To: %s\n", bundle_spec.replyto.uri);
         }
 
         // extract the bpq
@@ -876,6 +881,7 @@
 
         for (i = 0; i < num_blocks; ++i) {
             if (bpq_blocks[i].type == DTN_BPQ_BLOCK_TYPE) {
+                has_bpq_block = 1;
 
                 if (verbose) fprintf(stdout, "bundle contains a "
                                              "BPQ extension block\n");
@@ -905,6 +911,11 @@
             }
         }
 
+        if(!has_bpq_block) {
+            fprintf(stderr, "no bpq block found in bundle\n");
+            continue;
+        }
+
         if(err)
             continue;