r6018: Add idl and server side for Test_Surrounding
[samba.git] / testprogs / win32 / rpcecho / 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 ]
25 interface rpcecho
26 {
27         // Add one to an integer
28         void AddOne(
29                 [in] int in_data,
30                 [out] int *out_data
31         );
32         // Echo an array of bytes back at the caller
33         void EchoData(
34                 [in] int len,
35                 [in] [size_is(len)] char in_data[],
36                 [out] [size_is(len)] char out_data[]
37         );
38         // Sink data to the server
39         void SinkData(
40                 [in] int len,
41                 [in] [size_is(len)] char in_data[]
42         );
43         // Source data from server
44         void SourceData(
45                 [in] int len,
46                 [out] [size_is(len)] char out_data[]
47         );
48
49 #define unistr [string] wchar_t *
50 #define uint8 char
51 #define uint16 short
52 #define uint32 long
53 #define HYPER_T hyper
54
55         const long myconstant = 42;
56
57         /* test strings */
58         void TestCall (
59                 [in]   unistr *s1,
60                 [out]  unistr *s2
61                 );
62
63
64         /* test some alignment issues */
65         typedef struct {
66                 uint8 v;
67         } echo_info1;
68
69         typedef struct {
70                 uint16 v;
71         } echo_info2;
72
73         typedef struct {
74                 uint32 v;
75         } echo_info3;
76
77         typedef struct {
78                 HYPER_T v;
79         } echo_info4;
80
81         typedef struct {
82                 uint8 v1;
83                 HYPER_T v2;
84         } echo_info5;
85
86         typedef struct {
87                 uint8 v1;
88                 echo_info1 info1;
89         } echo_info6;
90
91         typedef struct {
92                 uint8 v1;
93                 echo_info4 info4;
94         } echo_info7;
95
96         typedef union {
97                 [case(1)]  echo_info1 info1;
98                 [case(2)]  echo_info2 info2;
99                 [case(3)]  echo_info3 info3;
100                 [case(4)]  echo_info4 info4;
101                 [case(5)]  echo_info5 info5;
102                 [case(6)]  echo_info6 info6;
103                 [case(7)]  echo_info7 info7;
104         } echo_Info;
105
106         long TestCall2 (
107                 [in]                     uint16 level,
108                 [out,switch_is(level)]   echo_Info **info
109                 );
110
111         long TestSleep(
112                 [in] long seconds
113                 );
114
115         typedef enum {
116                 ECHO_ENUM1 = 1,
117                 ECHO_ENUM2 = 2
118         } echo_Enum1;
119
120         typedef [v1_enum] enum {
121                 ECHO_ENUM1_32 = 1,
122                 ECHO_ENUM2_32 = 2
123         } echo_Enum1_32;
124
125         typedef struct {
126                 echo_Enum1 e1;
127                 echo_Enum1_32 e2;
128         } echo_Enum2;
129
130         typedef union {
131                 [case(ECHO_ENUM1)] echo_Enum1 e1;
132                 [case(ECHO_ENUM2)] echo_Enum2 e2;
133         } echo_Enum3;
134
135         void echo_TestEnum(
136                 [in,out,ref] echo_Enum1 *foo1,
137                 [in,out,ref] echo_Enum2 *foo2,
138                 [in,out,ref,switch_is(*foo1)] echo_Enum3 *foo3
139                 );
140
141         typedef struct {
142                 uint32 x;
143                 [size_is(x)] uint16 surrounding[*];
144         } echo_Surrounding;
145
146         void echo_TestSurrounding(
147                 [in,out,ref] echo_Surrounding *data
148         );
149 }