Home | History | Annotate | Download | only in mac
      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 
     18 extern "C" {
     19 typedef void* xpc_object_t;
     20 }  // extern "C"
     21 
     22 #else
     23 
     24 #include <xpc/xpc.h>
     25 
     26 #endif
     27 
     28 // Declare private types.
     29 extern "C" {
     30 typedef 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.
     37 extern "C" {
     38 XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 void
     39 xpc_dictionary_set_int64(xpc_object_t xdict, const char* key, int64_t value);
     40 
     41 XPC_EXPORT XPC_NONNULL1 void xpc_release(xpc_object_t object);
     42 
     43 XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL
     44 bool xpc_dictionary_get_bool(xpc_object_t xdict, const char* key);
     45 
     46 XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL int64_t
     47 xpc_dictionary_get_int64(xpc_object_t xdict, const char* key);
     48 
     49 XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL
     50 const char* xpc_dictionary_get_string(xpc_object_t xdict, const char* key);
     51 
     52 XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL uint64_t
     53 xpc_dictionary_get_uint64(xpc_object_t xdict, const char* key);
     54 
     55 XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 void
     56 xpc_dictionary_set_uint64(xpc_object_t xdict, const char* key, uint64_t value);
     57 
     58 XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2
     59 void xpc_dictionary_set_string(xpc_object_t xdict, const char* key,
     60                                const char* string);
     61 
     62 XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t
     63 xpc_dictionary_create(const char* const* keys,
     64                       const xpc_object_t* values,
     65                       size_t count);
     66 XPC_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 
     70 XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 XPC_NONNULL2
     71 xpc_object_t xpc_dictionary_get_value(xpc_object_t xdict, const char* key);
     72 
     73 XPC_EXPORT XPC_MALLOC XPC_WARN_RESULT XPC_NONNULL1
     74 char* xpc_copy_description(xpc_object_t object);
     75 }  // extern "C"
     76 #endif
     77 
     78 #endif  // SANDBOX_MAC_XPC_STUBS_HEADER_FRAGMENT_
     79