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/*
78**
79**  NAME:
80**
81**      rpcbase.idl
82**
83**  FACILITY:
84**
85**      Remote Procedure Call
86**
87**  ABSTRACT:
88**
89**  Base RPC types.
90**
91**
92*/
93
94[local] interface rpcbase
95{
96
97import "dce/lbase.idl";
98import "dce/rpctypes.idl";
99import "dce/iovector.idl";
100
101/*************************************************************************/
102/*************************  Common definitions  **************************/
103/*************************************************************************/
104
105/*
106 * Communications runtime status codes
107 */
108const long  rpc_s_ok                            = error_status_ok;
109
110/*
111 * Opaque pointer for those arguments which are pointers to
112 * internal structures.
113 */
114typedef struct
115{
116    unsigned32  dummy;
117} *rpc_opaque_ptr_t;
118
119/*
120 * Max call constants.
121 */
122const long  rpc_c_protseq_max_reqs_default  = 0;
123const long  rpc_c_listen_max_calls_default  = 10;
124
125/*
126 * RPC call semantics.
127 */
128const long  rpc_c_call_non_idempotent       = 0x00000000;
129const long  rpc_c_call_brdcst               = 0x00000001;
130const long  rpc_c_call_idempotent           = 0x00000002;
131const long  rpc_c_call_maybe                = 0x00000004;
132
133/*
134 * Binding timeout attribute.
135 */
136const long  rpc_c_binding_min_timeout       = 0;
137const long  rpc_c_binding_default_timeout   = 5;
138const long  rpc_c_binding_max_timeout       = 9;
139const long  rpc_c_binding_infinite_timeout  = 10;
140
141/*
142 * RPC protocol sequence ids
143 */
144const long  rpc_c_protseq_id_ncacn_ip_tcp   = 0;
145const long  rpc_c_protseq_id_ncacn_dnet_nsp = 1;
146const long  rpc_c_protseq_id_ncacn_osi_dna  = 2;
147const long  rpc_c_protseq_id_ncadg_ip_udp   = 3;
148const long  rpc_c_protseq_id_ncadg_dds      = 4;
149const long  rpc_c_protseq_id_ncalrpc        = 5;
150const long  rpc_c_protseq_id_ncacn_np       = 6;
151const long  rpc_c_protseq_id_ncacn_nb       = 7;
152
153const long  rpc_c_invalid_protseq_id        = -1;
154
155/*
156 * A transfer syntax representation. The transfer syntax values are
157 * architected.
158 */
159typedef struct
160{
161    idl_uuid_t                  id;
162    unsigned32              version;
163} rpc_syntax_id_t, *rpc_syntax_id_p_t;
164
165/*
166 * Procedural mashalling/unmarshalling entry point vector type definition.
167 */
168typedef void (*rpc_convert_proc_t)
169(
170);
171
172typedef rpc_convert_proc_t *rpc_convert_epv_t;
173
174typedef struct
175{
176    rpc_syntax_id_t         id;
177    unsigned32              index;
178    rpc_convert_epv_t       convert_epv;
179} rpc_transfer_syntax_t, *rpc_transfer_syntax_p_t;
180
181/*
182 * An opaque binding handle.
183 */
184typedef handle_t rpc_binding_handle_t;
185
186/*
187 * An opaque call handle for use during an RPC call.
188 */
189typedef rpc_opaque_ptr_t    rpc_call_handle_t, *rpc_call_handle_p_t;
190
191/*
192 * An opaque client handle to be passed to the server stub. It
193 * identifies a client address space or thread of execution.
194 */
195typedef rpc_opaque_ptr_t    rpc_client_handle_t, *rpc_client_handle_p_t;
196
197/*
198 * A vector of binding handles.
199 */
200typedef struct
201{
202    unsigned32              count;
203    rpc_binding_handle_t    binding_h[1];   /* count_is=count */
204} rpc_binding_vector_t, *rpc_binding_vector_p_t;
205
206/*
207 * A vector of RPC protocol sequences.
208 */
209typedef struct
210{
211    unsigned32              count;
212    unsigned_char_p_t       protseq[1];   /* count_is=count */
213} rpc_protseq_vector_t, *rpc_protseq_vector_p_t;
214
215/*
216 * Opaque interface handle representing the interface being used.
217 */
218typedef rpc_opaque_ptr_t    rpc_if_handle_t, *rpc_if_handle_p_t;
219
220/*
221 * A vector of interface handles.
222 */
223typedef struct
224{
225    unsigned32              count;
226    rpc_if_handle_t         if_spec[1];   /* count_is=count */
227} rpc_if_handle_vector_t, *rpc_if_handle_vector_p_t;
228
229/*
230 * Manager entry point vector type definitions
231 */
232typedef void (*rpc_mgr_proc_t)
233(
234);
235
236typedef rpc_mgr_proc_t *rpc_mgr_epv_t;
237
238/*
239 * Version 2 (NCS 2.0) server stub and stub EPV
240 */
241typedef void (*rpc_v2_server_stub_proc_t)
242(
243    [in]        handle_t                binding_handle,
244    [in]        rpc_call_handle_t       call_handle,
245    [in]        rpc_iovector_elt_p_t    in_call_args,
246    [in]        ndr_format_p_t          remote_ndr_fmt,
247    [in]        rpc_transfer_syntax_p_t xfer_syntax,
248    [in]        rpc_mgr_epv_t           mgr_epv,
249    [out]       unsigned32              *st
250);
251
252typedef rpc_v2_server_stub_proc_t *rpc_v2_server_stub_epv_t;
253
254/*
255 * A pointer to the liveness rundown routine.
256 */
257typedef void (*rpc_network_rundown_fn_t)
258(
259    [in]        rpc_client_handle_t     client_h
260);
261
262/*************************************************************************/
263/******************  Management Services definitions  ********************/
264/*************************************************************************/
265
266/*
267 * Cancel timeout attribute
268 */
269const long  rpc_c_cancel_infinite_timeout   = -1;
270
271/*
272 * Authorization routine for processing remote calls to the server's
273 * management routines.
274 */
275
276typedef boolean32 (*rpc_mgmt_authorization_fn_t)
277(
278    [in]        rpc_binding_handle_t  binding_handle,
279    [in]        unsigned32            requested_mgmt_operation,
280    [out]       unsigned32            *status
281);
282
283/*
284 * Values that are passed as the 2nd paramater to the management
285 * authorization routine.
286 */
287
288const long  rpc_c_mgmt_inq_if_ids               = 0;
289const long  rpc_c_mgmt_inq_stats                = 1;
290const long  rpc_c_mgmt_is_server_listen         = 2;
291const long  rpc_c_mgmt_stop_server_listen       = 3;
292const long  rpc_c_mgmt_inq_princ_name           = 4;
293
294/*************************************************************************/
295/*********************  Name Services definitions  ***********************/
296/*************************************************************************/
297
298/*
299 * Generic ns handle.
300 */
301typedef rpc_opaque_ptr_t    rpc_ns_handle_t, *rpc_ns_handle_p_t;
302
303/*
304 * Supported name service constants.
305 */
306const long  rpc_c_ns_none                   = 0; /* No name service     */
307const long  rpc_c_ns_dec_dns                = 1; /* DECdns              */
308const long  rpc_c_ns_ms_wins                = 2; /* MS WINS (rfc1001/2 NBNS) */
309const long  rpc_c_ns_ldap                   = 3; /* LDAP                */
310
311/*
312 * Name service syntax constants (architected values).
313 */
314const long  rpc_c_ns_syntax_default         = 0; /* use default         */
315const long  rpc_c_ns_syntax_unknown         = 1; /* unknown             */
316const long  rpc_c_ns_syntax_dec_dns         = 2; /* DECdns              */
317const long  rpc_c_ns_syntax_dce             = 3; /* DCE                 */
318const long  rpc_c_ns_syntax_x500            = 4; /* ISO OSI X.500       */
319const long  rpc_c_ns_syntax_internet_dns    = 5; /* DOD internet Domain NS */
320const long  rpc_c_ns_syntax_uuid            = 6; /* UUID string          */
321const long  rpc_c_ns_syntax_ms_wins         = 7; /* Microsoft WINS (NBNS) */
322const long  rpc_c_ns_syntax_ldap            = 8; /* RFC 1779 DN         */
323
324/*
325 * Name service inquiry options for profiles.
326 */
327const long  rpc_c_profile_default_elt       = 1;
328const long  rpc_c_profile_all_elts          = 2;
329const long  rpc_c_profile_match_by_if       = 3;
330const long  rpc_c_profile_match_by_mbr      = 4;
331const long  rpc_c_profile_match_by_both     = 5;
332
333/*
334 * Name service binding vector size for lookup.
335 */
336const long  rpc_c_binding_max_count_default = 5;
337
338/*
339 * NSI to generate (or use) a default expiration age value for updates to
340 * name service local data.
341 */
342const long  rpc_c_ns_default_exp_age    = 0xffffffff;
343
344/*************************************************************************/
345/*********************  Protocol tower definitions  **********************/
346/*************************************************************************/
347
348/*
349 * A vector of protocol towers
350 */
351typedef struct
352{
353    unsigned32  count;
354    twr_p_t     tower[1];
355} rpc_tower_vector_t, *rpc_tower_vector_p_t;
356
357/*************************************************************************/
358/****************  Authentication Services definitions  ******************/
359/*************************************************************************/
360
361/*
362 * Handle on authentication service identity (credentials)
363 *
364 * This is what a client uses to refer to (one of) its own identities.
365 */
366typedef rpc_opaque_ptr_t rpc_auth_identity_handle_t;
367
368typedef rpc_opaque_ptr_t rpc_transport_info_handle_t;
369
370/*
371 * Protection level
372 */
373const long rpc_c_protect_level_default         = 0; /* default for auth svc */
374const long rpc_c_protect_level_none            = 1; /* no authentication performed */
375const long rpc_c_protect_level_connect         = 2; /* only on "connect" */
376const long rpc_c_protect_level_call            = 3; /* on first pkt of each call */
377const long rpc_c_protect_level_pkt             = 4; /* on each packet */
378const long rpc_c_protect_level_pkt_integ       = 5; /* strong integrity check */
379const long rpc_c_protect_level_pkt_privacy     = 6; /* encrypt arguments */
380
381/*
382 * Authentication services
383 *
384 * The various authentication schemes/protocols available to applications.
385 */
386const long rpc_c_authn_none         = 0; /* no authentication */
387const long rpc_c_authn_dce_secret   = 1; /* OSF DCE shared secret key auth */
388const long rpc_c_authn_dce_public   = 2; /* OSF DCE public key auth (reserved) */
389const long rpc_c_authn_dce_dummy    = 3; /* OSF DCE non-crypto auth */
390const long rpc_c_authn_dssa_public  = 4; /* DSSA public key auth (reserved) */
391const long rpc_c_authn_gss_negotiate = 9;  /* GSS-API (SPNEGO) */
392const long rpc_c_authn_winnt         = 10; /* NTLMSSP */
393const long rpc_c_authn_gss_tls       = 14; /* Secure Socket Layer */
394const long rpc_c_authn_gss_mskrb     = 16; /* GSS-API (Kerberos V) */
395const long rpc_c_authn_msn           = 17; /* MSN proprietary */
396const long rpc_c_authn_dpa           = 18; /* DPA proprietary */
397const long rpc_c_authn_netlogon      = 68; /* Netlogon secure channel */
398const long rpc_c_authn_schannel      = 68; /* Netlogon secure channel */
399const long rpc_c_authn_default      = 0xffffffff; /* default for environment */
400
401/*
402 * Authorization services
403 *
404 * The various authorization schemes/protocol available to applications.
405 * The application's choice of authentication service determines the
406 * set of authorization services the application is allowed to use.
407 */
408const long rpc_c_authz_none = 0;
409const long rpc_c_authz_name = 1;  /* Kerberos name */
410const long rpc_c_authz_dce  = 2;  /* DCE PAC */
411const long rpc_c_authz_gss_name = 3; /* gss_name_t */
412
413/*
414 * Truly opaque handle on authorization data
415 *
416 * An opaque handle on client authorization data obtained by
417 * calling rpc_binding_inq_auth_caller().  Unlike the deprecated
418 * rpc_authz_handle_t type below, an instance of the
419 * rpc_authz_cred_handle_t type is truly opaque.  It cannot be
420 * cast to anything meaningful.  Credentials can only extracted
421 * via calls to the sec_cred_ interface.
422 */
423typedef struct {
424    unsigned32  magic;
425    void        *data;
426} rpc_authz_cred_handle_t, *rpc_authz_cred_handle_p_t;
427
428/*
429 * Handle on authorization data
430 *
431 * This is what a server gets back when it asks who a client is (via
432 * rpc_binding_inq_auth_client).  A pointer of this type must be cast
433 * to some concrete type (by the server) that's a function of the
434 * authorization service that the client used when authenticating to
435 * the server.
436 */
437typedef void *rpc_authz_handle_t;
438
439/*
440 * Signature of a server-application procedure routine that returns
441 * encryption keys.
442 */
443typedef void (*rpc_auth_key_retrieval_fn_t)
444(
445    [in]        void                    *arg,
446    [in]        unsigned_char_p_t       server_princ_name,
447    [in]        unsigned32              key_type,
448    [in]        unsigned32              key_ver,
449    [out]       void                    **key,
450    [out]       unsigned32              *st
451);
452
453/*************************************************************************/
454/*******************  Object Services definitions  ***********************/
455/*************************************************************************/
456
457/*
458 * Signature of an application procedure that returns takes an object ID
459 * and returns that object's type ID.
460 */
461typedef void (*rpc_object_inq_fn_t)
462(
463    [in]        uuid_p_t                object_uuid,
464    [out]       idl_uuid_t                  *type_uuid,
465    [out]       unsigned32              *status
466);
467
468/*************************************************************************/
469/*******************  Endpoint Service definitions  **********************/
470/*************************************************************************/
471
472const long  rpc_c_ep_max_annotation_size    = 64;   /* including null */
473
474/*
475 * Types and constants for use by EP management functions.
476 */
477typedef rpc_opaque_ptr_t    rpc_ep_inq_handle_t, *rpc_ep_inq_handle_p_t;
478
479typedef rpc_opaque_ptr_t rpc_access_token_p_t;
480
481}
482