ab9bf683fbbe5caf6f397d0d485505fba15b9137
[ira/wip.git] / source4 / librpc / idl / dcom.idl
1 #include "idl_types.h"
2
3 /**
4   DCOM interfaces
5   http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm
6  */
7
8 #define HRESULT uint32
9 #define OLESTR unistr
10
11 [
12         uuid(18f70770-8e64-11cf-9af1-0020af6e72f4),
13         version(0.0)
14 ] interface dcom_Unknown
15 {
16         void dcomu_UseProtSeq();
17         void dcomu_GetCustomProtseqInfo();
18         void dcomu_UpdateResolverBindings();
19 }
20
21 [
22         uuid(99fcfe60-5260-101b-bbcb-00aa0021347a),
23         pointer_default(unique)
24 ]
25 interface ObjectRpcBaseTypes
26 {
27         WERROR stub();
28         
29         /* Machine Identifier */
30 #define MID HYPER_T
31
32          /* Object Exporter Identifier */
33 #define OXID HYPER_T
34         
35          // Object Identifer
36 #define OID HYPER_T
37         
38         // Interface Pointer Identifier
39 #define IPID GUID
40         
41         // Causality Identifier
42 #define CID GUID
43
44         // Interface identifier
45 #define IID GUID
46
47 #define LCID uint32
48
49 #define DISPID uint32
50
51         //////////////////////////////////////////////////////////////////
52         // ORPC Call Packet Format
53         //////////////////////////////////////////////////////////////////
54         // COM_MINOR_VERSION = 1 (NT4.0, SP1, SP2, DCOM95).
55         // - Initial Release
56         // - Must be used when talking to downlevel machines, including
57         // on Remote Activation calls.
58         // COM_MINOR_VERSION = 2 (NT4.0 SP3 and beyond).
59         // - Added ResolveOxid2 to IObjectExporter to retrieve the
60         // COM version number of the server. Passed to the NDR engine
61         // to fix fatal endian-ness flaw in the way OLEAUTOMATION marshals
62         // BSTRS. Previous way used trailing padding, which is not NDR
63         // compatible. See Bug# 69189.
64         // COM_MINOR_VERSION = 3 (NT4.0 SP4 and DCOM95 builds 1018 and beyond)
65         // - OLEAUT32 added two new types to the SAFEARRAY, but SAFEARRAY
66         // previously included the "default" keyword, which prevented
67         // downlevel NDR engines from correctly handling any extensions.
68         // Machines with version >=5.3 don't use "default" and will
69         // gracefully handle future extensions to SAFEARRAY.
70         // old constants (for convenience)
71
72         // current version
73         const uint16 COM_MAJOR_VERSION = 5;
74         const uint16 COM_MINOR_VERSION = 6;
75
76         // Body Extensions
77         const string dcom_ext_debugging = "f1f19680-4d2a-11ce-a66a-0020af6e72f4";
78         const string dcom_ext_extended_error = "f1f19681-4d2a-11ce-a66a-0020af6e72f4";
79
80         // Component Object Model version number
81
82         typedef [public] struct 
83         {
84                 uint16 MajorVersion; // Major version number
85                 uint16 MinorVersion; // Minor version number
86         } COMVERSION;
87
88         typedef [public] struct 
89         {
90                 uint32 reserved1;
91                 uint32 reserved2;
92         } COSERVERINFO;
93
94         typedef [public] struct
95         {
96                 uint32 FIXME;
97         } MULTI_QI;
98
99         // enumeration of additional information present in the call packet.
100         // Should be an enum but DCE IDL does not support sparse enumerators.
101         typedef enum {
102                 ORPCF_NULL = 0, // no additional info in packet
103                 ORPCF_LOCAL = 1, // call is local to this machine
104                 ORPCF_RESERVED1 = 2, // reserved for local use
105                 ORPCF_RESERVED2 = 4, // reserved for local use
106                 ORPCF_RESERVED3 = 8, // reserved for local use
107                 ORPCF_RESERVED4 = 16 // reserved for local use
108         } ORPC_FLAGS;
109
110         // Extension to implicit parameters.
111         typedef [public] struct 
112         {       
113                 GUID id; // Extension identifier.
114                 uint32 size; // Extension size.
115                 //FIXME[size_is((size+7)&~7)] uint8 data[]; // Extension data.
116                 [size_is(size)] uint8 data[];
117         }       ORPC_EXTENT;
118
119
120         // Array of extensions.
121         typedef struct 
122         {
123                 uint32 size; // Num extents.
124                 uint32 reserved; // Must be zero.
125                 //FIXME[size_is((size+1)&~1,), unique] ORPC_EXTENT **extent; // extents
126                 [size_is(size),unique] ORPC_EXTENT extent[];
127         } ORPC_EXTENT_ARRAY;
128
129
130         // implicit 'this' pointer which is the first [in] parameter on
131         // every ORPC call.
132         typedef [public] struct 
133         {
134                 COMVERSION version; // COM version number
135                 uint32 flags; // ORPCF flags for presence of other data
136                 uint32 reserved1; // set to zero
137                 CID cid; // causality id of caller
138                 // Extensions.
139                 [unique] ORPC_EXTENT_ARRAY *extensions;
140         }       ORPCTHIS;
141
142
143         // implicit 'that' pointer which is the first [out] parameter on
144         // every ORPC call.
145         typedef [public] struct 
146         {
147                 uint32 flags; // ORPCF flags for presence of other data
148                 // Extensions.
149                 [unique] ORPC_EXTENT_ARRAY *extensions;
150         }       ORPCTHAT;
151
152
153         // DUALSTRINGARRAYS are the return type for arrays of network addresses,
154         // arrays of endpoints and arrays of both used in many ORPC interfaces
155         typedef struct 
156         {
157                 uint16 wTowerId; // Cannot be zero.
158                 uint16 aNetworkAddr; // Zero terminated.
159         }       STRINGBINDING;
160
161
162         const uint16 COM_C_AUTHZ_NONE = 0xffff;
163         typedef struct 
164         {
165                 uint16 wAuthnSvc; // Cannot be zero.
166                 uint16 wAuthzSvc; // Must not be zero.
167                 uint16 aPrincName; // Zero terminated.
168         }       SECURITYBINDING;
169
170
171         typedef [public] struct 
172         {
173                 uint16 wNumEntries; // Number of entries in array.
174                 uint16 wSecurityOffset; // Offset of security info.
175                 // The array contains two parts, a set of STRINGBINDINGs
176                 // and a set of SECURITYBINDINGs. Each set is terminated by an
177                 // extra zero. The shortest array contains four zeros.
178                 [size_is(wNumEntries)] uint16 aStringArray[];
179         }       DUALSTRINGARRAY;
180
181
182         // signature value for OBJREF (object reference, actually the
183         // marshaled form of a COM interface).
184         const uint32 OBJREF_SIGNATURE = 0x574f454d; // 'MEOW'
185
186         // flag values for OBJREF
187         typedef enum {
188                 OBJREF_NULL = 0x0, // NULL pointer
189                 OBJREF_STANDARD = 0x1, // standard marshaled objref
190                 OBJREF_HANDLER = 0x2, // handler marshaled objref
191                 OBJREF_CUSTOM = 0x4 // custom marshaled objref
192         } OBJREF_FLAGS;
193
194         // Flag values for a STDOBJREF (standard part of an OBJREF).
195         // SORF_OXRES1 - SORF_OXRES8 are reserved for the object exporters
196         // use only, object importers must ignore them and must not enforce MBZ.
197         typedef enum {
198                 SORF_NULL   = 0x0000, // convenient for initializing SORF
199                 SORF_OXRES1 = 0x0001, // reserved for exporter
200                 SORF_OXRES2 = 0x0020, // reserved for exporter
201                 SORF_OXRES3 = 0x0040, // reserved for exporter
202                 SORF_OXRES4 = 0x0080, // reserved for exporter
203                 SORF_OXRES5 = 0x0100, // reserved for exporter
204                 SORF_OXRES6 = 0x0200, // reserved for exporter
205                 SORF_OXRES7 = 0x0400, // reserved for exporter
206                 SORF_OXRES8 = 0x0800, // reserved for exporter
207                 SORF_NOPING = 0x1000  // Pinging is not required 
208         } STDOBJREF_FLAGS;
209
210         // standard object reference
211         typedef [public] struct 
212         {
213                 uint32 flags; // STDOBJREF flags (see above)
214                 uint32 cPublicRefs; // count of references passed
215                 OXID oxid; // oxid of server with this oid
216                 OID oid; // oid of object with this ipid
217                 IPID ipid; // ipid of Interface
218         }       STDOBJREF;
219
220         typedef struct
221         {
222                 STDOBJREF std; // standard objref
223                 DUALSTRINGARRAY saResAddr; // resolver address
224         } u_standard;
225
226         typedef struct
227         {
228                 STDOBJREF std; // standard objref
229                 GUID clsid; // Clsid of handler code
230                 DUALSTRINGARRAY saResAddr; // resolver address
231         } u_handler;
232
233         typedef struct
234         {
235                 GUID clsid; // Clsid of unmarshaling code
236                 uint32 cbExtension; // size of extension data
237                 uint32 size; // size of data that follows
238                 [size_is(size), ref] uint8 *pData; // extension + class specific data
239         } u_custom;
240
241         typedef struct
242         {
243         } u_null;
244
245         typedef union 
246         {
247                 [case(OBJREF_NULL)] u_null u_null;
248                 [case(OBJREF_STANDARD)] u_standard u_standard;
249                 [case(OBJREF_HANDLER)] u_handler u_handler;
250                 [case(OBJREF_CUSTOM)] u_custom u_custom;
251         } OBJREF_Types;
252
253         // OBJREF is the format of a marshaled interface pointer.
254         typedef [public] struct 
255         {
256                 uint32 signature;
257                 uint32 flags; // OBJREF flags (see above)
258                 GUID iid; // interface identifier
259                 [switch_is(flags), switch_type(uint32)] OBJREF_Types u_objref;
260         } OBJREF;
261
262         // wire representation of a marshalled interface pointer
263         typedef [public] struct 
264         {
265                 [subcontext(4)] OBJREF abData; // data (OBJREF)
266         } MInterfacePointer;
267 }
268
269
270 [
271         object,
272         uuid(00000000-0000-0000-C000-000000000046),
273         helpstring("Base interface for most COM interfaces")
274 ]
275 interface IUnknown
276 {
277         /*****************/
278         /* Function 0x00 */
279         /* Returns the interface with the specified IID 
280            if implemented by this object */
281         HRESULT QueryInterface([in] IID *riid
282            /*FIXME, [out] void **data*/);
283
284         /*****************/
285         /* Function 0x01 */
286         uint32 AddRef();
287
288         /*****************/
289         /* Function 0x02 */
290         uint32 Release();
291 }
292
293
294 [
295         object,
296         uuid(00000001-0000-0000-C000-000000000046),
297         pointer_default(unique)
298 ] interface IClassFactory : IUnknown
299 {
300         HRESULT CreateInstance(/*FIXME[in] IUnknown *pUnknown, 
301                                [in] IID *riid,
302                                [out, iid_is(riid)] void **ppv*/);
303
304         HRESULT RemoteCreateInstance();
305
306         /* Set lock to TRUE when you want to do a lock
307         and set it to FALSE when you want to unlock */
308         HRESULT LockServer([in] uint8 lock);
309
310         HRESULT RemoteLockServer();
311 }
312
313 //////////////////////////////////////////////////////////////////
314
315 // The remote version of IUnknown. This interface exists on every
316 // OXID (whether an OXID represents either a thread or a process is
317 // implementation specific). It is used by clients to query for new
318 // interfaces, get additional references (for marshaling), and release
319 // outstanding references.
320 // This interface is passed along during OXID resolution.
321 //
322 [
323         uuid(00000131-0000-0000-C000-000000000046),
324         object,
325         helpstring("Remote version of IUnknown")
326 ]
327 interface IRemUnknown : IUnknown
328 {
329         typedef [public] struct 
330         {
331                 HRESULT hResult; // result of call
332                 STDOBJREF std; // data for returned interface
333         }
334         REMQIRESULT;
335
336         HRESULT RemQueryInterface (
337                  [in] IPID *ripid, // interface to QI on
338                  [in] uint32 cRefs, // count of AddRefs requested
339                  [in] uint16 cIids, // count of IIDs that follow
340                  [in, size_is(cIids)] IID* iids, //, // IIDs to QI for
341                  [out] MInterfacePointer *ip
342                 );
343
344         typedef struct 
345         {
346                 IPID ipid; // ipid to AddRef/Release
347                 uint32 cPublicRefs;
348                 uint32 cPrivateRefs;
349         } REMINTERFACEREF;
350
351         HRESULT RemAddRef (
352                  [in] uint16 cInterfaceRefs,
353                  [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[],
354                  [out, size_is(cInterfaceRefs)] HRESULT* pResults
355                 );
356
357         HRESULT RemRelease (
358                  [in] uint16 cInterfaceRefs,
359                  [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
360                 );
361 }
362
363 [
364         uuid(00000140-0000-0000-c000-000000000046),
365         object
366 ] interface IClassActivator : IUnknown
367 {
368         void RemoteGetClassObject([in] GUID classid, 
369                                                                                           [in] uint32 context,
370                                                                                           [in] LCID locale,
371                                                                                           [in] GUID iid/*FIXME,
372                                                                                           [out, iid_is(iid)] void *data */);
373 }
374
375 /* Looks like this is the equivalent of .NET's 
376    System.Activator class */
377 [
378         uuid(000001a0-0000-0000-c000-000000000046),
379         object
380 ]
381         interface ISystemActivator : IClassActivator
382 {
383         void ISystemActivatorRemoteCreateInstance(
384                                                                                           [in] GUID classid,
385                                                                                           [in] OBJREF obj,
386                                                                                           [out] MInterfacePointer res
387                                                                                           );
388 }
389
390
391
392 // Derived from IRemUnknown, this interface supports Remote Query interface
393 // for objects that supply additional data beyond the STDOBJREF in their
394 // marshaled interface packets.
395 [
396         object,
397         uuid(00000143-0000-0000-C000-000000000046)
398 ]
399
400 interface IRemUnknown2 : IRemUnknown
401 {
402         HRESULT RemQueryInterface2 (
403                  [in] IPID *ripid,
404                  [in] uint16 cIids,
405                  [in, size_is(cIids)] IID *iids,
406                  [out, size_is(cIids)] HRESULT *phr,
407                  [out, size_is(cIids)] MInterfacePointer *ppMIF
408                 );
409 }
410
411 [
412 object,
413         uuid(00000136-0000-0000-C000-000000000046)
414         ] interface ISCMActivator : IUnknown
415 {
416         WERROR SCMActivator_GetClassObject();
417         WERROR SCMActivator_CreateInstance();
418 }
419
420 [
421         object,
422         uuid(00020400-0000-0000-C000-000000000046)
423         ] interface IDispatch : IUnknown
424 {
425         /*****************/
426         /* Function 0x03 */
427         HRESULT GetTypeInfoCount(
428                         [out] uint16 *pctinfo);
429
430         typedef struct {
431                 uint8 FIXME;
432         } ITypeInfo;
433
434         typedef struct {
435                 ITypeInfo *pTInfo;
436         } REF_ITypeInfo;
437
438         /*****************/
439         /* Function 0x04 */
440         HRESULT GetTypeInfo (
441                         [in] uint16 iTInfo,
442                         [in] LCID lcid,
443                         [out] REF_ITypeInfo *ppTInfo);
444
445         /*****************/
446         /* Function 0x05 */
447         HRESULT GetIDsOfNames(
448                         [in] IID *riid,
449                         /*FIXME[in,size_is(cNames)] OLESTR *rgszNames[], */
450                         [in] uint16 cNames,
451                         [in] LCID lcid,
452                         [out,size_is(cNames)] DISPID *rgDispId);
453
454         typedef struct {
455                 uint16 vartype;
456                 uint16 FIXME;
457         } VARIANT;
458
459         typedef struct {
460                 uint16 FIXME;
461         } DISPPARAMS;
462
463         /* Exception ? */
464         typedef struct {
465                 uint16 FIXME;
466         } EXCEPINFO;
467
468         /*****************/
469         /* Function 0x06 */
470         HRESULT Invoke(
471                         [in] DISPID dispIdMember,
472                         [in] IID *riid,
473                         [in] LCID lcid,
474                         [in] uint16 wFlags,
475                         [out,in] DISPPARAMS *pDispParams,
476                         [out] VARIANT *pVarResult,
477                         [out] EXCEPINFO *pExcepInfo,
478                         [out] uint16 *puArgErr);
479 }
480
481 [
482 object,
483         uuid(330E9E75-DF48-11CF-8E2C-00A0C90DC94B),
484         pointer_default(unique)
485         ]
486         interface IDcomEchoServ : IDispatch
487 {
488         HRESULT EchoPlusOne([in] uint32 x, [out] uint32 *y);
489 }
490
491 [
492         object,
493         uuid(00000003-0000-0000-C000-000000000046)
494 ] interface IMarshal : IUnknown
495 {
496         HRESULT MarshalInterface();
497         HRESULT UnMarshalInterface();
498 }