1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef SANDBOX_MAC_XPC_STUBS_HEADER_FRAGMENT_ 6#define SANDBOX_MAC_XPC_STUBS_HEADER_FRAGMENT_ 7 8#include <bsm/libbsm.h> 9#include <stddef.h> 10#include <stdint.h> 11 12#include "sandbox/sandbox_export.h" 13 14// Declare or include public types. 15#if !defined(MAC_OS_X_VERSION_10_7) || \ 16 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 17 18extern "C" { 19typedef void* xpc_object_t; 20} // extern "C" 21 22#else 23 24#include <xpc/xpc.h> 25 26#endif 27 28// Declare private types. 29extern "C" { 30typedef struct _xpc_pipe_s* xpc_pipe_t; 31} // extern "C" 32 33#if defined(MAC_OS_X_VERSION_10_7) && \ 34 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 35// Redeclare methods that only exist on 10.7+ to suppress 36// -Wpartial-availability warnings. 37extern "C" { 38XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 void 39xpc_dictionary_set_int64(xpc_object_t xdict, const char* key, int64_t value); 40 41XPC_EXPORT XPC_NONNULL1 void xpc_release(xpc_object_t object); 42 43XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL 44bool xpc_dictionary_get_bool(xpc_object_t xdict, const char* key); 45 46XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL int64_t 47xpc_dictionary_get_int64(xpc_object_t xdict, const char* key); 48 49XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL 50const char* xpc_dictionary_get_string(xpc_object_t xdict, const char* key); 51 52XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL uint64_t 53xpc_dictionary_get_uint64(xpc_object_t xdict, const char* key); 54 55XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 void 56xpc_dictionary_set_uint64(xpc_object_t xdict, const char* key, uint64_t value); 57 58XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 59void xpc_dictionary_set_string(xpc_object_t xdict, const char* key, 60 const char* string); 61 62XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t 63xpc_dictionary_create(const char* const* keys, 64 const xpc_object_t* values, 65 size_t count); 66XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT XPC_NONNULL_ALL 67 xpc_object_t 68 xpc_dictionary_create_reply(xpc_object_t original); 69 70XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 XPC_NONNULL2 71xpc_object_t xpc_dictionary_get_value(xpc_object_t xdict, const char* key); 72 73XPC_EXPORT XPC_MALLOC XPC_WARN_RESULT XPC_NONNULL1 74char* xpc_copy_description(xpc_object_t object); 75} // extern "C" 76#endif 77 78#endif // SANDBOX_MAC_XPC_STUBS_HEADER_FRAGMENT_ 79