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