r1774: Add the uuids of the known exchange pipes
[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 HRESULT uint32
9 #define OLESTR unistr
10
11 [
12         uuid(99fcfe60-5260-101b-bbcb-00aa0021347a),
13         pointer_default(unique)
14 ]
15 interface ObjectRpcBaseTypes
16 {
17         WERROR stub();
18         
19         // Machine Identifier
20 #define MID HYPER_T
21
22          // Object Exporter Identifier
23 #define OXID HYPER_T
24         
25          // Object Identifer
26 #define OID HYPER_T
27         
28         // Ping Set Identifier
29 #define SETID HYPER_T
30
31         // Interface Pointer Identifier
32 #define IPID GUID
33         
34         // Causality Identifier
35 #define CID GUID
36
37         // Class ID
38 #define CLSID GUID
39
40         // Interface identifier
41 #define IID GUID
42
43 #define LCID uint32
44
45 #define DISPID uint32
46
47         //////////////////////////////////////////////////////////////////
48         // ORPC Call Packet Format
49         //////////////////////////////////////////////////////////////////
50         // COM_MINOR_VERSION = 1 (NT4.0, SP1, SP2, DCOM95).
51         // - Initial Release
52         // - Must be used when talking to downlevel machines, including
53         // on Remote Activation calls.
54         // COM_MINOR_VERSION = 2 (NT4.0 SP3 and beyond).
55         // - Added ResolveOxid2 to IObjectExporter to retrieve the
56         // COM version number of the server. Passed to the NDR engine
57         // to fix fatal endian-ness flaw in the way OLEAUTOMATION marshals
58         // BSTRS. Previous way used trailing padding, which is not NDR
59         // compatible. See Bug# 69189.
60         // COM_MINOR_VERSION = 3 (NT4.0 SP4 and DCOM95 builds 1018 and beyond)
61         // - OLEAUT32 added two new types to the SAFEARRAY, but SAFEARRAY
62         // previously included the "default" keyword, which prevented
63         // downlevel NDR engines from correctly handling any extensions.
64         // Machines with version >=5.3 don't use "default" and will
65         // gracefully handle future extensions to SAFEARRAY.
66         // old constants (for convenience)
67         const uint16 COM_MINOR_VERSION_1 = 1;
68         const uint16 COM_MINOR_VERSION_2 = 2;
69
70         // current version
71         const uint16 COM_MAJOR_VERSION = 5;
72         const uint16 COM_MINOR_VERSION = 3;
73         // Component Object Model version number
74
75         typedef [public] struct 
76         {
77                 uint16 MajorVersion; // Major version number
78                 uint16 MinorVersion; // Minor version number
79         } COMVERSION;
80
81
82         // enumeration of additional information present in the call packet.
83         // Should be an enum but DCE IDL does not support sparse enumerators.
84         typedef enum {
85                 ORPCF_NULL = 0, // no additional info in packet
86                 ORPCF_LOCAL = 1, // call is local to this machine
87                 ORPCF_RESERVED1 = 2, // reserved for local use
88                 ORPCF_RESERVED2 = 4, // reserved for local use
89                 ORPCF_RESERVED3 = 8, // reserved for local use
90                 ORPCF_RESERVED4 = 16 // reserved for local use
91         } ORPC_FLAGS;
92
93         // Extension to implicit parameters.
94         typedef [public] struct 
95         {       
96                 GUID id; // Extension identifier.
97                 uint32 size; // Extension size.
98                 //FIXME[size_is((size+7)&~7)] uint8 data[]; // Extension data.
99                 [size_is(size)] uint8 data[];
100         }       ORPC_EXTENT;
101
102
103         // Array of extensions.
104         typedef struct 
105         {
106                 uint32 size; // Num extents.
107                 uint32 reserved; // Must be zero.
108                 //FIXME[size_is((size+1)&~1,), unique] ORPC_EXTENT **extent; // extents
109                 [size_is(size),unique] ORPC_EXTENT extent[];
110         }       ORPC_EXTENT_ARRAY;
111
112
113         // implicit 'this' pointer which is the first [in] parameter on
114         // every ORPC call.
115         typedef [public] struct 
116         {
117                 COMVERSION version; // COM version number
118                 uint32 flags; // ORPCF flags for presence of other data
119                 uint32 reserved1; // set to zero
120                 CID cid; // causality id of caller
121                 // Extensions.
122                 [unique] ORPC_EXTENT_ARRAY *extensions;
123         }       ORPCTHIS;
124
125
126         // implicit 'that' pointer which is the first [out] parameter on
127         // every ORPC call.
128         typedef [public] struct 
129         {
130                 uint32 flags; // ORPCF flags for presence of other data
131                 // Extensions.
132                 [unique] ORPC_EXTENT_ARRAY *extensions;
133         }       ORPCTHAT;
134
135
136         // DUALSTRINGARRAYS are the return type for arrays of network addresses,
137         // arrays of endpoints and arrays of both used in many ORPC interfaces
138         typedef struct 
139         {
140                 uint16 wTowerId; // Cannot be zero.
141                 uint16 aNetworkAddr; // Zero terminated.
142         }       STRINGBINDING;
143
144
145         const uint16 COM_C_AUTHZ_NONE = 0xffff;
146         typedef struct 
147         {
148                 uint16 wAuthnSvc; // Cannot be zero.
149                 uint16 wAuthzSvc; // Must not be zero.
150                 uint16 aPrincName; // Zero terminated.
151         }       SECURITYBINDING;
152
153
154         typedef [public] struct 
155         {
156                 uint16 wNumEntries; // Number of entries in array.
157                 uint16 wSecurityOffset; // Offset of security info.
158                 // The array contains two parts, a set of STRINGBINDINGs
159                 // and a set of SECURITYBINDINGs. Each set is terminated by an
160                 // extra zero. The shortest array contains four zeros.
161                 [size_is(wNumEntries)] uint16 aStringArray[];
162         }       DUALSTRINGARRAY;
163
164
165         // signature value for OBJREF (object reference, actually the
166         // marshaled form of a COM interface).
167         const uint32 OBJREF_SIGNATURE = 0x574f454d; // 'MEOW'
168
169         // flag values for OBJREF
170         typedef enum {
171                 OBJREF_STANDARD = 0x1, // standard marshaled objref
172                 OBJREF_HANDLER = 0x2, // handler marshaled objref
173                 OBJREF_CUSTOM = 0x4 // custom marshaled objref
174         } OBJREF_FLAGS;
175
176         // Flag values for a STDOBJREF (standard part of an OBJREF).
177         // SORF_OXRES1 - SORF_OXRES8 are reserved for the object exporters
178         // use only, object importers must ignore them and must not enforce MBZ.
179         typedef enum {
180                 SORF_NULL   = 0x0000, // convenient for initializing SORF
181                 SORF_OXRES1 = 0x0001, // reserved for exporter
182                 SORF_OXRES2 = 0x0020, // reserved for exporter
183                 SORF_OXRES3 = 0x0040, // reserved for exporter
184                 SORF_OXRES4 = 0x0080, // reserved for exporter
185                 SORF_OXRES5 = 0x0100, // reserved for exporter
186                 SORF_OXRES6 = 0x0200, // reserved for exporter
187                 SORF_OXRES7 = 0x0400, // reserved for exporter
188                 SORF_OXRES8 = 0x0800, // reserved for exporter
189                 SORF_NOPING = 0x1000  // Pinging is not required 
190         } STDOBJREF_FLAGS;
191
192         // standard object reference
193         typedef [public] struct 
194         {
195                 uint32 flags; // STDOBJREF flags (see above)
196                 uint32 cPublicRefs; // count of references passed
197                 OXID oxid; // oxid of server with this oid
198                 OID oid; // oid of object with this ipid
199                 IPID ipid; // ipid of Interface
200         }       STDOBJREF;
201
202         typedef struct
203         {
204                 STDOBJREF std; // standard objref
205                 DUALSTRINGARRAY saResAddr; // resolver address
206         } u_standard;
207
208         typedef struct
209                 {
210                         STDOBJREF std; // standard objref
211                         CLSID clsid; // Clsid of handler code
212                         DUALSTRINGARRAY saResAddr; // resolver address
213                 } u_handler;
214
215         typedef struct
216                 {
217                         CLSID clsid; // Clsid of unmarshaling code
218                         uint32 cbExtension; // size of extension data
219                         uint32 size; // size of data that follows
220                         [size_is(size), ref] uint8 *pData; // extension + class specific data
221                 } u_custom;
222
223
224
225         typedef union 
226         {
227                 [case(OBJREF_STANDARD)] u_standard u_standard;
228                 [case(OBJREF_HANDLER)] u_handler u_handler;
229                 [case(OBJREF_CUSTOM)] u_custom u_custom;
230         } OBJREF_Types;
231
232         // OBJREF is the format of a marshaled interface pointer.
233         typedef struct 
234         {
235                 uint32 flags; // OBJREF flags (see above)
236                 GUID iid; // interface identifier
237                 [switch_is(flags), switch_type(uint32)] OBJREF_Types u_objref;
238         } OBJREF;
239
240         // wire representation of a marshalled interface pointer
241         typedef [public] struct 
242         {
243                 uint32 ulCntData; // size of data
244                 [size_is(ulCntData)] uint8 abData[]; // data (OBJREF)
245         } MInterfacePointer;
246 }
247
248 [
249         object,
250         uuid(00000000-0000-0000-C000-000000000046)
251 ]
252 interface IUnknown
253 {
254         /*****************/
255         /* Function 0x00 */
256         HRESULT QueryInterface([in] IID *riid
257                                                    /*FIXME, [out] void **data*/);
258
259         /*****************/
260         /* Function 0x01 */
261         uint32 AddRef();
262
263         /*****************/
264         /* Function 0x02 */
265         uint32 Release();
266 }
267
268 //////////////////////////////////////////////////////////////////
269
270 // The remote version of Iunknown. This interface exists on every
271 // OXID (whether an OXID represents either a thread or a process is
272 // implementation specific). It is used by clients to query for new
273 // interfaces, get additional references (for marshaling), and release
274 // outstanding references.
275 // This interface is passed along during OXID resolution.
276 //
277 [
278         uuid(00000131-0000-0000-C000-000000000046),
279         object,
280         version(0.0)
281 ]
282 interface IRemUnknown : IUnknown
283 {
284         typedef struct 
285         {
286                 HRESULT hResult; // result of call
287                 STDOBJREF std; // data for returned interface
288         }
289         REMQIRESULT;
290
291         HRESULT RemQueryInterface (
292                  [in] IPID *ripid, // interface to QI on
293                  [in] uint32 cRefs, // count of AddRefs requested
294                  [in] uint16 cIids, // count of IIDs that follow
295                  [in, size_is(cIids)]
296                  IID* iids//, // IIDs to QI for
297                  /*FIXME: [out, size_is(,cIids)]
298                  REMQIRESULT** ppQIResults // results returned*/
299                 );
300         typedef struct 
301         {
302                 IPID ipid; // ipid to AddRef/Release
303                 uint32 cPublicRefs;
304                 uint32 cPrivateRefs;
305         } REMINTERFACEREF;
306
307         HRESULT RemAddRef (
308                  [in] uint16 cInterfaceRefs,
309                  [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[],
310                  [out, size_is(cInterfaceRefs)] HRESULT* pResults
311                 );
312
313         HRESULT RemRelease (
314                  [in] uint16 cInterfaceRefs,
315                  [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
316                 );
317 }
318
319
320
321 // Derived from IRemUnknown, this interface supports Remote Query interface
322 // for objects that supply additional data beyond the STDOBJREF in their
323 // marshaled interface packets.
324 [
325 object,
326 uuid(00000143-0000-0000-C000-000000000046),
327 version(0.0)
328 ]
329
330 interface IRemUnknown2 : IRemUnknown
331 {
332         HRESULT RemQueryInterface2 (
333                  [in] IPID *ripid,
334                  [in] uint16 cIids,
335                  [in, size_is(cIids)] IID *iids,
336                  [out, size_is(cIids)] HRESULT *phr,
337                  [out, size_is(cIids)] MInterfacePointer *ppMIF[*]
338                 );
339 }
340
341 [ uuid(99fcfec4-5260-101b-bbcb-00aa0021347a),
342         pointer_default(unique)
343 ]
344 interface IOXIDResolver
345 {
346         // Method to get the protocol sequences, string bindings
347         // and machine id for an object server given its OXID.
348
349         typedef [public] struct {
350                 DUALSTRINGARRAY *ppdsaOxidBindings;
351         } ppdsaOxidBindingsArray;
352
353         [idempotent] WERROR ResolveOxid (
354                  [in,ref] policy_handle *hRpc,
355                  [in] OXID *pOxid,
356                  [in] uint16 cRequestedProtseqs,
357                  [in, size_is(cRequestedProtseqs)] uint16 arRequestedProtseqs[],
358                  [out, ref] ppdsaOxidBindingsArray *ppdsaOxidBindings,
359                  [out, ref] IPID *pipidRemUnknown,
360                  [out, ref] uint32 *pAuthnHint
361                          );
362
363         // Simple ping is used to ping a Set. Client machines use this
364         // to inform the object exporter that it is still using the
365         // members of the set.
366         // Returns S_TRUE if the SetId is known by the object exporter,
367         // S_FALSE if not.
368         [idempotent] WERROR SimplePing (
369                  [in,ref] policy_handle *hRpc,
370                  [in] SETID *pSetId // Must not be zero
371                 );
372         
373         // Complex ping is used to create sets of OIDs to ping. The
374         // whole set can subsequently be pinged using SimplePing,
375         // thus reducing network traffic.
376         [idempotent] WERROR ComplexPing (
377                  [in,ref] policy_handle *hRpc,
378                  [in, out] SETID *pSetId, // In of 0 on first call for new set.
379                  [in] uint16 SequenceNum,
380                  [in] uint16 cAddToSet,
381                  [in] uint16 cDelFromSet,
382                  // add these OIDs to the set
383                  [in, unique, size_is(cAddToSet)] OID AddToSet[],
384                  //remove these OIDs from the set
385                  [in, unique, size_is(cDelFromSet)] OID DelFromSet[],
386                  [out] uint16 *pPingBackoffFactor// 2^factor = multipler
387                          );
388         // In some cases the client maybe unsure that a particular
389         // binding will reach the server. (For example, when the oxid
390         // bindings have more then one TCP/IP binding) This call
391         // can be used to validate the binding
392         // from the client.
393         [idempotent] WERROR ServerAlive (
394                                                                          [in,ref] policy_handle *hRpc
395                                                                         );
396         // Method to get the protocol sequences, string bindings,
397         // RemoteUnknown IPID and COM version for an object server
398         // given its OXID. Supported by DCOM
399         // version 5.2 and above.
400         [idempotent] WERROR ResolveOxid2 (
401                                                                                           [in,ref] policy_handle *hRpc,
402                                                                                           [in] OXID *pOxid,
403                                                                                           [in] uint16 cRequestedProtseqs,
404                                                                                           [in, size_is(cRequestedProtseqs)]
405                                                                                           uint16 arRequestedProtseqs[],
406                                                                                           [out, ref] ppdsaOxidBindingsArray *ppdsaOxidBindings,
407                                                                                           [out, ref] IPID *pipidRemUnknown,
408                                                                                           [out, ref] uint32 *pAuthnHint,
409                                                                                           [out, ref] COMVERSION *pComVersion
410                                                                                          );
411
412         [idempotent] WERROR ServerAlive2 (
413                                                                           [out] COMVERSION version,
414                                                                           [out] uint8 unknown1[4],
415                                                                           [out] DUALSTRINGARRAY dualstring,
416                                                                           [out] uint8 unknown2[5]);
417
418 }
419
420 [
421 uuid(4d9f4ab8-7d1c-11cf-861e-0020af6e7c57),
422         version(0.0),
423         pointer_default(unique)
424 ]
425 interface IRemoteActivation
426 {
427         typedef [public] struct {
428                 MInterfacePointer *ppInterfaceData;
429         } ppInterfaceDataArray;
430
431         const uint32 MODE_GET_CLASS_OBJECT = 0xffffffff;
432         HRESULT RemoteActivation (
433                                                           [in,ref] policy_handle *hRpc,
434                                                           [in] ORPCTHIS *ORPCthis,
435                                                           [out] ORPCTHAT *ORPCthat,
436                                                           [in] GUID *Clsid,
437                                                           [in, unique] unistr *pwszObjectName,
438                                                           [in, unique] MInterfacePointer *pObjectStorage,
439                                                           [in] uint32 ClientImpLevel,
440                                                           [in] uint32 Mode,
441                                                           [in] uint32 Interfaces,
442                                                           [in,unique,size_is(Interfaces)] IID *pIIDs,
443                                                           [in] uint16 cRequestedProtseqs,
444                                                           [in, size_is(cRequestedProtseqs)]
445                                                           uint16 RequestedProtseqs[],
446                                                           [out] OXID *pOxid,
447                                                           [out] ppdsaOxidBindingsArray *ppdsaOxidBindings,
448                                                           [out] IPID *pipidRemUnknown,
449                                                           [out] uint32 *pAuthnHint,
450                                                           [out] COMVERSION *pServerVersion,
451                                                           [out] HRESULT *phr,
452                                                           [out,size_is(Interfaces)] ppInterfaceDataArray *ppInterfaceData,
453                                                           [out,size_is(Interfaces)] HRESULT *pResults
454                                                                   );
455 }
456
457
458 /* The Win2k equivalent of IRemoteActivation */
459 [
460         uuid(000001a0-0000-0000-c000-000000000046),
461         version(0.0)
462 ]
463 interface ISystemActivator
464 {
465
466         /*****************/
467         /* Function 0x00 */
468         NTSTATUS isa_Unknown0();
469
470         /*****************/
471         /* Function 0x01 */
472         NTSTATUS isa_Unknown1();
473
474         /*****************/
475         /* Function 0x02 */
476         NTSTATUS isa_Unknown2();
477
478         /*****************/
479         /* Function 0x03 */
480         NTSTATUS isa_Unknown3();
481
482         // Binding strings and the OBJREF_SIGNATURE in this call
483         /*****************/
484         /* Function 0x04 */
485         NTSTATUS isa_Unknown4();
486 }
487
488 [
489         uuid(00000132-0000-0000-C000-000000000046),
490         version(0.0)
491 ] interface IObjServer
492 {
493         WERROR IObjServer_Unknown();
494 }
495
496 [
497         uuid(00000134-0000-0000-C000-000000000046),
498         version(0.0)
499 ] interface IRunDown
500 {
501         WERROR IRunDown_Dummy();
502 }
503
504
505 // Service COntrol Manager
506
507 [
508         uuid(00000136-0000-0000-C000-000000000046),
509         version(0.0)
510 ] interface ISCMLocalActivator
511 {
512         WERROR ISCMLocalActivator();
513 }
514
515 [
516         object,
517         uuid(00020400-0000-0000-C000-000000000046),
518         version(0.0)
519 ] interface IDispatch : IUnknown
520 {
521         /*****************/
522         /* Function 0x03 */
523         HRESULT GetTypeInfoCount(
524                                                  [out] uint16 *pctinfo);
525
526         /*****************/
527         /* Function 0x04 */
528         HRESULT GetTypeInfo (
529                                          [in] uint16 iTInfo,
530                                          [in] LCID lcid/*FIXME,
531                                          [out] ITypeInfo **ppTInfo*/);
532
533         /*****************/
534         /* Function 0x05 */
535         HRESULT GetIDsOfNames(
536                                           [in] IID *riid,
537                                           /*FIXME[in,size_is(cNames)] OLESTR *rgszNames[], */
538                                           [in] uint16 cNames,
539                                           [in] LCID lcid,
540                                           [out,size_is(cNames)] DISPID *rgDispId);
541
542         typedef struct {
543                 uint16 vartype;
544                 uint16 FIXME;
545         } VARIANT;
546         
547         typedef struct {
548                 uint16 FIXME;
549         } DISPPARAMS;
550
551         /* Exception ? */
552         typedef struct {
553                 uint16 FIXME;
554         } EXCEPINFO;
555         
556         /*****************/
557         /* Function 0x06 */
558         HRESULT Invoke(
559                            [in] DISPID dispIdMember,
560                            [in] IID *riid,
561                            [in] LCID lcid,
562                            [in] uint16 wFlags,
563                            [out,in] DISPPARAMS *pDispParams,
564                            [out] VARIANT *pVarResult,
565                            [out] EXCEPINFO *pExcepInfo,
566                            [out] uint16 *puArgErr);
567 }
568
569 [
570         object,
571         uuid(330E9E75-DF48-11CF-8E2C-00A0C90DC94B),
572         pointer_default(unique)
573 ]
574 interface IDcomEchoServ : IDispatch
575 {
576         HRESULT EchoPlusOne([in] uint32 x, [out] uint32 *y);
577 }