13f4cbf05Sopenharmony_ci/*
23f4cbf05Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
33f4cbf05Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
43f4cbf05Sopenharmony_ci * you may not use this file except in compliance with the License.
53f4cbf05Sopenharmony_ci * You may obtain a copy of the License at
63f4cbf05Sopenharmony_ci *
73f4cbf05Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
83f4cbf05Sopenharmony_ci *
93f4cbf05Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
103f4cbf05Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
113f4cbf05Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123f4cbf05Sopenharmony_ci * See the License for the specific language governing permissions and
133f4cbf05Sopenharmony_ci * limitations under the License.
143f4cbf05Sopenharmony_ci */
153f4cbf05Sopenharmony_ci
163f4cbf05Sopenharmony_ci/**
173f4cbf05Sopenharmony_ci * @file flat_obj.h
183f4cbf05Sopenharmony_ci *
193f4cbf05Sopenharmony_ci * @brief Defines types and structures for reading and writing objects in parcels.
203f4cbf05Sopenharmony_ci *
213f4cbf05Sopenharmony_ci * Types are platform-sensitive. Structures are only used for checking the
223f4cbf05Sopenharmony_ci * validity of data in parcels, not for saving and using of data.
233f4cbf05Sopenharmony_ci */
243f4cbf05Sopenharmony_ci#ifndef UTILS_BASE_FLAT_OBJ_H
253f4cbf05Sopenharmony_ci#define UTILS_BASE_FLAT_OBJ_H
263f4cbf05Sopenharmony_ci
273f4cbf05Sopenharmony_ci#include <sys/types.h>
283f4cbf05Sopenharmony_ci
293f4cbf05Sopenharmony_ci#ifndef IOS_PLATFORM
303f4cbf05Sopenharmony_ci#include <linux/types.h>
313f4cbf05Sopenharmony_ci#else
323f4cbf05Sopenharmony_ci    typedef u_int32_t __u32;
333f4cbf05Sopenharmony_ci    typedef u_int64_t __u64;
343f4cbf05Sopenharmony_ci#endif
353f4cbf05Sopenharmony_ci
363f4cbf05Sopenharmony_ci#ifdef BINDER_IPC_32BIT
373f4cbf05Sopenharmony_ci    typedef __u32 binder_size_t;
383f4cbf05Sopenharmony_ci    typedef __u32 binder_uintptr_t;
393f4cbf05Sopenharmony_ci#else
403f4cbf05Sopenharmony_ci    typedef __u64 binder_size_t;
413f4cbf05Sopenharmony_ci    typedef __u64 binder_uintptr_t;
423f4cbf05Sopenharmony_ci#endif
433f4cbf05Sopenharmony_ci
443f4cbf05Sopenharmony_cistruct parcel_binder_object_header {
453f4cbf05Sopenharmony_ci    __u32 type;
463f4cbf05Sopenharmony_ci};
473f4cbf05Sopenharmony_cistruct parcel_flat_binder_object {
483f4cbf05Sopenharmony_ci    struct parcel_binder_object_header hdr;
493f4cbf05Sopenharmony_ci    __u32 flags;
503f4cbf05Sopenharmony_ci    union {
513f4cbf05Sopenharmony_ci        binder_uintptr_t binder;
523f4cbf05Sopenharmony_ci        __u32 handle;
533f4cbf05Sopenharmony_ci    };
543f4cbf05Sopenharmony_ci    binder_uintptr_t cookie;
553f4cbf05Sopenharmony_ci};
563f4cbf05Sopenharmony_ci
573f4cbf05Sopenharmony_ci#endif
58