Function

es_new_client

Creates a new client instance and connect it to the Endpoint Security system.

Declaration

es_new_client_result_t es_new_client(es_client_t * _Nullable *client, es_handler_block_t handler);

Parameters

client

A pointer to receive the new client instance.

handler

The handler to run on all messages sent to this client.

Return Value

A result value indicating that indicates either success or the reason why client initialization failed.

Discussion

The handler block receives messages serially, and in the order the system delivers them. Returning control from the handler causes Endpoint Security to dequeue the next available message.

You can respond to a message out of order by returning control before calling one of the es_respond-prefixed functions. For out-of-order responding, your handler must copy the message with es_copy_message.

To create a client, your app must have the com.apple.developer.endpoint-security.client entitlement. The user also needs to approve your app with Transparency, Consent, and Control (TCC) mechanisms. The user does this in the Security and Privacy pane of System Preferences, by adding the app to Full Disk Access.

When you no longer need to receive Endpoint Security messages, destroy the client with es_delete_client to free resources.

See Also

Creating a Client

es_client_t

An opaque type that stores the Endpoint Security client state.

es_handler_block_t

A block that handles a message received from Endpoint Security.

es_new_client_result_t

The result of an attempt to create a new client.