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