#include <Security/SecLogging.h>
#include "securityd_client.h"
#include "SecuritydXPC.h"
#include <os/activity.h>
static bool dict_to_error_request(enum SecXPCOperation op, CFDictionaryRef query, CFErrorRef *error)
{
return securityd_send_sync_and_do(op, error, ^bool(xpc_object_t message, CFErrorRef *error) {
return SecXPCDictionarySetPList(message, kSecXPCKeyQuery, query, error);
}, NULL);
}
static CFDictionaryRef void_to_dict_error_request(enum SecXPCOperation op, CFErrorRef *error) {
__block CFDictionaryRef dict = NULL;
securityd_send_sync_and_do(op, error, NULL, ^bool(xpc_object_t response, CFErrorRef *error) {
return (dict = SecXPCDictionaryCopyPList(response, kSecXPCKeyResult, error));
});
return dict;
}
CFArrayRef SecGetCurrentServerLoggingInfo(CFErrorRef *error)
{
__block CFArrayRef result;
os_activity_initiate("SecGetCurrentServerLoggingInfo", OS_ACTIVITY_FLAG_DEFAULT, ^{
result = SECURITYD_XPC(sec_get_log_settings, void_to_dict_error_request, error);
});
return result;
}
bool SecSetLoggingInfoForXPCScope(CFPropertyListRef settings, CFErrorRef *error)
{
__block bool result;
os_activity_initiate("SecSetLoggingInfoForXPCScope", OS_ACTIVITY_FLAG_DEFAULT, ^{
result = SECURITYD_XPC(sec_set_xpc_log_settings, dict_to_error_request, settings, error);
});
return result;
}
bool SecSetLoggingInfoForCircleScope(CFPropertyListRef settings, CFErrorRef *error)
{
__block bool result;
os_activity_initiate("SecSetLoggingInfoForCircleScope", OS_ACTIVITY_FLAG_DEFAULT, ^{
result = SECURITYD_XPC(sec_set_circle_log_settings, dict_to_error_request, settings, error);
});
return result;
}