rpcrt4: Add tests for NdrGetUserMarshalInfo.
[wine] / dlls / rpcrt4 / tests / 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 [
31   uuid(00000000-4114-0704-2301-000000000000),
32 #ifndef __midl
33   implicit_handle(handle_t IServer_IfHandle)
34 #endif
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   void square_out(int x, [out] int *y);
83   void square_ref([in, out] int *x);
84   int str_length([string] const char *s);
85   int str_t_length(str_t s);
86   int cstr_length([string, size_is(n)] const char *s, int n);
87   int dot_self(vector_t *v);
88   double square_half(double x, [out] double *y);
89   float square_half_float(float x, [out] float *y);
90   long square_half_long(long x, [out] long *y);
91   int sum_fixed_array(int a[5]);
92   int pints_sum(pints_t *pints);
93   double ptypes_sum(ptypes_t *ptypes);
94   int dot_pvectors(pvectors_t *pvectors);
95
96   /* don't use this anywhere except in sp_t */
97   typedef struct
98   {
99     int x;
100   } sp_inner_t;
101
102   typedef struct
103   {
104     int x;
105     sp_inner_t *s;
106   } sp_t;
107
108   int sum_sp(sp_t *sp);
109   double square_sun(sun_t *su);
110
111   typedef struct test_list
112   {
113     int t;
114     [switch_is(t)] union
115     {
116       [case(TL_NULL)] char x;  /* end of list */
117       [case(TL_LIST)] struct test_list *tail;
118     } u;
119   } test_list_t;
120
121   int test_list_length(test_list_t *ls);
122   int sum_fixed_int_3d(int m[2][3][4]);
123   int sum_conf_array([size_is(n)] int x[], int n);
124   int sum_conf_ptr_by_conf_ptr(int n1, [size_is(n1)] int *n2_then_x1, [size_is(*n2_then_x1)] int *x2);
125   int sum_unique_conf_array([size_is(n), unique] int x[], int n);
126   int sum_unique_conf_ptr([size_is(n), unique] int *x, int n);
127   int sum_var_array([length_is(n)] int x[20], int n);
128   int dot_two_vectors(vector_t vs[2]);
129
130   typedef struct
131   {
132     int n;
133     [size_is(n)] int ca[];
134   } cs_t;
135
136   typedef struct
137   {
138     int *pn;
139     [size_is(*pn)] int *ca1;
140     [size_is(n * 2)] int *ca2;
141     int n;
142   } cps_t;
143
144   typedef struct
145   {
146     [size_is(c ? a : b)] int *ca;
147     int a;
148     int b;
149     int c;
150   } cpsc_t;
151
152   int sum_cs(cs_t *cs);
153   int sum_cps(cps_t *cps);
154   int sum_cpsc(cpsc_t *cpsc);
155
156   typedef [wire_marshal(int)] void *puint_t;
157   int square_puint(puint_t p);
158
159   typedef struct
160   {
161     [size_is(n)] puint_t *ps;
162     int n;
163   } puints_t;
164
165   /* Same thing as puints_t, but make it complex (needs padding).  */
166   typedef struct
167   {
168     [size_is(n)] puint_t *ps;
169     char n;
170   } cpuints_t;
171
172   int sum_puints(puints_t *p);
173   int sum_cpuints(cpuints_t *p);
174   int dot_copy_vectors(vector_t u, vector_t v);
175
176   typedef struct wire_us *wire_us_t;
177   typedef [wire_marshal(wire_us_t)] struct us us_t;
178   struct us
179   {
180     void *x;
181   };
182   struct wire_us
183   {
184     int x;
185   };
186   typedef struct
187   {
188     us_t us;
189   } test_us_t;
190
191   int square_test_us(test_us_t *tus);
192
193   typedef union encu switch (int t)
194   {
195   case ENCU_I: int i;
196   case ENCU_F: float f;
197   } encu_t;
198
199   typedef [switch_type(int)] union unencu
200   {
201     [case (ENCU_I)] int i;
202     [case (ENCU_F)] float f;
203   } unencu_t;
204
205   typedef enum
206   {
207     E1 = 23,
208     E2 = 4,
209     E3 = 0,
210     E4 = 64
211   } e_t;
212
213   typedef union encue switch (e_t t)
214   {
215   case E1: int i1;
216   case E2: float f2;
217   } encue_t;
218
219   typedef struct
220   {
221     e_t f;
222   } se_t;
223
224   double square_encu(encu_t *eu);
225   double square_unencu(int t, [switch_is(t)] unencu_t *eu);
226   int sum_parr(int *a[3]);
227   int sum_pcarr([size_is(n)] int *a[], int n);
228   int enum_ord(e_t e);
229   double square_encue(encue_t *eue);
230   void check_se2(se_t *s);
231
232   int sum_toplev_conf_2n([size_is(n * 2)] int *x, int n);
233   int sum_toplev_conf_cond([size_is(c ? a : b)] int *x, int a, int b, int c);
234
235   typedef struct
236   {
237     char c;
238     int i;
239     short s;
240     double d;
241   } aligns_t;
242
243   double sum_aligns(aligns_t *a);
244
245   typedef struct
246   {
247     int i;
248     char c;
249   } padded_t;
250
251   int sum_padded(padded_t *p);
252   int sum_padded2(padded_t ps[2]);
253   int sum_padded_conf([size_is(n)] padded_t *ps, int n);
254
255   typedef struct
256   {
257     int *p1;
258   } bogus_helper_t;
259
260   typedef struct
261   {
262     bogus_helper_t h;
263     int *p2;
264     int *p3;
265     char c;
266   } bogus_t;
267
268   int sum_bogus(bogus_t *b);
269   void check_null([unique] int *null);
270
271   typedef struct
272   {
273     str_t s;
274   } str_struct_t;
275
276   typedef struct
277   {
278     wstr_t s;
279   } wstr_struct_t;
280
281   int str_struct_len(str_struct_t *s);
282   int wstr_struct_len(wstr_struct_t *s);
283
284   typedef struct
285   {
286     unsigned int n;
287     [size_is(n)] byte a[];
288   } doub_carr_1_t;
289
290   typedef struct
291   {
292     int n;
293     [size_is(n)] doub_carr_1_t *a[];
294   } doub_carr_t;
295
296   int sum_doub_carr(doub_carr_t *dc);
297   void make_pyramid_doub_carr(unsigned char n, [out] doub_carr_t **dc);
298
299   typedef struct
300   {
301     short n;
302     [size_is(n)] short data[];
303   } user_bstr_t;
304
305   typedef [unique] user_bstr_t *wire_bstr_t;
306   typedef [wire_marshal(wire_bstr_t)] short *bstr_t;
307   unsigned hash_bstr(bstr_t s);
308
309   typedef struct
310   {
311     [string, size_is(size)] char *name;
312     unsigned int size;
313   } name_t;
314   void get_name([in,out] name_t *name);
315
316   int sum_pcarr2(int n, [size_is(, n)] int **pa);
317   int sum_L1_norms(int n, [size_is(n)] vector_t *vs);
318
319   /* Don't use this except in the get_s123 test.  */
320   typedef struct
321   {
322     int f1;
323     int f2;
324     int f3;
325   } s123_t;
326
327   /* Make sure WIDL generates a type format string for a previously unseen
328      type as a return value.  */
329   s123_t *get_s123(void);
330
331   typedef struct
332   {
333     unsigned int length;
334     unsigned int size;
335     [size_is(size), length_is(length)] pints_t numbers[];
336   } numbers_struct_t;
337
338   void get_numbers([in] int length, [in] int size, [out, length_is(length), size_is(size)] pints_t pn[]);
339   void get_numbers_struct([out] numbers_struct_t **ns);
340
341   str_t get_filename(void);
342   void context_handle_test(void);
343   void stop(void);
344 }