Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
DbusUserIdSenderIdCache.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2020 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * DbusUserIdSenderIdCache.h
21 *
22 * Created on: 21 Sep 2018
23 * Author: janosolah
24 */
25
26#ifndef IPCSERVICE_LIB_SOURCE_DBUSUSERIDSENDERIDCACHE_H_
27#define IPCSERVICE_LIB_SOURCE_DBUSUSERIDSENDERIDCACHE_H_
28
29#include <unordered_map>
30#include <mutex>
31
32#include <IIpcService.h>
33#include <IDbusUserIdSenderIdCache.h>
34#include "IpcVariantList.h"
35
36namespace AI_IPC
37{
38
39class IDbusPackageEntitlements;
40
42{
43public:
45 const std::shared_ptr<IDbusPackageEntitlements>& dbusPackageEntitlements );
47
48 void nameChanged(const AI_IPC::VariantList& args);
49
50public: // IDbusUserIdSenderIdCache
51 virtual void addSenderIUserId(const std::string& senderId, uid_t userId) override;
52 virtual boost::optional<uid_t> getUserId(const std::string& senderId) const override;
53 virtual void removeUserId(const std::string& senderId) override;
54
55private:
56 std::unordered_map<std::string, uid_t> mSenderIdUserIdCache;
57 mutable std::mutex mMutex;
58 std::string mNameChangedSignalHandler;
59
60 // This object cannot exist without its parent
61 AI_IPC::IIpcService& mParentIpcService;
62
63 // This object is here to be able to notify it when the app is stopped, and also the app has been removed while it was running
64 // In this case the DbusPackageEntitlements object doesn't remove the cache entries related to the given appId, but will "wait"
65 // for a notification from the DbusUserIdSenderIdCache. Don't think it's necessary to implement the observer/notifier interface
66 // for this, as these objects are strictly internal to the IpcService object.
67 std::shared_ptr<IDbusPackageEntitlements> mDbusPackageEntitlements;
68};
69
70} // namespace AI_IPC
71
72
73
74#endif /* IPCSERVICE_LIB_SOURCE_DBUSUSERIDSENDERIDCACHE_H_ */
Definition DbusUserIdSenderIdCache.h:42
Definition IDbusUserIdSenderIdCache.h:36
IPC service that enables us to invoke remote method and emit signals as well as to handle incoming me...
Definition IIpcService.h:42