3be3f33e4d4b44359de2b8e33787cc41bee6b895
[reactos.git] / rostests / winetests / rpcrt4 / server.idl
1 /*
2 * A simple interface to test the RPC server.
3 *
4 * Copyright (C) Google 2007 (Dan Hipschman)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "server_defines.h"
22
23 typedef struct tag_vector
24 {
25 int x;
26 int y;
27 int z;
28 } vector_t;
29
30 typedef int fnprintf(const char *format, ...);
31
32 [
33 uuid(00000000-4114-0704-2301-000000000000),
34 implicit_handle(handle_t IServer_IfHandle)
35 ]
36 interface IServer
37 {
38 cpp_quote("#if 0")
39 typedef wchar_t WCHAR;
40 cpp_quote("#endif")
41
42 typedef [string] char *str_t;
43 typedef [string] WCHAR *wstr_t;
44
45 typedef struct
46 {
47 int *pi;
48 int **ppi;
49 int ***pppi;
50 } pints_t;
51
52 typedef struct
53 {
54 char *pc;
55 short *ps;
56 long *pl;
57 float *pf;
58 double *pd;
59 } ptypes_t;
60
61 typedef struct
62 {
63 vector_t *pu;
64 vector_t **pv;
65 } pvectors_t;
66
67 typedef struct
68 {
69 [switch_is(s)] union
70 {
71 [case(SUN_I)] int i;
72 [case(SUN_F1, SUN_F2)] float f;
73 [case(SUN_PI)] int *pi;
74 } u;
75
76 int s;
77 } sun_t;
78
79 int int_return(void);
80 int square(int x);
81 int sum(int x, int y);
82 signed char sum_char(signed char x, signed char y);
83 short sum_short(short x, short y);
84 int sum_float(float x, float y);
85 int sum_double_int(int x, double y);
86 hyper sum_hyper(hyper x, hyper y);
87 int sum_hyper_int(hyper x, hyper y);
88 int sum_char_hyper(signed char x, hyper y);
89 void square_out(int x, [out] int *y);
90 void square_ref([in, out] int *x);
91 int str_length([string] const char *s);
92 int str_t_length(str_t s);
93 int cstr_length([string, size_is(n)] const char *s, int n);
94 int dot_self(vector_t *v);
95 double square_half(double x, [out] double *y);
96 float square_half_float(float x, [out] float *y);
97 long square_half_long(long x, [out] long *y);
98 int sum_fixed_array(int a[5]);
99 int pints_sum(pints_t *pints);
100 double ptypes_sum(ptypes_t *ptypes);
101 int dot_pvectors(pvectors_t *pvectors);
102
103 /* don't use this anywhere except in sp_t */
104 typedef struct
105 {
106 int x;
107 } sp_inner_t;
108
109 typedef struct
110 {
111 int x;
112 sp_inner_t *s;
113 } sp_t;
114
115 int sum_sp(sp_t *sp);
116 double square_sun(sun_t *su);
117
118 typedef struct test_list
119 {
120 int t;
121 [switch_is(t)] union
122 {
123 [case(TL_NULL)] char x; /* end of list */
124 [case(TL_LIST)] struct test_list *tail;
125 } u;
126 } test_list_t;
127
128 typedef [ref] int *refpint_t;
129
130 int test_list_length(test_list_t *ls);
131 int sum_fixed_int_3d(int m[2][3][4]);
132 int sum_conf_array([size_is(n)] int x[], int n);
133 int sum_conf_ptr_by_conf_ptr(int n1, [size_is(n1)] int *n2_then_x1, [size_is(*n2_then_x1)] int *x2);
134 int sum_unique_conf_array([size_is(n), unique] int x[], int n);
135 int sum_unique_conf_ptr([size_is(n), unique] int *x, int n);
136 int sum_var_array([length_is(n)] int x[20], int n);
137 int dot_two_vectors(vector_t vs[2]);
138 void get_number_array([out, length_is(*n)] int x[20], [out] int *n);
139
140 typedef struct
141 {
142 int n;
143 [size_is(n)] int ca[];
144 } cs_t;
145
146 typedef struct
147 {
148 int *pn;
149 [size_is(*pn)] int *ca1;
150 [size_is(n * 2)] int *ca2;
151 int n;
152 } cps_t;
153
154 typedef struct
155 {
156 [size_is(c ? a : b)] int *ca;
157 int a;
158 int b;
159 int c;
160 } cpsc_t;
161
162 int sum_cs(cs_t *cs);
163 int sum_cps(cps_t *cps);
164 int sum_cpsc(cpsc_t *cpsc);
165 int sum_complex_array(int n, [size_is(n)] refpint_t pi[]);
166
167 typedef [wire_marshal(int)] void *puint_t;
168 int square_puint(puint_t p);
169
170 typedef struct
171 {
172 [size_is(n)] puint_t *ps;
173 int n;
174 } puints_t;
175
176 /* Same thing as puints_t, but make it complex (needs padding). */
177 typedef struct
178 {
179 [size_is(n)] puint_t *ps;
180 char n;
181 } cpuints_t;
182
183 int sum_puints(puints_t *p);
184 int sum_cpuints(cpuints_t *p);
185 int dot_copy_vectors(vector_t u, vector_t v);
186
187 typedef struct wire_us *wire_us_t;
188 typedef [wire_marshal(wire_us_t)] struct us us_t;
189 struct us
190 {
191 void *x;
192 };
193 struct wire_us
194 {
195 int x;
196 };
197 typedef struct
198 {
199 us_t us;
200 } test_us_t;
201
202 int square_test_us(test_us_t *tus);
203
204 typedef union encu switch (int t)
205 {
206 case ENCU_I: int i;
207 case ENCU_F: float f;
208 } encu_t;
209
210 typedef [switch_type(int)] union unencu
211 {
212 [case (ENCU_I)] int i;
213 [case (ENCU_F)] float f;
214 } unencu_t;
215
216 typedef enum
217 {
218 E1 = 23,
219 E2 = 4,
220 E3 = 0,
221 E4 = 64
222 } e_t;
223
224 typedef union encue switch (e_t t)
225 {
226 case E1: int i1;
227 case E2: float f2;
228 } encue_t;
229
230 typedef struct
231 {
232 e_t f;
233 } se_t;
234
235 double square_encu(encu_t *eu);
236 double square_unencu(int t, [switch_is(t)] unencu_t *eu);
237 int sum_parr(int *a[3]);
238 int sum_pcarr([size_is(n)] int *a[], int n);
239 int enum_ord(e_t e);
240 double square_encue(encue_t *eue);
241 void check_se2(se_t *s);
242
243 int sum_toplev_conf_2n([size_is(n * 2)] int *x, int n);
244 int sum_toplev_conf_cond([size_is(c ? a : b)] int *x, int a, int b, int c);
245
246 typedef struct
247 {
248 char c;
249 int i;
250 short s;
251 double d;
252 } aligns_t;
253
254 double sum_aligns(aligns_t *a);
255
256 typedef struct
257 {
258 int i;
259 char c;
260 } padded_t;
261
262 int sum_padded(padded_t *p);
263 int sum_padded2(padded_t ps[2]);
264 int sum_padded_conf([size_is(n)] padded_t *ps, int n);
265
266 typedef struct
267 {
268 int *p1;
269 } bogus_helper_t;
270
271 typedef struct
272 {
273 bogus_helper_t h;
274 int *p2;
275 int *p3;
276 char c;
277 } bogus_t;
278
279 int sum_bogus(bogus_t *b);
280 void check_null([unique] int *null);
281
282 typedef struct
283 {
284 str_t s;
285 } str_struct_t;
286
287 typedef struct
288 {
289 wstr_t s;
290 } wstr_struct_t;
291
292 int str_struct_len(str_struct_t *s);
293 int wstr_struct_len(wstr_struct_t *s);
294
295 typedef struct
296 {
297 unsigned int n;
298 [size_is(n)] byte a[];
299 } doub_carr_1_t;
300
301 typedef struct
302 {
303 int n;
304 [size_is(n)] doub_carr_1_t *a[];
305 } doub_carr_t;
306
307 int sum_doub_carr(doub_carr_t *dc);
308 void make_pyramid_doub_carr(unsigned char n, [out] doub_carr_t **dc);
309
310 typedef struct
311 {
312 short n;
313 [size_is(n)] short data[];
314 } user_bstr_t;
315
316 typedef [unique] user_bstr_t *wire_bstr_t;
317 typedef [wire_marshal(wire_bstr_t)] short *bstr_t;
318 unsigned hash_bstr(bstr_t s);
319 void get_a_bstr([out]bstr_t *s);
320 typedef struct
321 {
322 [string, size_is(size)] char *name;
323 unsigned int size;
324 } name_t;
325 void get_name([in,out] name_t *name);
326
327 int sum_pcarr2(int n, [size_is(, n)] int **pa);
328 int sum_L1_norms(int n, [size_is(n)] vector_t *vs);
329
330 /* Don't use this except in the get_s123 test. */
331 typedef struct
332 {
333 int f1;
334 int f2;
335 int f3;
336 } s123_t;
337
338 /* Make sure WIDL generates a type format string for a previously unseen
339 type as a return value. */
340 s123_t *get_s123(void);
341
342 typedef struct
343 {
344 unsigned int length;
345 unsigned int size;
346 [size_is(size), length_is(length)] pints_t numbers[];
347 } numbers_struct_t;
348
349 void get_numbers([in] int length, [in] int size, [out, length_is(length), size_is(size)] pints_t pn[]);
350 void get_numbers_struct([out] numbers_struct_t **ns);
351
352 str_t get_filename(void);
353
354 enum renum
355 {
356 RE0,
357 RE1,
358 RE2,
359 RE3,
360 };
361 const int RE_MIN = RE0;
362 const int RE_MAX = RE3;
363 typedef [range(RE_MIN, RE_MAX)] enum renum renum_t;
364 typedef [range(0, 100)] int rint_t;
365 rint_t echo_ranged_int([range(0, 100)] int n);
366 void get_ranged_enum([out] renum_t *re);
367
368 void context_handle_test(void);
369
370 void full_pointer_test([in, ptr] int *a, [in, ptr] int *b);
371 void full_pointer_null_test([in, ptr] int *a, [in, ptr] int *b);
372
373 void authinfo_test(unsigned int protseq, int secure);
374
375 void stop(void);
376 }