agent.h
Go to the documentation of this file.
/*
* Copyright © 2014 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef CORE_TRUST_AGENT_H_
#define CORE_TRUST_AGENT_H_
#include <core/trust/request.h>
#include <core/trust/tagged_integer.h>
#include <core/trust/visibility.h>
#include <cstdint>
namespace core
{
namespace trust
{
class CORE_TRUST_DLL_PUBLIC Agent
{
public:
Agent() = default;
virtual ~Agent() = default;
Agent(const Agent&) = delete;
Agent(Agent&&) = delete;
Agent& operator=(const Agent&) = delete;
Agent& operator=(Agent&&) = delete;
struct Registry
{
typedef std::shared_ptr<Registry> Ptr;
Registry() = default;
virtual ~Registry() = default;
virtual void register_agent_for_user(const core::trust::Uid& uid, const std::shared_ptr<core::trust::Agent>& agent) = 0;
virtual void unregister_agent_for_user(const core::trust::Uid& uid) = 0;
};
struct RequestParameters
{
struct
{
core::trust::Uid uid;
core::trust::Pid pid;
std::string id;
} application;
Feature feature;
std::string description;
};
virtual Request::Answer authenticate_request_with_parameters(const RequestParameters& parameters) = 0;
};
CORE_TRUST_DLL_PUBLIC bool operator==(const Agent::RequestParameters& lhs, const Agent::RequestParameters& rhs);
}
}
#endif // CORE_TRUST_AGENT_H_
core::trust::Agent::Registry
Abstracts functionality for storing agent instances and associating them with a user id...
Definition: agent.h:47
core::trust::Agent::RequestParameters::description
std::string description
An extended description that should be presented to the user on prompting.
Definition: agent.h:80
core::trust::Agent::RequestParameters::feature
Feature feature
The service-specific feature identifier.
Definition: agent.h:78
core::trust::Agent::RequestParameters::id
std::string id
The id of the requesting application.
Definition: agent.h:75
core::trust::Agent::RequestParameters::pid
core::trust::Pid pid
The process id of the requesting application.
Definition: agent.h:73
core
Definition: agent.h:28
core::trust::TaggedInteger< tag::Uid, uid_t >
core::trust::Agent::RequestParameters::uid
core::trust::Uid uid
The user id under which the requesting application runs.
Definition: agent.h:71
core::trust::Request::Answer
Answer
Enumerates the possible answers given by a user.
Definition: request.h:65
core::trust::Agent
Abstracts user-prompting functionality.
Definition: agent.h:33
core::trust::Agent::RequestParameters
Summarizes all parameters for processing a trust request.
Definition: agent.h:65
visibility.h
core::trust::operator==
CORE_TRUST_DLL_PUBLIC bool operator==(const Agent::RequestParameters &lhs, const Agent::RequestParameters &rhs)
Returns true iff lhs and rhs are equal.
tagged_integer.h
request.h
core::trust::Agent::Registry::Ptr
std::shared_ptr< Registry > Ptr
Convenience typedef for a shared ptr.
Definition: agent.h:50
CORE_TRUST_DLL_PUBLIC
#define CORE_TRUST_DLL_PUBLIC
Definition: visibility.h:26