servlib/bundling/BPQBlock.cc
changeset 4 c02ca5a6ab82
child 5 1849bf57d910
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/servlib/bundling/BPQBlock.cc	Wed May 04 15:44:40 2011 +0100
@@ -0,0 +1,62 @@
+/*
+ *    Copyright 2006 Intel Corporation
+ * 
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ * 
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <dtn-config.h>
+#endif
+
+#include "BPQBlock.h"
+
+namespace dtn {
+
+BPQBlock::BPQBlock(BlockInfo* block)
+{
+    static const char* log = "/dtn/bundle/protocol";
+    log_err_p(log, "BPQBlock: constructor");
+    
+    log_err_p(log, "block->data_length(): %d",block->data_length());
+    log_err_p(log, "block->data_offset(): %d",block->data_offset());
+    log_err_p(log, "block->full_length(): %d",block->full_length());
+
+
+    size_t len = block->writable_contents()->buf_len();
+    u_char*  buf = block->writable_contents()->buf(len);
+
+    size_t i=0;
+//, j=0, decoding_len=0;
+
+    // BPQ-kind             1-byte
+    if (i<len) {
+        kind_ = (u_int) buf[i++];
+        log_err_p(log, "kind: %d",kind_);
+    }
+
+    // matching rule type   1-byte
+    if (i<len) {
+        matching_rule_ = (u_int) buf[i++];
+        log_err_p(log, "marching rule: %d",matching_rule_);
+    }
+    log_err_p(log, "leaving constructor");
+}
+
+BPQBlock::~BPQBlock()
+{
+    static const char* log = "/dtn/bundle/protocol";
+    log_err_p(log, "BPQBlock: destructor");
+}
+
+
+} // namespace dtn