r3514: Allow specification of username, password and domain and try to set up connection.
[sfrench/samba-autobuild/.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 struct 
155         {
156                 uint16 wTowerId; /* Cannot be zero. */
157                 uint16 aNetworkAddr; /* Zero terminated. */
158         }       STRINGBINDING;
159
160
161         const uint16 COM_C_AUTHZ_NONE = 0xffff;
162         typedef struct 
163         {
164                 uint16 wAuthnSvc; /* Cannot be zero. */
165                 uint16 wAuthzSvc; /* Must not be zero. */
166                 uint16 aPrincName; /* Zero terminated. */
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
181         /* signature value for OBJREF (object reference, actually the */
182         /* marshaled form of a COM interface). */
183         const uint32 OBJREF_SIGNATURE = 0x574f454d; /* 'MEOW' */
184
185         /* flag values for OBJREF */
186         typedef enum {
187                 OBJREF_NULL = 0x0, /* NULL pointer */
188                 OBJREF_STANDARD = 0x1, /* standard marshaled objref */
189                 OBJREF_HANDLER = 0x2, /* handler marshaled objref */
190                 OBJREF_CUSTOM = 0x4 /* custom marshaled objref */
191         } OBJREF_FLAGS;
192
193         /* Flag values for a STDOBJREF (standard part of an OBJREF). */
194         /* SORF_OXRES1 - SORF_OXRES8 are reserved for the object exporters */
195         /* use only, object importers must ignore them and must not enforce MBZ. */
196         typedef enum {
197                 SORF_NULL   = 0x0000, /* convenient for initializing SORF */
198                 SORF_OXRES1 = 0x0001, /* reserved for exporter */
199                 SORF_OXRES2 = 0x0020, /* reserved for exporter */
200                 SORF_OXRES3 = 0x0040, /* reserved for exporter */
201                 SORF_OXRES4 = 0x0080, /* reserved for exporter */
202                 SORF_OXRES5 = 0x0100, /* reserved for exporter */
203                 SORF_OXRES6 = 0x0200, /* reserved for exporter */
204                 SORF_OXRES7 = 0x0400, /* reserved for exporter */
205                 SORF_OXRES8 = 0x0800, /* reserved for exporter */
206                 SORF_NOPING = 0x1000  /* Pinging is not required  */
207         } STDOBJREF_FLAGS;
208
209         /* standard object reference */
210         typedef [public] struct 
211         {
212                 uint32 flags; /* STDOBJREF flags (see above) */
213                 uint32 cPublicRefs; /* count of references passed */
214                 OXID oxid; /* oxid of server with this oid */
215                 OID oid; /* oid of object with this ipid */
216                 IPID ipid; /* ipid of Interface */
217         }       STDOBJREF;
218
219         typedef struct
220         {
221                 STDOBJREF std; /* standard objref */
222                 DUALSTRINGARRAY saResAddr; /* resolver address */
223         } u_standard;
224
225         typedef struct
226         {
227                 STDOBJREF std; /* standard objref */
228                 GUID clsid; /* Clsid of handler code */
229                 DUALSTRINGARRAY saResAddr; /* resolver address */
230         } u_handler;
231
232         typedef struct
233         {
234                 GUID clsid; /* Clsid of unmarshaling code */
235                 uint32 cbExtension; /* size of extension data */
236                 uint32 size; /* size of data that follows */
237                 [size_is(size)] uint8 pData[]; /* extension + class specific data */
238         } u_custom;
239
240         typedef struct
241         {
242         } u_null;
243
244         typedef [nodiscriminant] union 
245         {
246                 [case(OBJREF_NULL)] u_null u_null;
247                 [case(OBJREF_STANDARD)] u_standard u_standard;
248                 [case(OBJREF_HANDLER)] u_handler u_handler;
249                 [case(OBJREF_CUSTOM)] u_custom u_custom;
250         } OBJREF_Types;
251
252         /* OBJREF is the format of a marshaled interface pointer. */
253         typedef [public] struct 
254         {
255                 uint32 signature;
256                 uint32 flags; /* OBJREF flags (see above) */
257                 GUID iid; /* interface identifier */
258                 [switch_is(flags), switch_type(uint32)] OBJREF_Types u_objref;
259         } OBJREF;
260
261         /* wire representation of a marshalled interface pointer */
262         typedef [public] struct 
263         {
264                 uint32 size;
265                 uint32 sizex;
266                 [subcontext(4),align(1)] OBJREF obj;
267         } MInterfacePointer;
268 }
269
270
271 [
272         object,
273         uuid("00000000-0000-0000-C000-000000000046"),
274         helpstring("Base interface for all COM interfaces")
275 ]
276 interface IUnknown
277 {
278         /*****************/
279         /* Function 0x00 */
280         /* Returns the interface with the specified IID 
281            if implemented by this object */
282         [local] WERROR IUnknown_QueryInterface([in] IID *riid,
283            [out,iid_is(riid)] MInterfacePointer *data);
284
285         /*****************/
286         /* Function 0x01 */
287         [local] uint32 IUnknown_AddRef();
288
289         /*****************/
290         /* Function 0x02 */
291         [local] uint32 IUnknown_Release();
292 }
293
294
295 [
296         object,
297         uuid("00000001-0000-0000-C000-000000000046"),
298         pointer_default(unique)
299 ] interface IClassFactory : IUnknown
300 {
301         [local] WERROR CreateInstance(/*FIXME[in] IUnknown *pUnknown*/, 
302                                [in] IID *riid,
303                                [out, iid_is(riid)] MInterfacePointer *ppv);
304
305         [call_as(CreateInstance)] WERROR RemoteCreateInstance();
306
307         /* Set lock to TRUE when you want to do a lock
308         and set it to FALSE when you want to unlock */
309         [local] WERROR LockServer([in] uint8 lock);
310
311         [call_as(LockServer)] WERROR RemoteLockServer();
312 }
313
314 /*//////////////////////////////////////////////////////////////// */
315
316 /* The remote version of IUnknown. This interface exists on every */
317 /* OXID (whether an OXID represents either a thread or a process is */
318 /* implementation specific). It is used by clients to query for new */
319 /* interfaces, get additional references (for marshaling), and release */
320 /* outstanding references. */
321 /* This interface is passed along during OXID resolution. */
322 /* */
323 [
324         uuid("00000131-0000-0000-C000-000000000046"),
325         object,
326         helpstring("Remote version of IUnknown")
327 ]
328 interface IRemUnknown : IUnknown
329 {
330         typedef [public] struct 
331         {
332                 WERROR hResult; /* result of call */
333                 STDOBJREF std; /* data for returned interface */
334         }
335         REMQIRESULT;
336
337         [call_as(QueryInterface)] WERROR RemQueryInterface (
338                 [in] IPID *ripid, /* interface to QI on */
339                 [in] uint32 cRefs, /* count of AddRefs requested */
340                 [in] uint16 cIids, /* count of IIDs that follow */
341                 [in, size_is(cIids)] IID* iids, /*, // IIDs to QI for */
342                 [out, size_is(cIids)] MInterfacePointer *ip
343                 );
344
345         typedef struct 
346         {
347                 IPID ipid; /* ipid to AddRef/Release */
348                 uint32 cPublicRefs;
349                 uint32 cPrivateRefs;
350         } REMINTERFACEREF;
351
352         [call_as(AddRef)] WERROR RemAddRef (
353                  [in] uint16 cInterfaceRefs,
354                  [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[],
355                  [out, size_is(cInterfaceRefs)] WERROR* pResults
356                 );
357
358         [call_as(Release)] WERROR RemRelease (
359                  [in] uint16 cInterfaceRefs,
360                  [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
361                 );
362 }
363
364 [
365         uuid("00000140-0000-0000-c000-000000000046"),
366         object
367 ] interface IClassActivator : IUnknown
368 {
369         void RemoteGetClassObject([in] GUID clsid, 
370                                                                                           [in] uint32 context,
371                                                                                           [in] LCID locale,
372                                                                                           [in] GUID iid,
373                                                                                           [out, iid_is(iid)] MInterfacePointer data);
374 }
375
376 /* Looks like this is the equivalent of .NET's 
377    System.Activator class */
378 [
379         uuid("000001a0-0000-0000-c000-000000000046"),
380         object
381 ]
382         interface ISystemActivator : IClassActivator
383 {
384         WERROR ISystemActivatorRemoteCreateInstance([in] HYPER_T unknown1,  /* IPID ? */
385                                                                                           [in] MInterfacePointer iface,
386                                                                                           [in] HYPER_T unknown2,
387                                                                                           [out] uint32 unknown3, 
388                                                                                           [out] MInterfacePointer iface);
389 }
390
391
392
393 /* Derived from IRemUnknown, this interface supports Remote Query interface */
394 /* for objects that supply additional data beyond the STDOBJREF in their */
395 /* marshaled interface packets. */
396 [
397         object,
398         uuid("00000143-0000-0000-C000-000000000046")
399 ]
400
401 interface IRemUnknown2 : IRemUnknown
402 {
403         [call_as(QueryInterface2)] WERROR RemQueryInterface2 (
404                  [in] IPID *ripid,
405                  [in] uint16 cIids,
406                  [in, size_is(cIids)] IID *iids,
407                  [out, size_is(cIids)] WERROR *phr,
408                  [out, size_is(cIids)] MInterfacePointer *ppMIF
409                 );
410 }
411
412 [
413 object,
414         uuid("00000136-0000-0000-C000-000000000046")
415         ] interface ISCMActivator : IUnknown
416 {
417         WERROR SCMActivator_GetClassObject();
418         WERROR SCMActivator_CreateInstance();
419 }
420
421 [
422         object,
423         uuid("00020400-0000-0000-C000-000000000046")
424         ] interface IDispatch : IUnknown
425 {
426         /*****************/
427         /* Function 0x03 */
428         WERROR GetTypeInfoCount(
429                         [out] uint16 *pctinfo);
430
431         typedef struct {
432                 uint8 FIXME;
433         } ITypeInfo;
434
435         typedef struct {
436                 ITypeInfo *pTInfo;
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         uuid("00000003-0000-0000-C000-000000000046")
485 ] interface IMarshal : IUnknown
486 {
487         WERROR MarshalInterface();
488         WERROR UnMarshalInterface();
489 }
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 }