11#include <boost/shared_ptr.hpp>
12#include <boost/multi_index_container.hpp>
13#include <boost/multi_index/hashed_index.hpp>
14#include <boost/multi_index/ordered_index.hpp>
15#include <boost/multi_index/mem_fun.hpp>
26typedef boost::shared_ptr<Api>
ApiPtr;
37 Api(
const std::string& name,
const std::string& access,
117typedef boost::multi_index_container<
120 boost::multi_index::indexed_by<
122 boost::multi_index::hashed_unique<
123 boost::multi_index::tag<ApiNameIndexTag>,
124 boost::multi_index::const_mem_fun<Api, std::string, &Api::getName>
127 boost::multi_index::ordered_non_unique<
128 boost::multi_index::tag<ApiAccessIndexTag>,
129 boost::multi_index::const_mem_fun<Api, std::string, &Api::getAccess>
132 boost::multi_index::hashed_non_unique<
133 boost::multi_index::tag<ApiHookIndexTag>,
134 boost::multi_index::const_mem_fun<Api, std::string, &Api::getHook>
146extern std::set<std::string>
apiHooks;
Command from the API class.
std::string name_
The command name.
std::string hook_
The name of the hook which registers the command (may not be set).
std::string getAccess() const
Returns the command access.
static ApiPtr getApiByName(const std::string &name)
Lookup in the table.
void setAccess(const std::string &access)
Set the command access.
void setHook(const std::string &hook)
Set the command hook name.
std::string getHook() const
Returns the command hook name.
std::string getName() const
Returns the command name.
static void parse(data::ConstElementPtr cfg, bool others=false)
Parse a command config.
std::string access_
The command access (read or write).
virtual ~Api()=default
Destructor.
static void fillApiTable(const std::string &dirname)
Fill the API command table.
Api(const std::string &name, const std::string &access, const std::string &hook)
Constructor.
boost::shared_ptr< const Element > ConstElementPtr
set< string > apiHooks
The API hook list.
boost::shared_ptr< Api > ApiPtr
Type of shared pointer to Api.
ApiTable apiTable
The API command table.
set< string > apiAccesses
The API access list (should be "read" and "write").
boost::multi_index_container< ApiPtr, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag< ApiNameIndexTag >, boost::multi_index::const_mem_fun< Api, std::string, &Api::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ApiAccessIndexTag >, boost::multi_index::const_mem_fun< Api, std::string, &Api::getAccess > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< ApiHookIndexTag >, boost::multi_index::const_mem_fun< Api, std::string, &Api::getHook > > > > ApiTable
The type of the API command table.
Defines the logger used by the top-level component of kea-lfc.
A tag for accessing access index.
A tag for accessing hook index.
A tag for accessing name index.