equal
deleted
inserted
replaced
17 #ifdef HAVE_CONFIG_H |
17 #ifdef HAVE_CONFIG_H |
18 # include <dtn-config.h> |
18 # include <dtn-config.h> |
19 #endif |
19 #endif |
20 |
20 |
21 #include "BPQResponse.h" |
21 #include "BPQResponse.h" |
|
22 #include "BundleTimestamp.h" |
22 //#include <oasys/util/ScratchBuffer.h> |
23 //#include <oasys/util/ScratchBuffer.h> |
23 //#include "SDNV.h" |
24 //#include "SDNV.h" |
24 |
25 |
25 namespace dtn { |
26 namespace dtn { |
26 |
27 |
44 new_response->mutable_dest()->assign(query->source()); |
45 new_response->mutable_dest()->assign(query->source()); |
45 new_response->mutable_replyto()->assign(query->dest()); |
46 new_response->mutable_replyto()->assign(query->dest()); |
46 |
47 |
47 // set expiry |
48 // set expiry |
48 new_response->set_expiration(query->expiration()); // TODO: check this is ok |
49 new_response->set_expiration(query->expiration()); // TODO: check this is ok |
|
50 |
|
51 // reset creation timestamp (seconds = now, seqno = id) |
|
52 BundleTimestamp* ts = new BundleTimestamp(BundleTimestamp::get_current_time(), |
|
53 new_response->bundleid()); |
|
54 new_response->set_creation_ts(*ts); |
49 |
55 |
50 // set payload |
56 // set payload |
51 log_debug_p(LOG, "Copy response payload"); |
57 log_debug_p(LOG, "Copy response payload"); |
52 new_response->mutable_payload()-> |
58 new_response->mutable_payload()-> |
53 replace_with_file(cached_response->payload().filename().c_str()); |
59 replace_with_file(cached_response->payload().filename().c_str()); |
87 { |
93 { |
88 BlockInfo current_bi = *iter; |
94 BlockInfo current_bi = *iter; |
89 BlockProcessor* new_bp = BundleProtocol::find_processor( |
95 BlockProcessor* new_bp = BundleProtocol::find_processor( |
90 current_bi.owner()->block_type()); |
96 current_bi.owner()->block_type()); |
91 |
97 |
92 BlockInfo* new_bi = new_response->api_blocks()->append_block(new_bp); |
98 BlockInfo* new_bi = new_response->mutable_recv_blocks()->append_block(new_bp); |
93 new_bp->init_block( new_bi, |
99 new_bp->init_block( new_bi, |
94 new_response->mutable_recv_blocks(), |
100 new_response->mutable_recv_blocks(), |
95 current_bi.type(), |
101 current_bi.type(), |
96 current_bi.flags(), |
102 current_bi.flags(), |
97 (const u_char*)current_bi.data(), |
103 (const u_char*)current_bi.data(), |