harmony 鸿蒙OHIPCSkeleton

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

OHIPCSkeleton

Overview

Provides C interfaces for managing the token IDs, credentials, process IDs (PIDs), user IDs (UIDs), and thread pool in the IPC framework.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Summary

Files

Name Description
ipc_cskeleton.h Provides C interfaces for managing the token IDs, credentials, process IDs (PIDs), user IDs (UIDs), and thread pool in the IPC framework.

Functions

Name Description
void OH_IPCSkeleton_JoinWorkThread (void) Joints this thread to the IPC worker thread pool.
void OH_IPCSkeleton_StopWorkThread (void) Stops this thread.
uint64_t OH_IPCSkeleton_GetCallingTokenId (void) Obtains the caller token ID. This API must be called in the IPC context. Otherwise, the token ID is returned.
uint64_t OH_IPCSkeleton_GetFirstTokenId (void) Obtains the token ID of the first caller.
uint64_t OH_IPCSkeleton_GetSelfTokenId (void) Obtains the local token ID.
uint64_t OH_IPCSkeleton_GetCallingPid (void) Obtains the caller PID. This API must be called in the IPC context. Otherwise, the current PID is returned.
uint64_t OH_IPCSkeleton_GetCallingUid (void) Obtains the caller UID. This API must be called in the IPC context. Otherwise, the current UID is returned.
int OH_IPCSkeleton_IsLocalCalling (void) Checks whether a local calling is being made.
int OH_IPCSkeleton_SetMaxWorkThreadNum (const int maxThreadNum) Sets the maximum number of worker threads.
int OH_IPCSkeleton_ResetCallingIdentity (char **identity, int32_t *len, OH_IPC_MemAllocator allocator) Resets the caller identity credential (including the token ID, UID, and PID) to that of this process and returns the caller credential information. The credential information is used in OH_IPCSkeleton_SetCallingIdentity.
int OH_IPCSkeleton_SetCallingIdentity (const char *identity) Sets the caller credential information to the IPC context.
int OH_IPCSkeleton_IsHandlingTransaction (void) Checks whether an IPC request is being handled.

Function Description

OH_IPCSkeleton_GetCallingPid()

uint64_t OH_IPCSkeleton_GetCallingPid (void)

Description

Obtains the caller PID. This API must be called in the IPC context. Otherwise, the current PID is returned.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Returns

Returns the caller PID.

OH_IPCSkeleton_GetCallingTokenId()

uint64_t OH_IPCSkeleton_GetCallingTokenId (void)

Description

Obtains the caller token ID. This API must be called in the IPC context. Otherwise, the token ID is returned.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Returns

Returns the caller token ID.

OH_IPCSkeleton_GetCallingUid()

uint64_t OH_IPCSkeleton_GetCallingUid (void)

Description

Obtains the caller UID. This API must be called in the IPC context. Otherwise, the current UID is returned.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Returns

Returns the caller UID.

OH_IPCSkeleton_GetFirstTokenId()

uint64_t OH_IPCSkeleton_GetFirstTokenId (void)

Description

Obtains the token ID of the first caller.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Returns

Returns the token ID of the first caller.

OH_IPCSkeleton_GetSelfTokenId()

uint64_t OH_IPCSkeleton_GetSelfTokenId (void)

Description

Obtains the local token ID.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Returns

Returns the local token ID.

OH_IPCSkeleton_IsHandlingTransaction()

int OH_IPCSkeleton_IsHandlingTransaction (void)

Description

Checks whether an IPC request is being handled.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Returns

Returns 1 if an IPC request is being handled; returns 0 otherwise.

OH_IPCSkeleton_IsLocalCalling()

int OH_IPCSkeleton_IsLocalCalling (void)

Description

Checks whether a local calling is being made.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Returns

Returns 1 if a local calling is in progress; returns 0 otherwise.

OH_IPCSkeleton_JoinWorkThread()

void OH_IPCSkeleton_JoinWorkThread (void)

Description

Joints this thread to the IPC worker thread pool.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

OH_IPCSkeleton_ResetCallingIdentity()

int OH_IPCSkeleton_ResetCallingIdentity (char ** identity, int32_t * len, OH_IPC_MemAllocator allocator)

Description

Resets the caller identity credential (including the token ID, UID, and PID) to that of this process and returns the caller credential information. The credential information is used in OH_IPCSkeleton_SetCallingIdentity.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Parameters

Name Description
identity Pointer to the address of the memory for holding the caller identity information. The memory is allocated by the allocator provided by the user and needs to be released. This pointer cannot be NULL.
len Pointer to the length of the data written to the identity. The value cannot be empty.
allocator Memory allocator specified by the user for allocating memory. This parameter cannot be empty.

Returns

Returns OH_IPC_ErrorCode#OH_IPC_SUCCESS if the operation is successful.

Returns OH_IPC_ErrorCode#OH_IPC_CHECK_PARAM_ERROR if incorrect parameters are detected.

Returns OH_IPC_ErrorCode#OH_IPC_MEM_ALLOCATOR_ERROR if memory allocation fails.

Returns OH_IPC_ErrorCode#OH_IPC_INNER_ERROR in other cases.

OH_IPCSkeleton_SetCallingIdentity()

int OH_IPCSkeleton_SetCallingIdentity (const char * identity)

Description

Sets the caller credential information to the IPC context.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Parameters

Name Description
identity Pointer to the caller credential, which cannot be empty. The value is returned by OH_IPCSkeleton_ResetCallingIdentity.

Returns

Returns OH_IPC_ErrorCode#OH_IPC_SUCCESS if the operation is successful.

Returns OH_IPC_ErrorCode#OH_IPC_CHECK_PARAM_ERROR if incorrect parameters are detected.

Returns OH_IPC_ErrorCode#OH_IPC_INNER_ERROR in other cases.

OH_IPCSkeleton_SetMaxWorkThreadNum()

int OH_IPCSkeleton_SetMaxWorkThreadNum (const int maxThreadNum)

Description

Sets the maximum number of worker threads.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

Parameters

Name Description
maxThreadNum Maximum number of worker threads.
Value range: [1, 32]
Default value: 16

Returns

Returns OH_IPC_ErrorCode#OH_IPC_SUCCESS if the operation is successful.

Returns OH_IPC_ErrorCode#OH_IPC_CHECK_PARAM_ERROR if incorrect parameters are detected.

Returns OH_IPC_ErrorCode#OH_IPC_INNER_ERROR in other cases.

OH_IPCSkeleton_StopWorkThread()

void OH_IPCSkeleton_StopWorkThread (void)

Description

Stops this thread.

System capability: SystemCapability.Communication.IPC.Core

Since: 12

你可能感兴趣的鸿蒙文章

harmony 鸿蒙IPC Kit

harmony 鸿蒙IPC Kit

harmony 鸿蒙OH_IPC_MessageOption

harmony 鸿蒙OH_IPC_ErrorCode

harmony 鸿蒙OHIPCParcel

harmony 鸿蒙OHIPCRemoteObject

harmony 鸿蒙RPC Error Codes

harmony 鸿蒙ipc_cparcel.h

harmony 鸿蒙ipc_cremote_object.h

harmony 鸿蒙ipc_cskeleton.h

0  赞