s4-kdc: Give information on how long the password history is
[Samba/gebeck_regimport.git] / testprogs / win32 / midltests / todo / midltests-pipe-04-struct.idl
blob07921b820e48ba1150e2329b79d858bcc32ec046
1 #ifndef MIDLTESTS_C_CODE
4 uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
5 pointer_default(unique)
7 interface midltests
9 typedef pipe char pipe_char;
10 typedef pipe hyper pipe_hyper;
11 typedef struct {
12 long l;
13 short s;
14 } structtype;
15 typedef pipe structtype pipe_structtype;
17 struct msg {
18 long l;
19 [size_is(l)] char *m;
22 long midltests_fn(
23 [out,ref] struct msg *out1,
24 [out] pipe_structtype outp,
25 [in] pipe_structtype inp,
26 [in] struct msg in1
29 long midltests_ping( [in] struct msg in1);
33 #elif MIDLTESTS_C_CODE
35 struct pipe_char_state {
36 const char *name;
37 unsigned long count;
38 unsigned long sleep;
41 void pipe_char_pull(
42 char * _state,
43 unsigned char * buf,
44 unsigned long esize,
45 unsigned long * ecount)
47 struct pipe_char_state *state = (struct pipe_char_state *)_state;
49 printf("pull1:%s: esize[%u] ecount[%u]\n",
50 state->name, esize, *ecount);
51 *ecount = state->count--;
52 if (*ecount > esize) {
53 *ecount = esize;
55 memset(buf, 0xDD, *ecount * sizeof(*buf));
56 printf("pull2:%s: esize[%u] ecount[%u]\n",
57 state->name, esize, *ecount);
60 void pipe_char_push(
61 char * _state,
62 unsigned char * buf,
63 unsigned long ecount)
65 struct pipe_char_state *state = (struct pipe_char_state *)_state;
67 printf("push:%s: ecount[%u]\n",
68 state->name, ecount);
71 void pipe_char_alloc(
72 char * _state,
73 unsigned long bsize,
74 unsigned char * * buf,
75 unsigned long * bcount)
77 struct pipe_char_state *state = (struct pipe_char_state *)_state;
79 printf("alloc1:%s: bsize[%u], bcount[%u]\n",
80 state->name, bsize, *bcount);
81 *bcount = bsize / sizeof(**buf);
82 *buf = malloc(*bcount * sizeof(**buf));
83 printf("alloc2:%s: bsize[%u], bcount[%u]\n",
84 state->name, bsize, *bcount);
87 struct pipe_hyper_state {
88 const char *name;
89 unsigned long count;
90 unsigned long sleep;
93 void pipe_hyper_pull(
94 char * _state,
95 hyper * buf,
96 unsigned long esize,
97 unsigned long * ecount)
99 struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
101 printf("pull1:%s: esize[%u] ecount[%u]\n",
102 state->name, esize, *ecount);
103 *ecount = state->count--;
104 if (*ecount > esize) {
105 *ecount = esize;
107 memset(buf, 0xDD, *ecount * sizeof(*buf));
108 printf("pull2:%s: esize[%u] ecount[%u]\n",
109 state->name, esize, *ecount);
112 void pipe_hyper_push(
113 char * _state,
114 hyper * buf,
115 unsigned long ecount)
117 struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
119 printf("push:%s: ecount[%u]\n",
120 state->name, ecount);
123 void pipe_hyper_alloc(
124 char * _state,
125 unsigned long bsize,
126 hyper * * buf,
127 unsigned long * bcount)
129 struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
131 printf("alloc1:%s: bsize[%u], bcount[%u]\n",
132 state->name, bsize, *bcount);
133 *bcount = bsize / sizeof(**buf);
134 *buf = malloc(*bcount * sizeof(**buf));
135 printf("alloc2:%s: bsize[%u], bcount[%u]\n",
136 state->name, bsize, *bcount);
138 struct pipe_structtype_state {
139 const char *name;
140 unsigned long count;
141 unsigned long sleep;
144 void pipe_structtype_pull(
145 char * _state,
146 structtype * buf,
147 unsigned long esize,
148 unsigned long * ecount)
150 struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
152 printf("pull1:%s: esize[%u] ecount[%u]\n",
153 state->name, esize, *ecount);
154 *ecount = state->count--;
155 if (*ecount > esize) {
156 *ecount = esize;
158 memset(buf, 0xDD, *ecount * sizeof(*buf));
159 printf("pull2:%s: esize[%u] ecount[%u]\n",
160 state->name, esize, *ecount);
163 void pipe_structtype_push(
164 char * _state,
165 structtype * buf,
166 unsigned long ecount)
168 struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
170 printf("push:%s: ecount[%u]\n",
171 state->name, ecount);
174 void pipe_structtype_alloc(
175 char * _state,
176 unsigned long bsize,
177 structtype * * buf,
178 unsigned long * bcount)
180 struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
182 printf("alloc1:%s: bsize[%u], bcount[%u]\n",
183 state->name, bsize, *bcount);
184 *bcount = bsize / sizeof(**buf);
185 *buf = malloc(*bcount * sizeof(**buf));
186 printf("alloc2:%s: bsize[%u], bcount[%u]\n",
187 state->name, bsize, *bcount);
189 static void midltests(void)
191 struct msg out1;
192 unsigned char out1b[3];
193 struct pipe_structtype_state outs;
194 pipe_structtype outp;
195 struct pipe_structtype_state ins;
196 pipe_structtype inp;
197 struct msg in1;
198 unsigned char in1b[3];
200 in1.l = sizeof(in1b);
201 memset(&in1b, 0xAA, sizeof(in1b));
202 in1.m = in1b;
204 memset(&outs, 0, sizeof(outs));
205 outs.name = "outp";
206 memset(&outp, 0, sizeof(outp));
207 outp.pull = pipe_structtype_pull;
208 outp.push = pipe_structtype_push;
209 outp.alloc = pipe_structtype_alloc;
210 outp.state = (char *)&outs;
212 memset(&ins, 0, sizeof(ins));
213 ins.name = "inp";
214 ins.count = 1;
215 memset(&inp, 0, sizeof(inp));
216 inp.pull = pipe_structtype_pull;
217 inp.push = pipe_structtype_push;
218 inp.alloc = pipe_structtype_alloc;
219 inp.state = (char *)&ins;
221 out1.l = sizeof(out1b);
222 memset(&out1b, 0xFF, sizeof(out1b));
223 out1.m = out1b;
225 cli_midltests_ping(in1);
226 cli_midltests_fn(&out1, outp, inp, in1);
229 long srv_midltests_fn(
230 /* [ref][out] */ struct msg *out1,
231 /* [out] */ pipe_structtype outp,
232 /* [in] */ pipe_structtype inp,
233 /* [in] */ struct msg in1)
235 structtype inb[500];
236 unsigned long inb_len = 0;
237 structtype *outb = NULL;
238 unsigned long outb_size = 0;
239 unsigned long outb_len = 0;
241 printf("srv_midltests_fn: Start\n");
243 do {
244 inp.pull(inp.state, inb, sizeof(inb), &inb_len);
245 printf("pull inp_len[%u]\n", inb_len);
246 } while (inb_len > 0);
248 outb_size = 5;
249 do {
250 outp.alloc(outp.state, outb_size, &outb, &outb_len);
251 memset(outb, 0xCC, outb_len * sizeof(*outb));
252 outp.push(outp.state, outb, outb_len);
253 printf("push outb_len[%u]\n", outb_len);
254 //Sleep(1000);
255 outb_size--;
256 } while (outb_len > 0);
258 out1->l = 3;
259 out1->m = (unsigned char *)malloc(out1->l);
260 memset(out1->m, 0xBB, out1->l);
261 printf("srv_midltests_fn: End\n");
262 return 0x65757254;
265 long srv_midltests_ping(
266 /* [in] */ struct msg in1)
268 printf("srv_midltests_fn: Start\n");
269 printf("srv_midltests_fn: End\n");
270 return 0x65757254;
272 #endif