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