From a5f0b02221cb2926b10d1cfcfb2f4ea331c66eeb Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 31 Jan 2011 11:35:43 +0100 Subject: midltests: explore 'ms_union' option. metze --- .../midltests/valid/midltests_union_align_09.idl | 69 +++++++++++ .../midltests/valid/midltests_union_align_09.txt | 129 +++++++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 testprogs/win32/midltests/valid/midltests_union_align_09.idl create mode 100644 testprogs/win32/midltests/valid/midltests_union_align_09.txt (limited to 'testprogs') diff --git a/testprogs/win32/midltests/valid/midltests_union_align_09.idl b/testprogs/win32/midltests/valid/midltests_union_align_09.idl new file mode 100644 index 0000000000..358a5983df --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_union_align_09.idl @@ -0,0 +1,69 @@ +#ifndef MIDLTESTS_C_CODE + +/* + * For midltests_tcp.exe you may want to + * redirect the traffic via rinetd + * with a /etc/rinetd.conf like this: + * + * 172.31.9.1 5032 172.31.9.8 5032 + * 172.31.9.1 5064 172.31.9.8 5064 + * + * This is useful to watch the traffic with + * a network sniffer. + */ +/* +cpp_quote("#define LISTEN_IP \"0.0.0.0\"") +cpp_quote("#define FORWARD_IP \"127.0.0.1\"") +cpp_quote("#define CONNECT_IP \"172.31.9.1\"") +*/ + +/* + * With midltests_tcp.exe NDR64 is enforced by default. + * For testing it might be needed to allow downgrades + * to NDR32. This is needed when you use 'pipe'. + */ +//cpp_quote("#define DONOT_FORCE_NDR64 1") + +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + ms_union, + pointer_default(unique) +] +interface midltests +{ + [switch_type(char)] union u { + [case(0)]; + [case(1)] char c; + [case(2)] short s; + [case(4)] long l; + [case(8)] hyper h; + }; + + long midltests_fn( + [in] char level, + [in,switch_is(level)] union u u + ); +} + +#elif MIDLTESTS_C_CODE + +static void midltests(void) +{ + union u u; + u.h = 0xFFFFFFFFFFFFFFFFLL; + + cli_midltests_fn(0, u); + cli_midltests_fn(1, u); + cli_midltests_fn(2, u); + cli_midltests_fn(4, u); + cli_midltests_fn(8, u); +} + +long srv_midltests_fn(char level, union u u) +{ + printf("srv_midltests_fn: Start\n"); + printf("srv_midltests_fn: End\n"); + return 0x65757254; +} + +#endif diff --git a/testprogs/win32/midltests/valid/midltests_union_align_09.txt b/testprogs/win32/midltests/valid/midltests_union_align_09.txt new file mode 100644 index 0000000000..5e7e192b5b --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_union_align_09.txt @@ -0,0 +1,129 @@ +Wait for setup of server threads + +Test NDR32 + +ndr32: disable NDR64 + +ndr32:in => out: ptype[request] flen[32] plen[8] ahint[8] + +[000] 00 00 00 00 00 00 00 00 ........ + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr32:in => out: ptype[request] flen[33] plen[9] ahint[9] + +[000] 01 01 00 00 00 00 00 00 FF ........ . + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr32:in => out: ptype[request] flen[34] plen[10] ahint[10] + +[000] 02 02 00 00 00 00 00 00 FF FF ........ .. + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr32:in => out: ptype[request] flen[36] plen[12] ahint[12] + +[000] 04 04 00 00 00 00 00 00 FF FF FF FF ........ .... + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr32:in => out: ptype[request] flen[40] plen[16] ahint[16] + +[000] 08 08 00 00 00 00 00 00 FF FF FF FF FF FF FF FF ........ ........ + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +NDRTcpThread[ndr32] stop + +Test NDR64 + +ndr64: got NDR64 + +ndr64:in => out: ptype[request] flen[40] plen[16] ahint[16] + +[000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........ + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr64:in => out: ptype[request] flen[41] plen[17] ahint[17] + +[000] 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ........ ........ +[010] FF . + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr64:in => out: ptype[request] flen[42] plen[18] ahint[18] + +[000] 02 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ........ ........ +[010] FF FF .. + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr64:in => out: ptype[request] flen[44] plen[20] ahint[20] + +[000] 04 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ........ ........ +[010] FF FF FF FF .... + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +ndr64:in => out: ptype[request] flen[48] plen[24] ahint[24] + +[000] 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ........ ........ +[010] FF FF FF FF FF FF FF FF ........ + +srv_midltests_fn: Start +srv_midltests_fn: End + +ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4] + +[000] 54 72 75 65 True + +NDRTcpThread[ndr64] stop + +Test OK -- cgit