Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
reassembly.h
1 /*
2  * Copyright (c) 2017-2019 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #pragma once
17 
18 #include <core/facade.h>
19 
20 namespace transport {
21 
22 namespace implementation {
23 class ConsumerReadCallback;
24 class ConsumerSocket;
25 } // namespace implementation
26 
27 namespace protocol {
28 
29 class TransportProtocol;
30 class Indexer;
31 
32 // Forward Declaration
33 class ManifestManager;
34 
35 class Reassembly {
36  public:
38  public:
39  virtual void onContentReassembled(std::error_code ec) = 0;
40  };
41 
43  TransportProtocol *transport_protocol)
44  : reassembly_consumer_socket_(icn_socket),
45  transport_protocol_(transport_protocol) {}
46 
47  virtual ~Reassembly() = default;
48 
52  virtual void reassemble(core::ContentObject &content_object) = 0;
53 
57  virtual void reassemble(utils::MemBuf &buffer, uint32_t suffix) = 0;
58 
62  virtual void reassemble(
63  std::unique_ptr<core::ContentObjectManifest> &&manifest) = 0;
64 
68  virtual void reInitialize() = 0;
69 
73  virtual void setIndexer(Indexer *indexer) { indexer_verifier_ = indexer; }
74 
79  virtual bool reassembleUnverified() { return false; }
80 
81  protected:
85  virtual void notifyApplication();
86 
87  protected:
88  implementation::ConsumerSocket *reassembly_consumer_socket_;
89  TransportProtocol *transport_protocol_;
90  Indexer *indexer_verifier_;
91  std::unique_ptr<utils::MemBuf> read_buffer_;
92 };
93 
94 } // namespace protocol
95 
96 } // end namespace transport
transport::interface::ConsumerSocket
Main interface for consumer applications.
Definition: socket_consumer.h:48
transport::protocol::Reassembly::setIndexer
virtual void setIndexer(Indexer *indexer)
Definition: reassembly.h:73
transport::protocol::Reassembly::notifyApplication
virtual void notifyApplication()
transport::core::ContentObject
Definition: content_object.h:29
transport
Definition: forwarder_config.h:32
transport::protocol::Reassembly::reInitialize
virtual void reInitialize()=0
transport::protocol::Indexer
Definition: indexer.h:35
transport::protocol::TransportProtocol
Definition: transport_protocol.h:41
transport::protocol::Reassembly
Definition: reassembly.h:35
transport::protocol::Reassembly::ContentReassembledCallback
Definition: reassembly.h:37
transport::protocol::Reassembly::reassembleUnverified
virtual bool reassembleUnverified()
Definition: reassembly.h:79
utils::MemBuf
Definition: membuf.h:45
transport::protocol::Reassembly::reassemble
virtual void reassemble(core::ContentObject &content_object)=0