/*
 * SPDX-FileCopyrightText: 2004 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#ifndef TANGO_CLIENT_ACCESSPROXY_H
#define TANGO_CLIENT_ACCESSPROXY_H

#include <tango/client/DeviceProxy.h>
#include <tango/common/tango_const.h>

#include <map>
#include <string>
#include <vector>

namespace Tango
{

#define __AC_BUFFER_SIZE 1024

class AccessProxy : public Tango::DeviceProxy
{
  public:
    AccessProxy(const std::string &);
    AccessProxy(const char *);

    ~AccessProxy() override { }

    AccessControlType check_access_control(const std::string &);
    bool is_command_allowed(std::string &, const std::string &);

  protected:
    std::string user;
    std::vector<std::string> host_ips;
    bool forced;
    std::map<std::string, std::vector<std::string>> allowed_cmd_table;
    omni_mutex only_one;

    void get_allowed_commands(const std::string &, std::vector<std::string> &);

  private:
    void real_ctor();
};

} // namespace Tango

#endif /* TANGO_CLIENT_ACCESSPROXY_H */
