1 // Copyright (C) 2019 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
2 // This Source Code Form is subject to the terms of the Mozilla Public
3 // License, v. 2.0. If a copy of the MPL was not distributed with this
4 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 
6 #ifndef VSOMEIP_V3_POLICY_MANAGER_HPP_
7 #define VSOMEIP_V3_POLICY_MANAGER_HPP_
8 
9 #include <memory>
10 
11 #include <vsomeip/primitive_types.hpp>
12 
13 namespace vsomeip_v3 {
14 
15 struct policy;
16 
17 class policy_manager {
18 public:
19     static std::shared_ptr<policy_manager> get();
20 
~policy_manager()21     virtual ~policy_manager() {};
22 
23     virtual std::shared_ptr<policy> create_policy() const = 0;
24     virtual void print_policy(const std::shared_ptr<policy> &_policy) const = 0;
25 
26     virtual bool parse_uid_gid(const byte_t* &_buffer, uint32_t &_buffer_size,
27             uint32_t &_uid, uint32_t &_gid) const = 0;
28     virtual bool parse_policy(const byte_t* &_buffer, uint32_t &_buffer_size,
29             uint32_t &_uid, uint32_t &_gid,
30             const std::shared_ptr<policy> &_policy) const = 0;
31 
32     virtual bool is_policy_update_allowed(uint32_t _uid, std::shared_ptr<policy> &_policy) const = 0;
33     virtual bool is_policy_removal_allowed(uint32_t _uid) const = 0;
34 };
35 
36 } // namespace vsomeip_v3
37 
38 #endif // VSOMEIP_V3_POLICY_MANAGER_HPP_
39