servlib/bundling/BPQCacheEntry.h
changeset 57 bb780f1beb9b
child 58 574358af597b
equal deleted inserted replaced
56:76420d9f6e62 57:bb780f1beb9b
       
     1 /*
       
     2  *    Copyright 2004-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 #ifndef __BPQ_CACHE_ENTRY__
       
    18 #define __BPQ_CACHE_ENTRY__
       
    19 
       
    20 #ifdef HAVE_CONFIG_H
       
    21 #  include <dtn-config.h>
       
    22 #endif
       
    23 
       
    24 #include <oasys/debug/Log.h>
       
    25 
       
    26 #include "Bundle.h"
       
    27 #include "BundleRef.h"
       
    28 #include "BundleList.h"
       
    29 
       
    30 namespace dtn {
       
    31 
       
    32 class Bundle;
       
    33 
       
    34 class BPQCacheEntry : public oasys::Logger {
       
    35 public:
       
    36 	BPQCacheEntry() :
       
    37         Logger("BPQCacheEntry", "/dtn/bundle/bpq"),
       
    38         fragments_("cache_entry") {}
       
    39 
       
    40 	int add_response(Bundle* bundle);
       
    41 	int reassemble_fragments();
       
    42 
       
    43 	/// accessors
       
    44 	bool is_complete() 			{ return is_complete_; }
       
    45 	BundleRef& bundle() 		{ return bundle_; }
       
    46 	BundleList& fragment_list() { return fragments_; }
       
    47 
       
    48 
       
    49 
       
    50 private:
       
    51 	bool check_complete() const;
       
    52 
       
    53 	bool is_complete_;		///<
       
    54 	BundleRef  bundle_; 	///< The complete bundle
       
    55     BundleList fragments_;  ///< List of partial fragments
       
    56 };
       
    57 
       
    58 } // namespace dtn
       
    59 
       
    60 #endif