/*1* Copyright (c) 2009 Kungliga Tekniska H�gskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Portions Copyright (c) 2009 Apple Inc. All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10*11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13*14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17*18* 3. Neither the name of the Institute nor the names of its contributors19* may be used to endorse or promote products derived from this software20* without specific prior written permission.21*22* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND23* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE24* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE25* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE26* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL27* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS28* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)29* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT30* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY31* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF32* SUCH DAMAGE.33*/3435#include <asn1-common.h>3637typedef struct heim_ipc *heim_ipc;38typedef struct heim_sipc *heim_sipc;39typedef struct heim_icred *heim_icred;40typedef struct heim_isemaphore *heim_isemaphore;41typedef struct heim_octet_string heim_idata;42typedef struct heim_sipc_call *heim_sipc_call;4344/* common */4546void47heim_ipc_free_cred(heim_icred);4849uid_t50heim_ipc_cred_get_uid(heim_icred);5152gid_t53heim_ipc_cred_get_gid(heim_icred);5455pid_t56heim_ipc_cred_get_pid(heim_icred);5758pid_t59heim_ipc_cred_get_session(heim_icred);6061void62heim_ipc_main(void);6364heim_isemaphore65heim_ipc_semaphore_create(long);6667long68heim_ipc_semaphore_wait(heim_isemaphore, time_t);6970long71heim_ipc_semaphore_signal(heim_isemaphore);7273void74heim_ipc_semaphore_release(heim_isemaphore);7576#define HEIM_IPC_WAIT_FOREVER ((time_t)-1)7778void79heim_ipc_free_data(heim_idata *);8081/* client */8283int84heim_ipc_init_context(const char *, heim_ipc *);8586void87heim_ipc_free_context(heim_ipc);8889int90heim_ipc_call(heim_ipc, const heim_idata *, heim_idata *, heim_icred *);9192int93heim_ipc_async(heim_ipc, const heim_idata *, void *, void (*func)(void *, int, heim_idata *, heim_icred));9495/* server */9697#define HEIM_SIPC_TYPE_IPC 198#define HEIM_SIPC_TYPE_UINT32 299#define HEIM_SIPC_TYPE_HTTP 4100101typedef void102(*heim_ipc_complete)(heim_sipc_call, int, heim_idata *);103104typedef void105(*heim_ipc_callback)(void *, const heim_idata *,106const heim_icred, heim_ipc_complete, heim_sipc_call);107108109int110heim_sipc_launchd_mach_init(const char *, heim_ipc_callback,111void *, heim_sipc *);112113int114heim_sipc_stream_listener(int, int, heim_ipc_callback,115void *, heim_sipc *);116117int118heim_sipc_service_unix(const char *, heim_ipc_callback,119void *, heim_sipc *);120121122void123heim_sipc_timeout(time_t);124125void126heim_sipc_set_timeout_handler(void (*)(void));127128void129heim_sipc_free_context(heim_sipc);130131132