apps/dtnquery/dtnquery.c
changeset 68 17b33ba237f2
parent 66 e1101c5d54a1
--- a/apps/dtnquery/dtnquery.c	Tue Jan 10 12:57:26 2012 +0000
+++ b/apps/dtnquery/dtnquery.c	Tue Jan 10 13:49:58 2012 +0000
@@ -374,7 +374,7 @@
     }
 
     // if no reply-to eid set, use the src eid
-    if (*reply_eid_name == NULL)
+    if (*reply_eid_name == 0)
         strncpy(reply_eid_name, src_eid_name, PATH_MAX);
     
     return DTN_SUCCESS;
@@ -806,7 +806,7 @@
     // Source EID length     SDNV
     if ( (q_decoding_len = sdnv_decode (&(buf[i]),
     									buf_len - i,
-    									&(bpq->original_id.source_len))) == -1 ) {
+    									(u_int64_t*)&(bpq->original_id.source_len))) == -1 ) {
         fprintf (stderr, "Error decoding source EID length\n");
         return -1;
     }
@@ -814,7 +814,7 @@
 
     // Source EID            n-bytes
     if (i<buf_len && bpq->original_id.source_len <= DTN_MAX_ENDPOINT_ID) {
-    	strncpy(bpq->original_id.source.uri, &(buf[i]), bpq->original_id.source_len);
+    	strncpy(bpq->original_id.source.uri, (char*)&(buf[i]), bpq->original_id.source_len);
     	i += bpq->original_id.source_len;
     } else {
     	fprintf (stderr, "Error copying source EID\n");
@@ -824,21 +824,21 @@
     // BPQ-value-length     SDNV
     if ( (q_decoding_len = sdnv_decode (&(buf[i]),
     									buf_len - i,
-    									&(bpq->query.query_len))) == -1 ) {
+    									(u_int64_t*)&(bpq->query.query_len))) == -1 ) {
         fprintf (stderr, "Error decoding BPQ-value-length\n");
         return -1;
     }
     i += q_decoding_len;
 
     // BPQ-value            n-bytes
-    if (i<buf_len) bpq->query.query_val = &(buf[i]);
+    if (i<buf_len) bpq->query.query_val = (char*)&(buf[i]);
     	i += bpq->query.query_len;
 
 
     // number of fragments  SDNV
     if ( (f_decoding_len = sdnv_decode (&(buf[i]),
     									buf_len - i,
-    									&(bpq->fragments.num_frag_returned))) == -1 ) {
+    									(u_int64_t*)&(bpq->fragments.num_frag_returned))) == -1 ) {
         fprintf (stderr, "Error decoding number of fragments\n");
         return -1;
     }
@@ -849,7 +849,7 @@
         // fragment offsets     SDNV
         if ( (decoding_len = sdnv_decode (&(buf[i]),
         								  buf_len - i,
-        								  &(bpq->fragments.frag_offsets[j]))) == -1 ) {
+        								  (u_int64_t*)&(bpq->fragments.frag_offsets[j]))) == -1 ) {
             fprintf (stderr, "Error decoding fragment[%d] offset\n", j);
             return -1;
         }
@@ -858,7 +858,7 @@
         // fragment lengths     SDNV
         if ( (decoding_len = sdnv_decode (&(buf[i]),
         								  buf_len - i,
-        								  &(bpq->fragments.frag_lenghts[j]))) == -1 ) {
+        								  (u_int64_t*)&(bpq->fragments.frag_lenghts[j]))) == -1 ) {
             fprintf (stderr, "Error decoding fragment[%d] length\n", j);
             return -1;
         }
@@ -880,7 +880,7 @@
         fprintf (stdout, "   source eid len: %d\n",
         		 (int) bpq->original_id.source_len);
         fprintf (stdout, "       source eid: %s\n",
-        		 (int) bpq->original_id.source.uri);
+        		 bpq->original_id.source.uri);
 
         fprintf (stdout, "        query len: %d\n", bpq->query.query_len);
         fprintf (stdout, "   q_decoding_len: %d\n", q_decoding_len);
@@ -930,6 +930,12 @@
     // set the bpq block data
     bpq_block_data.kind = BPQ_BLOCK_KIND_QUERY;
     bpq_block_data.matching_rule = matching_rule;
+
+    bpq_block_data.original_id.creation_ts.secs = 0;
+    bpq_block_data.original_id.creation_ts.seqno = 0;
+    bpq_block_data.original_id.source = *src_eid;
+    bpq_block_data.original_id.source_len = strlen(src_eid->uri);
+
     bpq_block_data.query.query_len = strlen(query) + 1;     // include the null char at the end
     bpq_block_data.query.query_val = query; 
     bpq_block_data.fragments.num_frag_returned = 0;