servlib/bundling/BPQBlock.cc
changeset 4 c02ca5a6ab82
child 5 1849bf57d910
equal deleted inserted replaced
3:c244287035f5 4:c02ca5a6ab82
       
     1 /*
       
     2  *    Copyright 2006 Intel Corporation
       
     3  * 
       
     4  *    Licensed under the Apache License, Version 2.0 (the "License");
       
     5  *    you may not use this file except in compliance with the License.
       
     6  *    You may obtain a copy of the License at
       
     7  * 
       
     8  *        http://www.apache.org/licenses/LICENSE-2.0
       
     9  * 
       
    10  *    Unless required by applicable law or agreed to in writing, software
       
    11  *    distributed under the License is distributed on an "AS IS" BASIS,
       
    12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    13  *    See the License for the specific language governing permissions and
       
    14  *    limitations under the License.
       
    15  */
       
    16 
       
    17 #ifdef HAVE_CONFIG_H
       
    18 #  include <dtn-config.h>
       
    19 #endif
       
    20 
       
    21 #include "BPQBlock.h"
       
    22 
       
    23 namespace dtn {
       
    24 
       
    25 BPQBlock::BPQBlock(BlockInfo* block)
       
    26 {
       
    27     static const char* log = "/dtn/bundle/protocol";
       
    28     log_err_p(log, "BPQBlock: constructor");
       
    29     
       
    30     log_err_p(log, "block->data_length(): %d",block->data_length());
       
    31     log_err_p(log, "block->data_offset(): %d",block->data_offset());
       
    32     log_err_p(log, "block->full_length(): %d",block->full_length());
       
    33 
       
    34 
       
    35     size_t len = block->writable_contents()->buf_len();
       
    36     u_char*  buf = block->writable_contents()->buf(len);
       
    37 
       
    38     size_t i=0;
       
    39 //, j=0, decoding_len=0;
       
    40 
       
    41     // BPQ-kind             1-byte
       
    42     if (i<len) {
       
    43         kind_ = (u_int) buf[i++];
       
    44         log_err_p(log, "kind: %d",kind_);
       
    45     }
       
    46 
       
    47     // matching rule type   1-byte
       
    48     if (i<len) {
       
    49         matching_rule_ = (u_int) buf[i++];
       
    50         log_err_p(log, "marching rule: %d",matching_rule_);
       
    51     }
       
    52     log_err_p(log, "leaving constructor");
       
    53 }
       
    54 
       
    55 BPQBlock::~BPQBlock()
       
    56 {
       
    57     static const char* log = "/dtn/bundle/protocol";
       
    58     log_err_p(log, "BPQBlock: destructor");
       
    59 }
       
    60 
       
    61 
       
    62 } // namespace dtn