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#pragma makedep client
22#pragma makedep server
23
24import "objidl.idl";
25
26#include "server_defines.h"
27
28#ifndef IFACE_NAME
29#define IFACE_NAME IMixedServer
30#endif
31
32#ifndef IFACE_HANDLE
33#define IFACE_HANDLE IMixedServer_IfHandle
34#endif
35
36#ifndef ISERVER_UUID
37#define ISERVER_UUID 00000000-4114-0704-2301-000000000000
38#endif
39
40cpp_quote("#ifndef SKIP_TYPE_DECLS")
41typedef struct tag_vector
42{
43  int x;
44  int y;
45  int z;
46} vector_t;
47
48typedef int fnprintf(const char *format, ...);
49cpp_quote("#endif")
50
51[
52  uuid(ISERVER_UUID),
53  implicit_handle(handle_t IFACE_HANDLE)
54]
55interface IFACE_NAME
56{
57cpp_quote("#if 0")
58  typedef wchar_t WCHAR;
59cpp_quote("#endif")
60
61cpp_quote("#ifndef SKIP_TYPE_DECLS")
62  typedef [string] char *str_t;
63  typedef [string] WCHAR *wstr_t;
64
65  typedef struct
66  {
67    int *pi;
68    int **ppi;
69    int ***pppi;
70  } pints_t;
71
72  typedef struct
73  {
74    char *pc;
75    short *ps;
76    long *pl;
77    float *pf;
78    double *pd;
79  } ptypes_t;
80
81  typedef struct
82  {
83    vector_t *pu;
84    vector_t **pv;
85  } pvectors_t;
86
87  typedef struct
88  {
89    [switch_is(s)] union
90    {
91      [case(SUN_I)] int i;
92      [case(SUN_F1, SUN_F2)] float f;
93      [case(SUN_PI)] int *pi;
94    } u;
95
96    int s;
97  } sun_t;
98cpp_quote("#endif")
99
100  int int_return(void);
101  int square(int x);
102  int sum(int x, int y);
103  signed char sum_char(signed char x, signed char y);
104  short sum_short(short x, short y);
105  int sum_float(float x, float y);
106  int sum_double_int(int x, double y);
107  hyper sum_hyper(hyper x, hyper y);
108  int sum_hyper_int(hyper x, hyper y);
109  int sum_char_hyper(signed char x, hyper y);
110  void square_out(int x, [out] int *y);
111  void square_ref([in, out] int *x);
112  int str_length([string] const char *s);
113  int str_t_length(str_t s);
114  int cstr_length([string, size_is(n)] const char *s, int n);
115  int dot_self(vector_t *v);
116  double square_half(double x, [out] double *y);
117  float square_half_float(float x, [out] float *y);
118  long square_half_long(long x, [out] long *y);
119  int sum_fixed_array(int a[5]);
120  int pints_sum(pints_t *pints);
121  double ptypes_sum(ptypes_t *ptypes);
122  int dot_pvectors(pvectors_t *pvectors);
123
124cpp_quote("#ifndef SKIP_TYPE_DECLS")
125  /* don't use this anywhere except in sp_t */
126  typedef struct
127  {
128    int x;
129  } sp_inner_t;
130
131  typedef struct
132  {
133    int x;
134    sp_inner_t *s;
135  } sp_t;
136cpp_quote("#endif")
137
138  int sum_sp(sp_t *sp);
139  double square_sun(sun_t *su);
140
141cpp_quote("#ifndef SKIP_TYPE_DECLS")
142  typedef struct test_list
143  {
144    int t;
145    [switch_is(t)] union
146    {
147      [case(TL_NULL)] char x;  /* end of list */
148      [case(TL_LIST)] struct test_list *tail;
149    } u;
150  } test_list_t;
151
152  typedef [ref] int *refpint_t;
153cpp_quote("#endif")
154
155  int test_list_length(test_list_t *ls);
156  int sum_fixed_int_3d(int m[2][3][4]);
157  int sum_conf_array([size_is(n)] int x[], int n);
158  int sum_conf_ptr_by_conf_ptr(int n1, [size_is(n1)] int *n2_then_x1, [size_is(*n2_then_x1)] int *x2);
159  int sum_unique_conf_array([size_is(n), unique] int x[], int n);
160  int sum_unique_conf_ptr([size_is(n), unique] int *x, int n);
161  int sum_var_array([length_is(n)] int x[20], int n);
162  int dot_two_vectors(vector_t vs[2]);
163  void get_number_array([out, length_is(*n)] int x[20], [out] int *n);
164
165cpp_quote("#ifndef SKIP_TYPE_DECLS")
166  typedef struct
167  {
168    int n;
169    [size_is(n)] int ca[];
170  } cs_t;
171
172  typedef struct
173  {
174    int *pn;
175    [size_is(*pn)] int *ca1;
176    [size_is(n * 2)] int *ca2;
177    int n;
178  } cps_t;
179
180  typedef struct
181  {
182    [size_is(c ? a : b)] int *ca;
183    int a;
184    int b;
185    int c;
186  } cpsc_t;
187cpp_quote("#endif")
188
189  int sum_cs(cs_t *cs);
190  int sum_cps(cps_t *cps);
191  int sum_cpsc(cpsc_t *cpsc);
192  int get_cpsc(int n, [out] cpsc_t *cpsc );
193  int sum_complex_array(int n, [size_is(n)] refpint_t pi[]);
194
195cpp_quote("#ifndef SKIP_TYPE_DECLS")
196  typedef [wire_marshal(int)] void *puint_t;
197cpp_quote("#endif")
198  int square_puint(puint_t p);
199
200cpp_quote("#ifndef SKIP_TYPE_DECLS")
201  typedef struct
202  {
203    [size_is(n)] puint_t *ps;
204    int n;
205  } puints_t;
206
207  /* Same thing as puints_t, but make it complex (needs padding).  */
208  typedef struct
209  {
210    [size_is(n)] puint_t *ps;
211    char n;
212  } cpuints_t;
213cpp_quote("#endif")
214
215  int sum_puints(puints_t *p);
216  int sum_cpuints(cpuints_t *p);
217  int dot_copy_vectors(vector_t u, vector_t v);
218
219cpp_quote("#ifndef SKIP_TYPE_DECLS")
220  typedef struct wire_us *wire_us_t;
221  typedef [wire_marshal(wire_us_t)] struct us us_t;
222  struct us
223  {
224    void *x;
225  };
226  struct wire_us
227  {
228    int x;
229  };
230  typedef struct
231  {
232    us_t us;
233  } test_us_t;
234cpp_quote("#endif")
235
236  int square_test_us(test_us_t *tus);
237
238cpp_quote("#ifndef SKIP_TYPE_DECLS")
239  typedef union encu switch (int t)
240  {
241  case ENCU_I: int i;
242  case ENCU_F: float f;
243  } encu_t;
244
245  typedef [switch_type(int)] union unencu
246  {
247    [case (ENCU_I)] int i;
248    [case (ENCU_F)] float f;
249  } unencu_t;
250
251  typedef enum
252  {
253    E1 = 23,
254    E2 = 4,
255    E3 = 0,
256    E4 = 64
257  } e_t;
258
259  typedef union encue switch (e_t t)
260  {
261  case E1: int i1;
262  case E2: float f2;
263  } encue_t;
264
265  typedef struct
266  {
267    e_t f;
268  } se_t;
269cpp_quote("#endif")
270
271  double square_encu(encu_t *eu);
272  double square_unencu(int t, [switch_is(t)] unencu_t *eu);
273  int sum_parr(int *a[3]);
274  int sum_pcarr([size_is(n)] int *a[], int n);
275  int enum_ord(e_t e);
276  double square_encue(encue_t *eue);
277  void check_se2(se_t *s);
278
279  int sum_toplev_conf_2n([size_is(n * 2)] int *x, int n);
280  int sum_toplev_conf_cond([size_is(c ? a : b)] int *x, int a, int b, int c);
281
282cpp_quote("#ifndef SKIP_TYPE_DECLS")
283  typedef struct
284  {
285    char c;
286    int i;
287    short s;
288    double d;
289  } aligns_t;
290cpp_quote("#endif")
291
292  double sum_aligns(aligns_t *a);
293
294cpp_quote("#ifndef SKIP_TYPE_DECLS")
295  typedef struct
296  {
297    int i;
298    char c;
299  } padded_t;
300cpp_quote("#endif")
301
302  int sum_padded(padded_t *p);
303  int sum_padded2(padded_t ps[2]);
304  int sum_padded_conf([size_is(n)] padded_t *ps, int n);
305
306cpp_quote("#ifndef SKIP_TYPE_DECLS")
307  typedef struct
308  {
309    int *p1;
310  } bogus_helper_t;
311
312  typedef struct
313  {
314    bogus_helper_t h;
315    int *p2;
316    int *p3;
317    char c;
318  } bogus_t;
319cpp_quote("#endif")
320
321  int sum_bogus(bogus_t *b);
322  void check_null([unique] int *null);
323
324cpp_quote("#ifndef SKIP_TYPE_DECLS")
325  typedef struct
326  {
327    str_t s;
328  } str_struct_t;
329
330  typedef struct
331  {
332    wstr_t s;
333  } wstr_struct_t;
334cpp_quote("#endif")
335
336  int str_struct_len(str_struct_t *s);
337  int wstr_struct_len(wstr_struct_t *s);
338
339cpp_quote("#ifndef SKIP_TYPE_DECLS")
340  typedef struct
341  {
342    unsigned int n;
343    [size_is(n)] byte a[];
344  } doub_carr_1_t;
345
346  typedef struct
347  {
348    int n;
349    [size_is(n)] doub_carr_1_t *a[];
350  } doub_carr_t;
351cpp_quote("#endif")
352
353  int sum_doub_carr(doub_carr_t *dc);
354  void make_pyramid_doub_carr(unsigned char n, [out] doub_carr_t **dc);
355
356cpp_quote("#ifndef SKIP_TYPE_DECLS")
357  typedef struct
358  {
359    short n;
360    [size_is(n)] short data[];
361  } user_bstr_t;
362
363  typedef [unique] user_bstr_t *wire_bstr_t;
364  typedef [wire_marshal(wire_bstr_t)] short *bstr_t;
365cpp_quote("#endif")
366  unsigned hash_bstr(bstr_t s);
367  void get_a_bstr([out]bstr_t *s);
368cpp_quote("#ifndef SKIP_TYPE_DECLS")
369  typedef struct
370  {
371    [string, size_is(size)] char *name;
372    unsigned int size;
373  } name_t;
374cpp_quote("#endif")
375  void get_name([in,out] name_t *name);
376
377cpp_quote("#ifndef SKIP_TYPE_DECLS")
378  typedef char **str_array_t;
379  typedef WCHAR **wstr_array_t;
380cpp_quote("#endif")
381  void get_names([out] int *n, [out, string, size_is(,*n)] str_array_t *names);
382  void get_namesw([out] int *n, [out, string, size_is(,*n)] wstr_array_t *names);
383
384  int sum_pcarr2(int n, [size_is(, n)] int **pa);
385  int sum_L1_norms(int n, [size_is(n)] vector_t *vs);
386
387cpp_quote("#ifndef SKIP_TYPE_DECLS")
388  /* Don't use this except in the get_s123 test.  */
389  typedef struct
390  {
391    int f1;
392    int f2;
393    int f3;
394  } s123_t;
395cpp_quote("#endif")
396
397  /* Make sure WIDL generates a type format string for a previously unseen
398     type as a return value.  */
399  s123_t *get_s123(void);
400
401cpp_quote("#ifndef SKIP_TYPE_DECLS")
402  typedef struct
403  {
404    unsigned int length;
405    unsigned int size;
406    [size_is(size), length_is(length)] pints_t numbers[];
407  } numbers_struct_t;
408cpp_quote("#endif")
409
410  void get_numbers([in] int length, [in] int size, [out, length_is(length), size_is(size)] pints_t pn[]);
411  void get_numbers_struct([out] numbers_struct_t **ns);
412
413  str_t get_filename(void);
414
415cpp_quote("#ifndef SKIP_TYPE_DECLS")
416  enum renum
417  {
418    RE0,
419    RE1,
420    RE2,
421    RE3,
422  };
423  const int RE_MIN = RE0;
424  const int RE_MAX = RE3;
425  typedef [range(RE_MIN, RE_MAX)] enum renum renum_t;
426  typedef [range(0, 100)] int rint_t;
427cpp_quote("#endif")
428  rint_t echo_ranged_int([range(0, 10)] int i, [range(0, 20)] int j, [range(0, 100)] int k);
429  rint_t echo_ranged_int2([range(0, 40)] int i);
430  void get_ranged_enum([out] renum_t *re);
431
432  void context_handle_test(void);
433
434  void full_pointer_test([in, ptr] int *a, [in, ptr] int *b);
435  void full_pointer_null_test([in, ptr] int *a, [in, ptr] int *b);
436
437  void authinfo_test(unsigned int protseq, int secure);
438
439  void stop(void);
440  void stop_autolisten(void);
441
442cpp_quote("#ifndef SKIP_TYPE_DECLS")
443  typedef union ipu switch(int t)
444  {
445    default: IStream *stream;
446  } ipu_t;
447cpp_quote("#endif")
448
449  void ip_test([in] ipu_t *a);
450
451  int sum_ptr_array([in] int *a[2]);
452  int sum_array_ptr([in] int (*a)[2]);
453
454cpp_quote("#ifndef SKIP_TYPE_DECLS")
455  typedef [context_handle] void *ctx_handle_t;
456cpp_quote("#endif")
457
458  ctx_handle_t get_handle();
459  void get_handle_by_ptr([out] ctx_handle_t *r);
460  void test_handle(ctx_handle_t ctx_handle);
461}
462