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