summaryrefslogtreecommitdiff
path: root/idl/nspi/nspi.idl
blob: 16425487dbb99fcfbc974831ae1070397823f605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
/*
   NSPI Implementation

   OpenChange Project

   Copyright (C) Julien Kerihuel 2006

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/


#include "idl_types.h"

[
  uuid("f5cc5a18-4264-101a-8c59-08002b2f8426"),
  endpoint("ncacn_np:[\\pipe\\exchange_nsp]", "ncacn_ip_tcp:"),
  pointer_default(unique),
  version(56.0),
  helpstring("Exchange 5.5 Name Service Provider"),
  helper("ndr_mapi.h")
] interface nspi
{

#include "mapitags_enum.h"
#include "mapicodes_enum.h"

	/*****************/
	/* Function 0x00 */

	/*
	** MAPIUID explanation:
	** http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/c42065c2-b1f5-4930-84a6-6ef90c6162d0.asp
	*/

	typedef struct _MAPIUID{
		uint8 ab[16];
	} MAPIUID;

	/* 
	** input locale combination: 
	** http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx
	*/

	typedef struct {
		uint32 language;
		uint32 method;
	} input_locale;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32	        handle;
		uint32		flag;
		MAPIUID		service_provider;
		uint32		codepage;	/* CPID */
		input_locale	input_locale;	/* LCID */
	} MAPI_SETTINGS;

	typedef struct {
		[unique, length_is(cValues - 1), size_is(cValues - 1)] MAPITAGS *aulPropTag;
		uint32 cValues;
	} SPropTagArray;
	
	typedef struct {
		[length_is(cValues - 1), size_is(cValues - 1)] uint32 *value;
		uint32 cValues;
	} instance_key;



	/*****************/
	/* Function 0x00 */
	MAPISTATUS NspiBind(
		[in] uint32			unknown,
		[in] MAPI_SETTINGS		*settings,
		[in,out,unique] GUID		*mapiuid,
		[out] policy_handle		*handle
		);

	/*****************/
	/* Function 0x01 */
	MAPISTATUS NspiUnbind(
		[in, out] policy_handle	*handle,
		[in] uint32	       	status
		);


	void NspiUpdateStat();

	/*****************/
	/* Function 0x03 */
	MAPISTATUS NspiQueryRows(
		[in]				policy_handle	*handle,
		[in]				uint32		flag,
		[in,out]			MAPI_SETTINGS	*settings,
		[in]				uint32		lRows,
		[in][size_is(lRows)][unique]	uint32		*instance_key,
		[in]				uint32		unknown,
		[in]				SPropTagArray	*REQ_properties,
		[out]				SRowSet		**RowSet
		);

	void NspiSeekEntries();

	/*****************/
	/* Function 0x05 */

	

	typedef struct {
		[unique] MAPIUID *lpguid;
		uint32 ulKind;
		uint32 lID; /* this is actually a union in mapidefs.h */
	} MAPINAMEID;

/* Restriction types */
#define RES_AND            0
#define RES_OR             1
#define RES_NOT            2
#define RES_CONTENT        3
#define RES_PROPERTY       4
#define RES_COMPAREPROPS   5
#define RES_BITMASK        6
#define RES_SIZE           7
#define RES_EXIST          8
#define RES_SUBRESTRICTION 9
#define RES_COMMENT        10

	typedef struct {
		uint32 relop;
		MAPITAGS ulPropTag;
		SPropValue *lpProp;
	} SPropertyRestriction;

	typedef struct {
		uint32	cRes;
		[size_is(cRes)][unique]SRestriction *lpRes;
	} SAndRestriction;

	typedef [switch_type(uint32)] union {
		[case(RES_AND)           ] SAndRestriction resAnd;
//     [case(RES_OR)            ] SOrRestriction resOr;
//     [case(RES_NOT)           ] SNotRestriction resNot;
//     [case(RES_CONTENT)       ] SContentRestriction resContent;
		[case(RES_PROPERTY)      ] SPropertyRestriction resProperty;
//     [case(RES_COMPAREPROPS)  ] SComparePropsRestriction resCompareProps;
//     [case(RES_BITMASK)       ] SBitMaskRestriction resBitMask;
//     [case(RES_SUBRESTRICTION)] SSubRestriction resSub;
//     [case(RES_SIZE)          ] SSizeRestriction resSize;
//     [case(RES_EXIST)         ] SExistRestriction resExist;
  } SRestriction_CTR;

	typedef [public] struct _SRestriction{
		uint32 rt;
		[switch_is(rt)] SRestriction_CTR res;
	} SRestriction;

/* Sort type */
#define TABLE_SORT_ASCEND	0
#define TABLE_SORT_DESCEND	0

	typedef [public] struct _SSortOrder{
		uint32 ulPropTag;
		uint32 ulOrder;
	} SSortOrder;

	typedef [public] struct _SSortOrderSet{
		uint32 cSorts;
		uint32 cCategories;
		uint32 cExpanded;
		[size_is(cSorts)][unique]SSortOrder *aSort;
	} SSortOrderSet;

	MAPISTATUS NspiGetMatches(
		[in]		policy_handle	*handle,
		[in]		uint32		unknown1,
		[in,out]	MAPI_SETTINGS	*settings,
		[in][unique]	SPropTagArray	*PropTagArray,
		[in]		uint32	       	unknown2,
		[in][unique]	SRestriction	*restrictions,
		[in]		uint32		unknown3,
		[out]		instance_key	*instance_key,
		[in][unique]	SPropTagArray	*REQ_properties,
		[out]		SRowSet		**RowSet
		);


	void NspiResortRestriction();

	/*****************/
	/* Function 0x07 */

	typedef struct {
		[string, charset(DOS)] uint8 *str;
	} NAME_STRING;

	MAPISTATUS  NspiDNToEph(
		[in] policy_handle	*handle,
		[in] uint32		flag,
		[in] uint32		size,
		[in,ref][size_is(size)] NAME_STRING  *server_dn,
		[out] instance_key	*instance_key
		);

	void NspiGetPropList();

	/*****************/
	/* Function 0x09 */
	MAPISTATUS NspiGetProps(
		[in]   	policy_handle		*handle,
		[in]   	uint32			flag,
		[in]	MAPI_SETTINGS		*settings,
		[in]	SPropTagArray		*REQ_properties,
		[out]	SRow			**REPL_values
		);


	void NspiCompareDNTs();
	void NspiModProps();

#define	PT_UNSPECIFIED	0x0000
#define	PT_NULL		0x0001
#define	PT_I2		0x0002
#define	PT_LONG		0x0003
#define	PT_R4		0x0004
#define	PT_DOUBLE	0x0005
#define	PT_CURRENCY	0x0006
#define	PT_APPTIME	0x0007
#define	PT_ERROR	0x000a /* means the given attr contains no value */
#define	PT_BOOLEAN	0x000b
#define	PT_OBJECT	0x000d
#define	PT_I8		0x0014
#define	PT_STRING8	0x001e
#define	PT_UNICODE	0x001f
#define	PT_SYSTIME	0x0040
#define	PT_CLSID       	0x0048
#define	PT_BINARY	0x0102

/* Multi-valued properties */

#define	PT_MV_I2       	0x1002
#define	PT_MV_LONG     	0x1003
#define	PT_MV_R4       	0x1004
#define	PT_MV_DOUBLE   	0x1005
#define	PT_MV_CURRENCY 	0x1006
#define	PT_MV_APPTIME  	0x1007
#define	PT_MV_I8       	0x1014
#define	PT_MV_STRING8	0x101e
#define	PT_MV_TSTRING	0x101e
#define	PT_MV_UNICODE	0x101f
#define	PT_MV_SYSTIME	0x1040
#define	PT_MV_CLSID	0x1048
#define	PT_MV_BINARY	0x1102

	/*****************/
	/* Function 0x0c */

	typedef struct {
		uint32				cb;
		[size_is(cb)][unique] uint8    	*lpb;
	} SBinary;

	typedef struct {
		uint32 dwLowDateTime;
		uint32 dwHighDateTime;
	} FILETIME;

	typedef struct {
		uint32 cValues;
		[size_is(cValues)] uint16 *lpi;
	} SShortArray;

	typedef struct {
		uint32 cValues;
		[size_is(cValues)] uint32 *lpl; 
	} MV_LONG_STRUCT;

	typedef struct {
		ascstr_noterm lppszA;
	} LPSTR;

	typedef struct {
		uint32 cValues;
		[size_is(cValues)] LPSTR **strings; 
	} SLPSTRArray;

	typedef struct {
		uint32 cValues;
		[size_is(cValues)] SBinary *lpbin;
	} SBinaryArray;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32 cValues;
		[size_is(cValues)] uint32 *lpguid; 
	} SGuidArray;

	typedef struct {
		uint32 cValues;
		[size_is(cValues)] uint32 *lpi;
	} MV_UNICODE_STRUCT;
	
	typedef struct {
		uint32 cValues;
		[size_is(cValues)] FILETIME *lpft;
	} SDateTimeArray;

	typedef [switch_type(uint32)] union {
		[case(PT_I2)]			uint16			i;
		[case(PT_LONG)]			uint32			l;
		[case(PT_BOOLEAN)]		uint16			b;
		[case(PT_STRING8)][unique][string,charset(DOS)] uint8	*lpszA;
		[case(PT_BINARY)]		SBinary			bin;
		[case(PT_UNICODE)]		[string,charset(UTF16)] uint16	*lpszW;
		[case(PT_CLSID)]		MAPIUID			*lpguid;
		[case(PT_SYSTIME)]		FILETIME		ft;
		[case(PT_ERROR)]		MAPISTATUS		err;
		[case(PT_MV_I2)]		SShortArray		MVi;
		[case(PT_MV_LONG)]		MV_LONG_STRUCT		MVl;
		[case(PT_MV_STRING8)]		SLPSTRArray		MVszA;
		[case(PT_MV_BINARY)]		SBinaryArray		MVbin;
		[case(PT_MV_CLSID)]		SGuidArray		MVguid;
		[case(PT_MV_UNICODE)]		MV_UNICODE_STRUCT	MVszW;
		[case(PT_MV_SYSTIME)]		SDateTimeArray		MVft;
		[case(PT_NULL)]			uint32			null;
		[case(PT_OBJECT)]		uint32			object;
	} SPropValue_CTR;

	typedef [public]struct {
		MAPITAGS ulPropTag;
		uint32 dwAlignPad;
		[switch_is(ulPropTag & 0xFFFF)] SPropValue_CTR value; 
	} SPropValue;
	
	typedef struct {
		uint32 ulAdrEntryPad;
		uint32 cValues;
		[size_is(cValues)][unique] SPropValue *lpProps;
	} SRow;


	typedef [public] struct {
		uint32 cRows;
		[size_is(cRows)] SRow aRow[*];
	} SRowSet;
	
	MAPISTATUS NspiGetHierarchyInfo(
		[in] policy_handle	*handle,
		[in] uint32		unknown1,
		[in] MAPI_SETTINGS	*settings,
 		[in,out] uint32		*unknown2,
 		[out] SRowSet		**RowSet
		);

	void NspiGetTemplateInfo();
	void NspiModLInkAtt();
	void NspiDeleteEntries();
	void NspiQueryColumns();
	void NspiGetNamesFromIDs();
	void NspiGetIDsFromNames();
	void NspiResolveNames();
	void NspiResolveNamesW();
}