summaryrefslogtreecommitdiffstats
path: root/chromeos/binder/transaction_status.h
blob: 088d1738c0f87a0a126f60e9882527c751a9c7e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_BINDER_TRANSACTION_STATUS_H_
#define CHROMEOS_BINDER_TRANSACTION_STATUS_H_

#include <stddef.h>
#include <stdint.h>

#include "base/macros.h"
#include "chromeos/binder/status.h"
#include "chromeos/binder/transaction_data.h"
#include "chromeos/chromeos_export.h"

namespace binder {

// TransactionData whose contents is a status code.
// Use this class to return an error for transactions.
// GetSenderPID() and GetSenderEUID() return 0.
class CHROMEOS_EXPORT TransactionStatus : public TransactionData {
 public:
  explicit TransactionStatus(Status status);
  ~TransactionStatus() override;

  // TransactionData override:
  uintptr_t GetCookie() const override;
  uint32_t GetCode() const override;
  pid_t GetSenderPID() const override;
  uid_t GetSenderEUID() const override;
  bool IsOneWay() const override;
  bool HasStatus() const override;
  Status GetStatus() const override;
  const void* GetData() const override;
  size_t GetDataSize() const override;
  const uintptr_t* GetObjectOffsets() const override;
  size_t GetNumObjectOffsets() const override;

 private:
  Status status_;
  DISALLOW_COPY_AND_ASSIGN(TransactionStatus);
};

}  // namespace binder

#endif  // CHROMEOS_BINDER_TRANSACTION_STATUS_H_