# HG changeset patch # User aidan # Date 1309440499 -3600 # Node ID 18b4c80456cf86b48e9a70246c15d5951a2bdeec # Parent 3c36683e13beb0c524f5c4fb7b409d32825ae16c added bpq block check to dtnquery diff -r 3c36683e13be -r 18b4c80456cf apps/dtnquery/dtnquery.c --- 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;