--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/servlib/bundling/BPQBlock.h Wed May 04 15:44:40 2011 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef _BPQ_BLOCK_H_
+#define _BPQ_BLOCK_H_
+
+#ifdef HAVE_CONFIG_H
+# include <dtn-config.h>
+#endif
+
+#include "BlockInfo.h"
+namespace dtn {
+
+class BPQFragment{
+public:
+ BPQFragment() {}
+ ~BPQFragment() {}
+
+ /// @{ Accessors
+ u_int offset() const { return offset_; }
+ u_int length() const { return length_; }
+ /// @}
+
+private:
+ u_int offset_; ///< Fragment offset
+ u_int length_; ///< Fragment length
+};
+
+class BPQBlock {
+public:
+ BPQBlock(BlockInfo* block);
+ ~BPQBlock();
+
+ /// @{ Accessors
+ u_int kind() const { return kind_; }
+ u_int matching_rule() const { return matching_rule_; }
+ u_int query_len() const { return query_len_; }
+ const char* query_val() const { return query_val_; }
+ /// @}
+
+ /// @{ Typedefs and wrappers for the BPQFragment vector and iterators
+ typedef std::vector<BPQFragment> BPQFragmentVec;
+ typedef BPQFragmentVec::iterator iterator;
+ typedef BPQFragmentVec::const_iterator const_iterator;
+
+ bool empty() const { return fragments_.empty(); }
+ BPQFragmentVec::iterator begin() { return fragments_.begin(); }
+ BPQFragmentVec::iterator end() { return fragments_.end(); }
+ BPQFragmentVec::const_iterator begin() const { return fragments_.begin(); }
+ BPQFragmentVec::const_iterator end() const { return fragments_.end(); }
+ /// @}
+
+
+private:
+ u_int kind_; ///< Query || Response
+ u_int matching_rule_; ///< Exact
+ u_int query_len_; ///< Length of the query value
+ char* query_val_; ///< Query value
+ BPQFragmentVec fragments_; ///< List of fragments returned
+};
+
+} // namespace dtn
+
+#endif /* _BPQ_BLOCK_H_ */
+