00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _METADATA_BLOCK_PROCESSOR_H_
00023 #define _METADATA_BLOCK_PROCESSOR_H_
00024
00025 #include "BlockProcessor.h"
00026
00027 namespace dtn {
00028
00029 class MetadataBlock;
00030
00034 class MetadataBlockProcessor : public BlockProcessor {
00035 public:
00036
00038 MetadataBlockProcessor();
00039
00041 int consume(Bundle* bundle,
00042 BlockInfo* block,
00043 u_char* buf,
00044 size_t len);
00045
00046 bool validate(const Bundle* bundle,
00047 BlockInfoVec* block_list,
00048 BlockInfo* block,
00049 status_report_reason_t* reception_reason,
00050 status_report_reason_t* deletion_reason);
00051
00052 int prepare(const Bundle* bundle,
00053 BlockInfoVec* xmit_blocks,
00054 const BlockInfo* source,
00055 const LinkRef& link,
00056 list_owner_t list);
00057
00058 int generate(const Bundle* bundle,
00059 BlockInfoVec* xmit_blocks,
00060 BlockInfo* block,
00061 const LinkRef& link,
00062 bool last);
00064
00069 void prepare_generated_metadata(Bundle* bundle,
00070 BlockInfoVec* blocks,
00071 const LinkRef& link);
00072
00076 void delete_generated_metadata(Bundle* bundle, const LinkRef& link);
00077
00078 private:
00079
00085 bool parse_metadata(Bundle* bundle, BlockInfo* block);
00086
00094 bool handle_error(const BlockInfo* block,
00095 status_report_reason_t* reception_reason,
00096 status_report_reason_t* deletion_reason);
00097 };
00098
00099 }
00100
00101 #endif