1/*
2 * Copyright (c) 2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1.  Redistributions of source code must retain the above copyright
11 *     notice, this list of conditions and the following disclaimer.
12 * 2.  Redistributions in binary form must reproduce the above copyright
13 *     notice, this list of conditions and the following disclaimer in the
14 *     documentation and/or other materials provided with the distribution.
15 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of its
16 *     contributors may be used to endorse or promote products derived from
17 *     this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * Portions of this software have been released under the following terms:
31 *
32 * (c) Copyright 1989-1993 OPEN SOFTWARE FOUNDATION, INC.
33 * (c) Copyright 1989-1993 HEWLETT-PACKARD COMPANY
34 * (c) Copyright 1989-1993 DIGITAL EQUIPMENT CORPORATION
35 *
36 * To anyone who acknowledges that this file is provided "AS IS"
37 * without any express or implied warranty:
38 * permission to use, copy, modify, and distribute this file for any
39 * purpose is hereby granted without fee, provided that the above
40 * copyright notices and this notice appears in all source code copies,
41 * and that none of the names of Open Software Foundation, Inc., Hewlett-
42 * Packard Company or Digital Equipment Corporation be used
43 * in advertising or publicity pertaining to distribution of the software
44 * without specific, written prior permission.  Neither Open Software
45 * Foundation, Inc., Hewlett-Packard Company nor Digital
46 * Equipment Corporation makes any representations about the suitability
47 * of this software for any purpose.
48 *
49 * Copyright (c) 2007, Novell, Inc. All rights reserved.
50 * Redistribution and use in source and binary forms, with or without
51 * modification, are permitted provided that the following conditions
52 * are met:
53 *
54 * 1.  Redistributions of source code must retain the above copyright
55 *     notice, this list of conditions and the following disclaimer.
56 * 2.  Redistributions in binary form must reproduce the above copyright
57 *     notice, this list of conditions and the following disclaimer in the
58 *     documentation and/or other materials provided with the distribution.
59 * 3.  Neither the name of Novell Inc. nor the names of its contributors
60 *     may be used to endorse or promote products derived from this
61 *     this software without specific prior written permission.
62 *
63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
64 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
65 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
66 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
68 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
69 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
70 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
71 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
72 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73 *
74 * @APPLE_LICENSE_HEADER_END@
75 */
76
77/* ex: set shiftwidth=4 softtabstop=4 expandtab: */
78#ifndef _MSWRAPPERS_H_
79#define _MSWRAPPERS_H_
80
81#if defined(IDLBASE_H) && !defined(IDL_CHAR_IS_CHAR)
82#error Include mswrappers.h before including dce/idlbase.h
83#endif
84#define IDL_CHAR_IS_CHAR
85
86#include <stdint.h>
87
88#include <dce/idlbase.h>
89#include <dce/rpc.h>
90#define DCETHREAD_CHECKED
91#define DCETHREAD_USE_THROW
92#include <dce/dcethread.h>
93
94#ifdef __cplusplus
95extern "C" {
96#endif
97
98#if !defined(_wchar16_t_DEFINED)
99#define _wchar16_t_DEFINED
100typedef uint16_t wchar16_t;
101#endif
102
103#if !defined(_UCHAR_DEFINED)
104#define _UCHAR_DEFINED
105typedef uint8_t UCHAR;
106#endif
107
108#if !defined(_WCHAR_DEFINED)
109#define _WCHAR_DEFINED
110typedef wchar16_t WCHAR;
111#endif
112
113#if !defined(_DWORD_DEFINED)
114#define _DWORD_DEFINED
115typedef uint32_t DWORD;
116#endif
117
118#if !defined(_PWSTR_DEFINED)
119#define _PWSTR_DEFINED
120typedef WCHAR * PWSTR;
121#endif
122
123#if !defined(_PUCHAR_DEFINED)
124#define _PUCHAR_DEFINED
125typedef UCHAR * PUCHAR;
126#endif
127
128typedef unsigned int RPC_STATUS;
129typedef handle_t RPC_BINDING_HANDLE;
130typedef rpc_if_handle_t RPC_IF_HANDLE;
131typedef idl_uuid_t UUID;
132typedef rpc_mgr_proc_t RPC_MGR_EPV;
133typedef idl_ushort_int *RPC_WSTR;
134typedef rpc_auth_identity_handle_t RPC_AUTH_IDENTITY_HANDLE;
135
136#define RPC_C_PROTSEQ_MAX_REQS_DEFAULT rpc_c_protseq_max_reqs_default
137#define RPC_C_LISTEN_MAX_CALLS_DEFAULT rpc_c_listen_max_calls_default
138
139#define RpcTryExcept	DCETHREAD_TRY
140#define RpcExcept	DCETHREAD_CATCH_EXPR
141#define RpcEndExcept	DCETHREAD_ENDTRY
142#define RpcExceptionCode() RpcCompatExceptionToCode(DCETHREAD_EXC_CURRENT)
143
144RPC_STATUS RpcCompatExceptionToCode(dcethread_exc *exc);
145typedef RPC_STATUS (*RpcCompatReturnCodeFuncPtr)(void);
146RpcCompatReturnCodeFuncPtr RpcCompatReturnLater(RPC_STATUS value);
147
148//User programs put this inside of their type
149#define __RPC_USER
150
151RPC_STATUS RpcStringBindingComposeA(
152    /* [in] */ UCHAR *string_object_uuid,
153    /* [in] */ UCHAR *string_protseq,
154    /* [in] */ UCHAR *string_netaddr,
155    /* [in] */ UCHAR *string_endpoint,
156    /* [in] */ UCHAR *string_options,
157    /* [out] */ UCHAR **string_binding
158);
159
160RPC_STATUS RpcStringBindingComposeW(
161    /* [in] */ PWSTR string_object_uuid,
162    /* [in] */ PWSTR string_protseq,
163    /* [in] */ PWSTR string_netaddr,
164    /* [in] */ PWSTR string_endpoint,
165    /* [in] */ PWSTR string_options,
166    /* [out] */ PWSTR *string_binding
167);
168
169RPC_STATUS RpcBindingFromStringBindingA(
170    /* [in] */ UCHAR *string_binding,
171    /* [out] */ RPC_BINDING_HANDLE *binding_handle
172);
173
174RPC_STATUS RpcBindingFromStringBindingW(
175    /* [in] */ PWSTR string_binding,
176    /* [out] */ RPC_BINDING_HANDLE *binding_handle
177);
178
179RPC_STATUS RpcBindingSetAuthInfoA(
180    /* [in] */ RPC_BINDING_HANDLE binding_h,
181    /* [in] */ UCHAR* server_princ_name,
182    /* [in] */ DWORD authn_level,
183    /* [in] */ DWORD authn_protocol,
184    /* [in] */ RPC_AUTH_IDENTITY_HANDLE auth_identity,
185    /* [in] */ DWORD authz_protocol
186);
187
188RPC_STATUS RpcBindingSetAuthInfoW(
189    /* [in] */ RPC_BINDING_HANDLE binding_h,
190    /* [in] */ PWSTR server_princ_name,
191    /* [in] */ DWORD authn_level,
192    /* [in] */ DWORD authn_protocol,
193    /* [in] */ RPC_AUTH_IDENTITY_HANDLE auth_identity,
194    /* [in] */ DWORD authz_protocol
195);
196
197RPC_STATUS RpcStringFreeA(
198    /* [in, out] */ PUCHAR *string
199);
200
201RPC_STATUS RpcStringFreeW(
202    /* [in, out] */ PWSTR *string
203);
204
205RPC_STATUS RpcBindingFree(
206    /* [in, out] */ RPC_BINDING_HANDLE *binding_handle
207);
208
209RPC_STATUS RpcServerUseProtseqEpA(
210    /* [in] */ PUCHAR protseq,
211    /* [in] */ unsigned int max_call_requests,
212    /* [in] */ PUCHAR endpoint,
213    void *security /*not used*/
214);
215RPC_STATUS RpcServerUseProtseqEpW(
216    /* [in] */ PWSTR protseq,
217    /* [in] */ unsigned int max_call_requests,
218    /* [in] */ PWSTR endpoint,
219    void *security /*not used*/
220);
221
222RPC_STATUS RpcServerRegisterIf(
223    /* [in] */ RPC_IF_HANDLE if_spec,
224    /* [in] */ UUID *mgr_type_uuid,
225    /* [in] */ RPC_MGR_EPV *mgr_epv
226);
227
228RPC_STATUS RpcServerListen(
229    unsigned32 minimum_call_threads, /*not used*/
230    /* [in] */ unsigned32 max_calls_exec,
231    unsigned32 dont_wait /*not used*/
232);
233
234RPC_STATUS LwMapDCEStatusToWinerror(
235    RPC_STATUS dceStatus
236);
237
238#define RpcStringBindingCompose RpcStringBindingComposeA
239#define RpcServerUseProtseqEp RpcServerUseProtseqEpA
240#define RpcBindingFromStringBinding RpcBindingFromStringBindingA
241#define RpcStringFree RpcStringFreeA
242#define RpcBindingSetAuthInfo RpcBindingSetAuthInfoA
243#define RpcSsDestroyClientContext(x) rpc_ss_destroy_client_context((rpc_ss_context_t *)x)
244
245#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY rpc_c_protect_level_pkt_privacy
246
247#define RPC_C_AUTHN_GSS_NEGOTIATE   rpc_c_authn_gss_negotiate
248
249#define RPC_C_AUTHZ_NAME    rpc_c_authz_name
250
251#ifdef __cplusplus
252} //extern C
253#endif
254
255#endif // _MSWRAPPERS_H_
256