pidl:NDR/Parser: correctly set $ndr->[relative_highest_]offset for relative_short...
[Samba/gebeck_regimport.git] / testprogs / win32 / midltests / valid / midltests_union_align_17.idl
blobf1514527dc6619993ab02e50a8ccdd4a4b7d6f09
1 #ifndef MIDLTESTS_C_CODE
3 /*
4 * For midltests_tcp.exe you may want to
5 * redirect the traffic via rinetd
6 * with a /etc/rinetd.conf like this:
8 * 172.31.9.1 5032 172.31.9.8 5032
9 * 172.31.9.1 5064 172.31.9.8 5064
11 * This is useful to watch the traffic with
12 * a network sniffer.
15 cpp_quote("#define LISTEN_IP \"0.0.0.0\"")
16 cpp_quote("#define FORWARD_IP \"127.0.0.1\"")
17 cpp_quote("#define CONNECT_IP \"172.31.9.1\"")
21 * With midltests_tcp.exe NDR64 is enforced by default.
22 * For testing it might be needed to allow downgrades
23 * to NDR32. This is needed when you use 'pipe'.
25 //cpp_quote("#define DONOT_FORCE_NDR64 1")
28 uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
29 ms_union,
30 pointer_default(unique)
32 interface midltests
34 enum level_enum { ZERO = 0, ONE = 1, TWO = 2, FOUR = 4, EIGHT = 8 };
36 [switch_type(enum level_enum)] union u {
37 [case(ZERO)];
38 [case(ONE)] char c;
39 [case(TWO)] short s;
40 [case(FOUR)] long l;
41 [case(EIGHT)] hyper h;
44 struct us {
45 enum level_enum level;
46 [switch_is(level)] union {
47 [case(ZERO)];
48 [case(ONE)] char c;
49 [case(TWO)] short s;
50 [case(FOUR)] long l;
51 [case(EIGHT)] hyper h;
52 } u;
55 void midltests_fn(
56 [in,ref] enum level_enum *level,
57 [in,switch_is(*level)] union u u,
58 [out,ref] struct us *us,
59 [in,out,ref] char *c
63 #elif MIDLTESTS_C_CODE
65 static void midltests(void)
67 enum level_enum level;
68 char c = 'c';
69 struct us us;
70 union u u;
71 u.h = 0xFFFFFFFFFFFFFFFFLL;
73 level = ZERO;
74 cli_midltests_fn(&level, u, &us, &c);
75 level = ONE;
76 cli_midltests_fn(&level, u, &us, &c);
77 level = TWO;
78 cli_midltests_fn(&level, u, &us, &c);
79 level = FOUR;
80 cli_midltests_fn(&level, u, &us, &c);
81 level = EIGHT;
82 cli_midltests_fn(&level, u, &us, &c);
85 void srv_midltests_fn(enum level_enum *level, union u u, struct us *us, char *c)
87 printf("srv_midltests_fn: Start\n");
88 us->level = *level;
89 us->u.h = u.h;
90 printf("srv_midltests_fn: End\n");
91 return;
94 #endif