1 /*
2 * Copyright (C) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "message_parcel.h"
17
18 #include "iremote_object.h"
19
20 namespace OHOS {
MessageParcel()21 MessageParcel::MessageParcel()
22 : Parcel(),
23 writeRawDataFd_(-1),
24 readRawDataFd_(-1),
25 kernelMappedWrite_(nullptr),
26 kernelMappedRead_(nullptr),
27 rawData_(nullptr),
28 rawDataSize_(0)
29 {}
30
MessageParcel(Allocator * allocator)31 MessageParcel::MessageParcel(Allocator *allocator)
32 : Parcel(allocator),
33 writeRawDataFd_(-1),
34 readRawDataFd_(-1),
35 kernelMappedWrite_(nullptr),
36 kernelMappedRead_(nullptr),
37 rawData_(nullptr),
38 rawDataSize_(0)
39 {}
40
~MessageParcel()41 MessageParcel::~MessageParcel()
42 {
43 }
44
45
46 #ifndef CONFIG_IPC_SINGLE
WriteDBinderProxy(const sptr<IRemoteObject> & object,uint32_t handle,uint64_t stubIndex)47 bool MessageParcel::WriteDBinderProxy(const sptr<IRemoteObject> &object, uint32_t handle, uint64_t stubIndex)
48 {
49 (void)object;
50 (void)handle;
51 (void)stubIndex;
52 return false;
53 }
54 #endif
55
WriteRemoteObject(const sptr<IRemoteObject> & object)56 bool MessageParcel::WriteRemoteObject(const sptr<IRemoteObject> &object)
57 {
58 (void)object;
59 return false;
60 }
61
ReadRemoteObject()62 sptr<IRemoteObject> MessageParcel::ReadRemoteObject()
63 {
64 return nullptr;
65 }
66
WriteFileDescriptor(int fd)67 bool MessageParcel::WriteFileDescriptor(int fd)
68 {
69 return false;
70 }
71
ReadFileDescriptor()72 int MessageParcel::ReadFileDescriptor()
73 {
74 return -1;
75 }
76
ClearFileDescriptor()77 void MessageParcel::ClearFileDescriptor()
78 {
79 }
80
ContainFileDescriptors() const81 bool MessageParcel::ContainFileDescriptors() const
82 {
83 return false;
84 }
85
WriteInterfaceToken(std::u16string name)86 bool MessageParcel::WriteInterfaceToken(std::u16string name)
87 {
88 (void)name;
89 return false;
90 }
91
ReadInterfaceToken()92 std::u16string MessageParcel::ReadInterfaceToken()
93 {
94 return u"";
95 }
96
WriteRawData(const void * data,size_t size)97 bool MessageParcel::WriteRawData(const void *data, size_t size)
98 {
99 (void)data;
100 (void)size;
101 return false;
102 }
103
RestoreRawData(std::shared_ptr<char> rawData,size_t size)104 bool MessageParcel::RestoreRawData(std::shared_ptr<char> rawData, size_t size)
105 {
106 (void)rawData;
107 (void)size;
108 return false;
109 }
110
ReadRawData(size_t size)111 const void *MessageParcel::ReadRawData(size_t size)
112 {
113 (void)size;
114 return nullptr;
115 }
116
GetRawData() const117 const void *MessageParcel::GetRawData() const
118 {
119 return nullptr;
120 }
121
GetRawDataSize() const122 size_t MessageParcel::GetRawDataSize() const
123 {
124 return -1;
125 }
126
GetRawDataCapacity() const127 size_t MessageParcel::GetRawDataCapacity() const
128 {
129 return -1;
130 }
131
WriteNoException()132 void MessageParcel::WriteNoException()
133 {
134 }
135
ReadException()136 int32_t MessageParcel::ReadException()
137 {
138 return -1;
139 }
140 } // namespace OHOS
141