Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
indexer.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 <hicn/transport/core/content_object.h>
19 #include <hicn/transport/core/interest.h>
20 #include <protocols/fec_utils.h>
21 
22 #include <set>
23 
24 namespace transport {
25 
26 namespace implementation {
27 class ConsumerSocket;
28 }
29 
30 namespace protocol {
31 
32 class Reassembly;
33 class TransportProtocol;
34 
35 class Indexer {
36  public:
37  static const constexpr uint32_t invalid_index =
38  (std::numeric_limits<uint32_t>::max() - 1);
39 
41 
42  virtual ~Indexer() = default;
43 
47  virtual uint32_t checkNextSuffix() = 0;
48  virtual uint32_t getNextSuffix() = 0;
49  virtual uint32_t getNextReassemblySegment() = 0;
50 
54  virtual void setFirstSuffix(uint32_t suffix) = 0;
55  virtual uint32_t getFirstSuffix() = 0;
56 
60  virtual void setNFec(uint32_t n_fec) = 0;
61  virtual uint32_t getNFec() = 0;
62  virtual void enableFec(fec::FECType fec_type) = 0;
63  virtual void disableFec() = 0;
64  virtual bool isFec(uint32_t index) { return false; }
65  virtual double getFecOverhead() { return 0.0; }
66  virtual double getMaxFecOverhead() { return 0.0; }
67 
71  virtual bool isFinalSuffixDiscovered() = 0;
72  virtual uint32_t getFinalSuffix() = 0;
73 
77  virtual void setReassembly(Reassembly *reassembly) {
78  reassembly_ = reassembly;
79  }
80 
84  virtual void setVerifier();
85 
92  virtual uint32_t jumpToIndex(uint32_t index) = 0;
93 
97  virtual void reset() = 0;
98 
102  virtual void onContentObject(core::Interest &interest,
103  core::ContentObject &content_object,
104  bool reassembly = true) = 0;
105 
106  protected:
108  TransportProtocol *transport_;
109  Reassembly *reassembly_;
110  std::shared_ptr<auth::Verifier> verifier_;
111 };
112 
113 } // end namespace protocol
114 
115 } // end namespace transport
transport::interface::ConsumerSocket
Main interface for consumer applications.
Definition: socket_consumer.h:48
transport::protocol::Indexer::jumpToIndex
virtual uint32_t jumpToIndex(uint32_t index)=0
transport::protocol::Indexer::checkNextSuffix
virtual uint32_t checkNextSuffix()=0
transport::protocol::Indexer::setVerifier
virtual void setVerifier()
transport::core::ContentObject
Definition: content_object.h:29
transport::core::Interest
Definition: interest.h:30
transport
Definition: forwarder_config.h:32
transport::protocol::Indexer
Definition: indexer.h:35
transport::protocol::Indexer::setReassembly
virtual void setReassembly(Reassembly *reassembly)
Definition: indexer.h:77
transport::protocol::TransportProtocol
Definition: transport_protocol.h:41
transport::protocol::Reassembly
Definition: reassembly.h:35
transport::protocol::Indexer::setNFec
virtual void setNFec(uint32_t n_fec)=0
transport::protocol::Indexer::setFirstSuffix
virtual void setFirstSuffix(uint32_t suffix)=0
transport::protocol::Indexer::isFinalSuffixDiscovered
virtual bool isFinalSuffixDiscovered()=0
transport::protocol::Indexer::onContentObject
virtual void onContentObject(core::Interest &interest, core::ContentObject &content_object, bool reassembly=true)=0
transport::protocol::Indexer::reset
virtual void reset()=0