Home | History | Annotate | Download | only in cc
      1 /*
      2  * Copyright (c) 2017 VMware, Inc.
      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 #include "common.h"
     18 #include "table_storage_impl.h"
     19 
     20 namespace ebpf {
     21 
     22 using std::string;
     23 using std::unique_ptr;
     24 
     25 /// A filesystem backed table storage
     26 class BpfFsTableStorage : public TableStorageImpl {
     27  public:
     28   class iterator : public TableStorageIteratorImpl {
     29    public:
     30     virtual ~iterator() {}
     31     virtual unique_ptr<self_type> clone() const override;
     32     virtual self_type &operator++() override;
     33     virtual value_type &operator*() const override;
     34     virtual pointer operator->() const override;
     35   };
     36   virtual ~BpfFsTableStorage() {}
     37   virtual bool Find(const string &name, TableStorage::iterator &result) const override;
     38   virtual bool Insert(const string &name, TableDesc &&desc) override;
     39   virtual bool Delete(const string &name) override;
     40   virtual unique_ptr<TableStorageIteratorImpl> begin() override;
     41   virtual unique_ptr<TableStorageIteratorImpl> end() override;
     42   virtual unique_ptr<TableStorageIteratorImpl> lower_bound(const string &k) override;
     43   virtual unique_ptr<TableStorageIteratorImpl> upper_bound(const string &k) override;
     44   virtual unique_ptr<TableStorageIteratorImpl> erase(const TableStorageIteratorImpl &it) override;
     45 
     46  private:
     47 };
     48 
     49 bool BpfFsTableStorage::Find(const string &name, TableStorage::iterator &result) const {
     50   return false;
     51 }
     52 
     53 bool BpfFsTableStorage::Insert(const string &name, TableDesc &&desc) { return false; }
     54 
     55 bool BpfFsTableStorage::Delete(const string &name) { return false; }
     56 
     57 unique_ptr<TableStorageIteratorImpl> BpfFsTableStorage::begin() { return unique_ptr<iterator>(); }
     58 unique_ptr<TableStorageIteratorImpl> BpfFsTableStorage::end() { return unique_ptr<iterator>(); }
     59 unique_ptr<TableStorageIteratorImpl> BpfFsTableStorage::lower_bound(const string &k) {
     60   return unique_ptr<iterator>();
     61 }
     62 unique_ptr<TableStorageIteratorImpl> BpfFsTableStorage::upper_bound(const string &k) {
     63   return unique_ptr<iterator>();
     64 }
     65 unique_ptr<TableStorageIteratorImpl> BpfFsTableStorage::erase(const TableStorageIteratorImpl &it) {
     66   return unique_ptr<iterator>();
     67 }
     68 
     69 unique_ptr<TableStorage> createBpfFsTableStorage() {
     70   auto t = make_unique<TableStorage>();
     71   t->Init(make_unique<BpfFsTableStorage>());
     72   return t;
     73 }
     74 
     75 }  // namespace ebpf
     76