harmony 鸿蒙ipc_cparcel.h

  • 2025-06-12
  • 浏览 (5)

ipc_cparcel.h

Overview

Provides C interfaces for IPC serialization and deserialization.

Library: libipc_capi.so

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Related module: OHIPCParcel

Summary

Types

Name Description
typedef void *(* OH_IPC_MemAllocator) (int32_t len) Defines the type of a memory allocation function.

Functions

Name Description
OHIPCParcel * OH_IPCParcel_Create (void) Creates an OHIPCParcel object, which cannot exceed 204,800 bytes.
void OH_IPCParcel_Destroy (OHIPCParcel *parcel) Destroys an OHIPCParcel object.
int OH_IPCParcel_GetDataSize (const OHIPCParcel *parcel) Obtains the size of the data contained in an OHIPCParcel object.
int OH_IPCParcel_GetWritableBytes (const OHIPCParcel *parcel) Obtains the number of bytes that can be written to an OHIPCParcel object.
int OH_IPCParcel_GetReadableBytes (const OHIPCParcel *parcel) Obtains the number of bytes that can be read from an OHIPCParcel object.
int OH_IPCParcel_GetReadPosition (const OHIPCParcel *parcel) Obtains the position where data is read in an OHIPCParcel object.
int OH_IPCParcel_GetWritePosition (const OHIPCParcel *parcel) Obtains the position where data is written in an OHIPCParcel object.
int OH_IPCParcel_RewindReadPosition (OHIPCParcel *parcel, uint32_t newReadPos) Resets the position to read data in an OHIPCParcel object.
int OH_IPCParcel_RewindWritePosition (OHIPCParcel *parcel, uint32_t newWritePos) Resets the position to write data in an OHIPCParcel object.
int OH_IPCParcel_WriteInt8 (OHIPCParcel *parcel, int8_t value) Writes an int8_t value to an OHIPCParcel object.
int OH_IPCParcel_ReadInt8 (const OHIPCParcel *parcel, int8_t *value) Reads an int8_t value from an OHIPCParcel object.
int OH_IPCParcel_WriteInt16 (OHIPCParcel *parcel, int16_t value) Writes an int16_t value to an OHIPCParcel object.
int OH_IPCParcel_ReadInt16 (const OHIPCParcel *parcel, int16_t *value) Reads an int16_t value from an OHIPCParcel object.
int OH_IPCParcel_WriteInt32 (OHIPCParcel *parcel, int32_t value) Writes an int32_t value to an OHIPCParcel object.
int OH_IPCParcel_ReadInt32 (const OHIPCParcel *parcel, int32_t *value) Reads an int32_t value from an OHIPCParcel object.
int OH_IPCParcel_WriteInt64 (OHIPCParcel *parcel, int64_t value) Writes an int64_t value to an OHIPCParcel object.
int OH_IPCParcel_ReadInt64 (const OHIPCParcel *parcel, int64_t *value) Reads an int64_t value from an OHIPCParcel object.
int OH_IPCParcel_WriteFloat (OHIPCParcel *parcel, float value) Writes a float value to an OHIPCParcel object.
int OH_IPCParcel_ReadFloat (const OHIPCParcel *parcel, float *value) Reads a float value from an OHIPCParcel object.
int OH_IPCParcel_WriteDouble (OHIPCParcel *parcel, double value) Writes a double value to an OHIPCParcel object.
int OH_IPCParcel_ReadDouble (const OHIPCParcel *parcel, double *value) Reads a double value from an OHIPCParcel object.
int OH_IPCParcel_WriteString (OHIPCParcel *parcel, const char *str) Writes a string including a string terminator to an OHIPCParcel object.
const char * OH_IPCParcel_ReadString (const OHIPCParcel *parcel) Reads a string from an OHIPCParcel object. You can obtain the length of the string from strlen.
int OH_IPCParcel_WriteBuffer (OHIPCParcel *parcel, const uint8_t *buffer, int32_t len) Writes data of the specified length from the memory to an OHIPCParcel object.
const uint8_t * OH_IPCParcel_ReadBuffer (const OHIPCParcel *parcel, int32_t len) Reads memory information of the specified length from an OHIPCParcel object.
int OH_IPCParcel_WriteRemoteStub (OHIPCParcel *parcel, const OHIPCRemoteStub *stub) Writes an OHIPCRemoteStub object to an OHIPCParcel object.
OHIPCRemoteStub * OH_IPCParcel_ReadRemoteStub (const OHIPCParcel *parcel) Reads the OHIPCRemoteStub object from an OHIPCParcel object.
int OH_IPCParcel_WriteRemoteProxy (OHIPCParcel *parcel, const OHIPCRemoteProxy *proxy) Writes an OHIPCRemoteProxy object to an OHIPCParcel object.
OHIPCRemoteProxy * OH_IPCParcel_ReadRemoteProxy (const OHIPCParcel *parcel) Reads the OHIPCRemoteProxy object from an OHIPCParcel object.
int OH_IPCParcel_WriteFileDescriptor (OHIPCParcel *parcel, int32_t fd) Writes a file descriptor to an OHIPCParcel object.
int OH_IPCParcel_ReadFileDescriptor (const OHIPCParcel *parcel, int32_t *fd) Reads a file descriptor from an OHIPCParcel object.
int OH_IPCParcel_Append (OHIPCParcel *parcel, const OHIPCParcel *data) Appends data to an OHIPCParcel object.
int OH_IPCParcel_WriteInterfaceToken (OHIPCParcel *parcel, const char *token) Writes an interface token to an OHIPCParcel object for interface identity verification.
int OH_IPCParcel_ReadInterfaceToken (const OHIPCParcel *parcel, char **token, int32_t *len, OH_IPC_MemAllocator allocator) Reads an interface token from an OHIPCParcel object for interface identity verification.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙IPC Kit

harmony 鸿蒙IPC Kit

harmony 鸿蒙OH_IPC_MessageOption

harmony 鸿蒙OH_IPC_ErrorCode

harmony 鸿蒙OHIPCParcel

harmony 鸿蒙OHIPCRemoteObject

harmony 鸿蒙OHIPCSkeleton

harmony 鸿蒙RPC Error Codes

harmony 鸿蒙ipc_cremote_object.h

harmony 鸿蒙ipc_cskeleton.h

0  赞