2 * Copyright (c) 2017 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __VOM_TAP_INTERFACE_H__
17 #define __VOM_TAP_INTERFACE_H__
19 #include "vom/interface.hpp"
23 * A tap-interface. e.g. a tap interface
25 class tap_interface : public interface
28 tap_interface(const std::string& name,
31 route::prefix_t prefix);
33 tap_interface(const std::string& name,
36 route::prefix_t prefix,
37 const l2_address_t& l2_address);
40 tap_interface(const tap_interface& o);
43 * Return the matching 'singular instance' of the TAP interface
45 std::shared_ptr<tap_interface> singular() const;
49 * Class definition for listeners to OM events
51 class event_handler : public OM::listener, public inspect::command_handler
55 virtual ~event_handler() = default;
58 * Handle a populate event
60 void handle_populate(const client_db::key_t& key);
63 * Handle a replay event
68 * Show the object in the Singular DB
70 void show(std::ostream& os);
73 * Get the sortable Id of the listener
75 dependency_t order() const;
77 static event_handler m_evh;
82 route::prefix_t m_prefix;
87 l2_address_t m_l2_address;
90 * interface is a friend so it can construct with handles
92 friend class interface;
95 * Return the matching 'instance' of the sub-interface
96 * over-ride from the base class
98 std::shared_ptr<interface> singular_i() const;
101 * Virtual functions to construct an interface create commands.
103 virtual std::queue<cmd*>& mk_create_cmd(std::queue<cmd*>& cmds);
106 * Virtual functions to construct an interface delete commands.
108 virtual std::queue<cmd*>& mk_delete_cmd(std::queue<cmd*>& cmds);
111 * It's the OM class that call singular()
118 * fd.io coding-style-patch-verification: ON
121 * eval: (c-set-style "mozilla")