trust-store 2.0.3
Provides a common implementation of a trust store to be used by trusted helpers.
request.h
Go to the documentation of this file.
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18
19#ifndef CORE_TRUST_REQUEST_H_
20#define CORE_TRUST_REQUEST_H_
21
24
25#include <cstdint>
26
27#include <chrono>
28#include <memory>
29#include <ostream>
30#include <string>
31
32namespace core
33{
34namespace trust
35{
36// Forward declarations
37class Agent;
38class Store;
39
55{
57 typedef std::chrono::system_clock::duration Duration;
59 typedef std::chrono::system_clock::time_point Timestamp;
60
62 static constexpr const unsigned int default_feature = 0;
63
65 enum class Answer : std::int32_t
66 {
67 denied,
68 granted,
69 };
70
72 std::string from;
79};
80
86CORE_TRUST_DLL_PUBLIC bool operator==(const Request& lhs, const Request& rhs);
87
94CORE_TRUST_DLL_PUBLIC std::ostream& operator<<(std::ostream& out, const Request::Answer& a);
95
102CORE_TRUST_DLL_PUBLIC std::ostream& operator<<(std::ostream& out, const Request& r);
103
122
178}
179}
180
181#endif // CORE_TRUST_REQUEST_H_
Abstracts user-prompting functionality.
Definition agent.h:34
Models read/write/query access to persisted trust requests.
Definition store.h:50
Contains functionality for implementing Ubuntu's trust model.
Definition agent.h:31
CORE_TRUST_DLL_PUBLIC Request::Answer process_trust_request(const RequestParameters &params)
Processes an incoming trust-request by an application, tries to lookup a previous reply before issuin...
CORE_TRUST_DLL_PUBLIC std::ostream & operator<<(std::ostream &out, const Request::Answer &a)
operator << pretty prints answers to the provided output stream.
TaggedInteger< tag::Feature, std::uint64_t > Feature
Our internal service-feature type.
TaggedInteger< tag::Uid, uid_t > Uid
Our internal user id type.
TaggedInteger< tag::Pid, pid_t > Pid
Our internal process id type.
CORE_TRUST_DLL_PUBLIC bool operator==(const Agent::RequestParameters &lhs, const Agent::RequestParameters &rhs)
Returns true iff lhs and rhs are equal.
Definition agent.h:29
Summarizes all parameters for processing a trust request.
Definition request.h:106
std::shared_ptr< Store > store
The trust store to be used for caching purposes.
Definition request.h:110
Feature feature
The service-specific feature identifier.
Definition request.h:118
core::trust::Uid application_uid
The user id under which the requesting application runs.
Definition request.h:112
std::string application_id
The id of the requesting application.
Definition request.h:116
std::shared_ptr< Agent > agent
The Agent implementation to dispatch a request to the user.
Definition request.h:108
core::trust::Pid application_pid
The process id of the requesting application.
Definition request.h:114
std::string description
An extended description that should be presented to the user on prompting.
Definition request.h:120
The Request struct encapsulates information about a trust request answered by the user.
Definition request.h:55
std::chrono::system_clock::duration Duration
Duration in wallclock time.
Definition request.h:57
static constexpr const unsigned int default_feature
Default feature identifier.
Definition request.h:62
std::string from
Definition request.h:72
Answer
Enumerates the possible answers given by a user.
Definition request.h:66
std::chrono::system_clock::time_point Timestamp
Requests are timestamped with wallclock time.
Definition request.h:59
#define CORE_TRUST_DLL_PUBLIC
Definition visibility.h:26