Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
SDBusAsyncReplySender.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 2019 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 // SDBusAsyncReplySender.h
21 // IpcService
22 //
23 //
24 
25 #ifndef SDBUSASYNCREPLYSENDER_H
26 #define SDBUSASYNCREPLYSENDER_H
27 
28 #include <IpcCommon.h>
29 
30 #include <memory>
31 #include <atomic>
32 
33 class SDBusIpcService;
34 
35 
37 {
38 public:
39  SDBusAsyncReplySender(const std::shared_ptr<SDBusIpcService> &ipcService,
40  uint32_t replyId,
41  const char *senderName,
42  uid_t senderUserId,
43  AI_IPC::VariantList &&args);
44  ~SDBusAsyncReplySender() final;
45 
46  AI_IPC::VariantList getMethodCallArguments() const override;
47 
48  bool sendReply(const AI_IPC::VariantList& replyArgs) override;
49 
50  uid_t getSenderUid() const override;
51  std::string getSenderName() const override;
52 
53 private:
54  std::weak_ptr<SDBusIpcService> mIpcService;
55 
56  bool mReplySent;
57  const uint32_t mReplyId;
58  const std::string mSenderName;
59  const AI_IPC::VariantList mArgs;
60  mutable std::atomic<uid_t> mSenderUid;
61 };
62 
63 
64 #endif // SDBUSASYNCREPLYSENDER_H
Helper class to send reply of a method call asynchronously.
Definition: IpcCommon.h:117
Definition: SDBusAsyncReplySender.h:37
AI_IPC::VariantList getMethodCallArguments() const override
Get method call arguments.
Definition: SDBusAsyncReplySender.cpp:75
uid_t getSenderUid() const override
Get Id of the user (unix user Id) who invoked the method.
Definition: SDBusAsyncReplySender.cpp:80
bool sendReply(const AI_IPC::VariantList &replyArgs) override
Send reply.
Definition: SDBusAsyncReplySender.cpp:56
std::string getSenderName() const override
Gets the unique name of the connection which originated this message.
Definition: SDBusAsyncReplySender.cpp:101
Definition: SDBusIpcService.h:53