Home | History | Annotate | Download | only in libpdx

Lines Matching defs:Message

20 Message::Message() : replied_(true) {}
22 Message::Message(const MessageInfo& info)
33 // means we have to manually implement the desired move semantics for Message.
34 Message::Message(Message&& other) { *this = std::move(other); }
36 Message& Message::operator=(Message&& other) {
49 Message::~Message() { Destroy(); }
51 void Message::Destroy() {
56 "ERROR: Service \"%s\" failed to reply to message: op=%d pid=%d "
68 const std::uint8_t* Message::ImpulseBegin() const {
72 const std::uint8_t* Message::ImpulseEnd() const {
76 Status<size_t> Message::ReadVector(const struct iovec* vector,
78 PDX_TRACE_NAME("Message::ReadVector");
86 Status<void> Message::ReadVectorAll(const struct iovec* vector,
88 PDX_TRACE_NAME("Message::ReadVectorAll");
105 Status<size_t> Message::Read(void* buffer, size_t length) {
106 PDX_TRACE_NAME("Message::Read");
115 Status<size_t> Message::WriteVector(const struct iovec* vector,
117 PDX_TRACE_NAME("Message::WriteVector");
125 Status<void> Message::WriteVectorAll(const struct iovec* vector,
127 PDX_TRACE_NAME("Message::WriteVector");
144 Status<size_t> Message::Write(const void* buffer, size_t length) {
145 PDX_TRACE_NAME("Message::Write");
154 Status<FileReference> Message::PushFileHandle(const LocalHandle& handle) {
155 PDX_TRACE_NAME("Message::PushFileHandle");
163 Status<FileReference> Message::PushFileHandle(const BorrowedHandle& handle) {
164 PDX_TRACE_NAME("Message::PushFileHandle");
172 Status<FileReference> Message::PushFileHandle(const RemoteHandle& handle) {
173 PDX_TRACE_NAME("Message::PushFileHandle");
181 Status<ChannelReference> Message::PushChannelHandle(
183 PDX_TRACE_NAME("Message::PushChannelHandle");
191 Status<ChannelReference> Message::PushChannelHandle(
193 PDX_TRACE_NAME("Message::PushChannelHandle");
201 Status<ChannelReference> Message::PushChannelHandle(
203 PDX_TRACE_NAME("Message::PushChannelHandle");
211 bool Message::GetFileHandle(FileReference ref, LocalHandle* handle) {
212 PDX_TRACE_NAME("Message::GetFileHandle");
227 bool Message::GetChannelHandle(ChannelReference ref,
229 PDX_TRACE_NAME("Message::GetChannelHandle");
244 Status<void> Message::Reply(int return_code) {
245 PDX_TRACE_NAME("Message::Reply");
256 Status<void> Message::ReplyFileDescriptor(unsigned int fd) {
257 PDX_TRACE_NAME("Message::ReplyFileDescriptor");
268 Status<void> Message::ReplyError(unsigned int error) {
269 PDX_TRACE_NAME("Message::ReplyError");
281 Status<void> Message::Reply(const LocalHandle& handle) {
282 PDX_TRACE_NAME("Message::ReplyFileHandle");
299 Status<void> Message::Reply(const BorrowedHandle& handle) {
300 PDX_TRACE_NAME("Message::ReplyFileHandle");
317 Status<void> Message::Reply(const RemoteHandle& handle) {
318 PDX_TRACE_NAME("Message::ReplyFileHandle");
335 Status<void> Message::Reply(const LocalChannelHandle& handle) {
346 Status<void> Message::Reply(const BorrowedChannelHandle& handle) {
357 Status<void> Message::Reply(const RemoteChannelHandle& handle) {
368 Status<void> Message::ModifyChannelEvents(int clear_mask, int set_mask) {
369 PDX_TRACE_NAME("Message::ModifyChannelEvents");
378 Status<RemoteChannelHandle> Message::PushChannel(
380 PDX_TRACE_NAME("Message::PushChannel");
388 Status<RemoteChannelHandle> Message::PushChannel(
391 PDX_TRACE_NAME("Message::PushChannel");
395 Status<int> Message::CheckChannel(ChannelReference ref,
397 PDX_TRACE_NAME("Message::CheckChannel");
405 Status<int> Message::CheckChannel(const Service* service, ChannelReference ref,
407 PDX_TRACE_NAME("Message::CheckChannel");
411 pid_t Message::GetProcessId() const { return info_.pid; }
413 pid_t Message::GetThreadId() const { return info_.tid; }
415 uid_t Message::GetEffectiveUserId() const { return info_.euid; }
417 gid_t Message::GetEffectiveGroupId() const { return info_.egid; }
419 int Message::GetChannelId() const { return info_.cid; }
421 int Message::GetMessageId() const { return info_.mid; }
423 int Message::GetOp() const { return info_.op; }
425 int Message::GetFlags() const { return info_.flags; }
427 size_t Message::GetSendLength() const { return info_.send_len; }
429 size_t Message::GetReceiveLength() const { return info_.recv_len; }
431 size_t Message::GetFileDescriptorCount() const { return info_.fd_count; }
433 std::shared_ptr<Channel> Message::GetChannel() const { return channel_.lock(); }
435 Status<void> Message::SetChannel(const std::shared_ptr<Channel>& chan) {
443 std::shared_ptr<Service> Message::GetService() const { return service_.lock(); }
445 const MessageInfo& Message::GetInfo() const { return info_; }
472 std::shared_ptr<Channel> Service::OnChannelOpen(Message& /*message*/) {
476 void Service::OnChannelClose(Message& /*message*/,
534 Message* message, int flags, const std::shared_ptr<Channel>& channel,
542 endpoint_->PushChannel(message, flags, channel.get(), &channel_id_temp);
554 Status<int> Service::CheckChannel(const Message* message, ChannelReference ref,
566 message, ref, channel ? &channel_context : nullptr);
579 Status<void> Service::HandleMessage(Message& message) {
580 return DefaultHandleMessage(message);
583 void Service::HandleImpulse(Message& /*impulse*/) {}
585 Status<void> Service::HandleSystemMessage(Message& message) {
586 const MessageInfo& info = message.GetInfo();
592 message.SetChannel(OnChannelOpen(message));
593 return message.Reply(0);
599 OnChannelClose(message, Channel::GetFromMessageInfo(info));
600 message.SetChannel(nullptr);
601 return message.Reply(0);
609 return message.Reply(0);
614 auto response = DumpState(message.GetReceiveLength());
615 const size_t response_size = response.size() < message.GetReceiveLength()
617 : message.GetReceiveLength();
619 message.Write(response.data(), response_size);
621 return message.ReplyError(EIO);
623 return message.Reply(status);
631 Status<void> Service::DefaultHandleMessage(Message& message) {
632 const MessageInfo& info = message.GetInfo();
642 return HandleSystemMessage(message);
645 return message.ReplyError(EOPNOTSUPP);
652 Message message;
653 const auto status = endpoint_->MessageReceive(&message);
655 ALOGE("Failed to receive message: %s\n", status.GetErrorMessage().c_str());
659 std::shared_ptr<Service> service = message.GetService();
664 endpoint_->MessageReply(&message, -EINVAL);
668 if (message.IsImpulse()) {
669 service->HandleImpulse(message);
671 } else if (service->HandleSystemMessage(message)) {
674 return service->HandleMessage(message);