b147514f58b35dc32afa59100ddc5c08ba79fe7c
[metze/samba/wip.git] / testprogs / win32 / rpcecho-win32-pipe / rpcecho.idl
1 /*
2    RPC echo IDL.
3
4    Copyright (C) Tim Potter 2003
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program 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
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 [
22 uuid(60a15ec5-4de8-11d7-a637-005056a20182),
23 version(1.0),
24 /*  uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
25   version(4.0),
26 */  pointer_default(unique)
27 ]
28 interface rpcecho
29 {
30 #define unistr [string] wchar_t *
31 #define uint8 char
32 #define uint16 short
33 #define uint32 long
34 #define HYPER_T hyper
35         // Add one to an integer
36         void AddOne(
37                 [in] uint32 in_data,
38                 [out] int *out_data
39         );
40         // Echo an array of bytes back at the caller
41         void EchoData(
42                 [in] int len,
43                 [in] [size_is(len)] char in_data[],
44                 [out] [size_is(len)] char out_data[]
45         );
46         // Sink data to the server
47         void SinkData(
48                 [in] int len,
49                 [in] [size_is(len)] char in_data[]
50         );
51         // Source data from server
52         void SourceData(
53                 [in] int len,
54                 [out] [size_is(len)] char out_data[]
55         );
56
57         const long myconstant = 42;
58
59         /* test strings */
60         void TestCall (
61                 [in]   unistr *s1,
62                 [out]  unistr *s2
63                 );
64
65
66         /* test some alignment issues */
67         typedef struct {
68                 uint8 v;
69         } echo_info1;
70
71         typedef struct {
72                 uint16 v;
73         } echo_info2;
74
75         typedef struct {
76                 uint32 v;
77         } echo_info3;
78
79         typedef struct {
80                 HYPER_T v;
81         } echo_info4;
82
83         typedef struct {
84                 uint8 v1;
85                 HYPER_T v2;
86         } echo_info5;
87
88         typedef struct {
89                 uint8 v1;
90                 echo_info1 info1;
91         } echo_info6;
92
93         typedef struct {
94                 uint8 v1;
95                 echo_info4 info4;
96         } echo_info7;
97
98         typedef union {
99                 [case(1)]  echo_info1 info1;
100                 [case(2)]  echo_info2 info2;
101                 [case(3)]  echo_info3 info3;
102                 [case(4)]  echo_info4 info4;
103                 [case(5)]  echo_info5 info5;
104                 [case(6)]  echo_info6 info6;
105                 [case(7)]  echo_info7 info7;
106         } echo_Info;
107
108         long TestCall2 (
109                 [in]                     uint16 level,
110                 [out,switch_is(level)]   echo_Info **info
111                 );
112
113         long TestSleep(
114                 [in] long seconds
115                 );
116
117         typedef enum {
118                 ECHO_ENUM1 = 1,
119                 ECHO_ENUM2 = 2
120         } Enum1;
121
122         typedef [v1_enum] enum {
123                 ECHO_ENUM1_32 = 1,
124                 ECHO_ENUM2_32 = 2
125         } Enum1_32;
126
127         typedef struct {
128                 Enum1 e1;
129                 Enum1_32 e2;
130         } Enum2;
131
132         typedef union {
133                 [case(ECHO_ENUM1)] Enum1 e1;
134                 [case(ECHO_ENUM2)] Enum2 e2;
135         } Enum3;
136
137         void TestEnum(
138                 [in,out,ref] Enum1 *foo1,
139                 [in,out,ref] Enum2 *foo2,
140                 [in,out,ref,switch_is(*foo1)] Enum3 *foo3
141                 );
142
143         typedef struct {
144                 uint32 x;
145                 [size_is(x)] uint16 surrounding[*];
146         } Surrounding;
147
148         void TestSurrounding(
149                 [in,out,ref] Surrounding *data
150         );
151
152         uint16 TestDoublePointer([in,ref] uint16 ***data);
153
154         typedef pipe byte BYTE_PIPE;
155
156         long TestBytePipeIn(
157                 [in] long count,
158                 [in,ref] BYTE_PIPE *in_pipe
159                 );
160 #if 0
161         long TestBytePipeOut(
162                 [in] long count,
163                 [out,ref] BYTE_PIPE *out_pipe
164                 );
165
166         long TestBytePipeInOut(
167                 [in] long count,
168                 [in,out,ref] BYTE_PIPE *in_out_pipe
169                 );
170 #endif
171 }