s4 dns: Support TXT queries
[Samba/gebeck_regimport.git] / testprogs / win32 / midltests / todo / midltests-pipe-sync-ndr32-downgrade-02.idl
blob760401e412f9d8a54f57b13c32aab6e4e8584ba9
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 pointer_default(unique)
31 interface midltests
33 typedef pipe char pipe_char;
34 typedef pipe hyper pipe_hyper;
35 typedef struct {
36 long l;
37 short s;
38 } structtype;
39 typedef pipe structtype pipe_structtype;
41 struct msg {
42 long l;
43 [size_is(l)] char *m;
46 long midltests_fn(
47 [out,ref] struct msg *out1,
48 [out] pipe_structtype outp,
49 [in] pipe_structtype inp,
50 [in] struct msg in1
53 long midltests_ping( [in] struct msg in1);
57 #elif MIDLTESTS_C_CODE
59 struct pipe_char_state {
60 const char *name;
61 unsigned long count;
62 unsigned long sleep;
65 void pipe_char_pull(
66 char * _state,
67 unsigned char * buf,
68 unsigned long esize,
69 unsigned long * ecount)
71 struct pipe_char_state *state = (struct pipe_char_state *)_state;
73 printf("pull1:%s: esize[%u] ecount[%u]\n",
74 state->name, esize, *ecount);
75 *ecount = state->count--;
76 if (*ecount > esize) {
77 *ecount = esize;
79 memset(buf, 0xDD, *ecount * sizeof(*buf));
80 printf("pull2:%s: esize[%u] ecount[%u]\n",
81 state->name, esize, *ecount);
84 void pipe_char_push(
85 char * _state,
86 unsigned char * buf,
87 unsigned long ecount)
89 struct pipe_char_state *state = (struct pipe_char_state *)_state;
91 printf("push:%s: ecount[%u]\n",
92 state->name, ecount);
95 void pipe_char_alloc(
96 char * _state,
97 unsigned long bsize,
98 unsigned char * * buf,
99 unsigned long * bcount)
101 struct pipe_char_state *state = (struct pipe_char_state *)_state;
103 printf("alloc1:%s: bsize[%u], bcount[%u]\n",
104 state->name, bsize, *bcount);
105 *bcount = bsize / sizeof(**buf);
106 *buf = malloc(*bcount * sizeof(**buf));
107 printf("alloc2:%s: bsize[%u], bcount[%u]\n",
108 state->name, bsize, *bcount);
111 struct pipe_hyper_state {
112 const char *name;
113 unsigned long count;
114 unsigned long sleep;
117 void pipe_hyper_pull(
118 char * _state,
119 hyper * buf,
120 unsigned long esize,
121 unsigned long * ecount)
123 struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
125 printf("pull1:%s: esize[%u] ecount[%u]\n",
126 state->name, esize, *ecount);
127 *ecount = state->count--;
128 if (*ecount > esize) {
129 *ecount = esize;
131 memset(buf, 0xDD, *ecount * sizeof(*buf));
132 printf("pull2:%s: esize[%u] ecount[%u]\n",
133 state->name, esize, *ecount);
136 void pipe_hyper_push(
137 char * _state,
138 hyper * buf,
139 unsigned long ecount)
141 struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
143 printf("push:%s: ecount[%u]\n",
144 state->name, ecount);
147 void pipe_hyper_alloc(
148 char * _state,
149 unsigned long bsize,
150 hyper * * buf,
151 unsigned long * bcount)
153 struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
155 printf("alloc1:%s: bsize[%u], bcount[%u]\n",
156 state->name, bsize, *bcount);
157 *bcount = bsize / sizeof(**buf);
158 *buf = malloc(*bcount * sizeof(**buf));
159 printf("alloc2:%s: bsize[%u], bcount[%u]\n",
160 state->name, bsize, *bcount);
162 struct pipe_structtype_state {
163 const char *name;
164 unsigned long count;
165 unsigned long sleep;
168 void pipe_structtype_pull(
169 char * _state,
170 structtype * buf,
171 unsigned long esize,
172 unsigned long * ecount)
174 struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
176 printf("pull1:%s: esize[%u] ecount[%u]\n",
177 state->name, esize, *ecount);
178 *ecount = state->count--;
179 if (*ecount > esize) {
180 *ecount = esize;
182 memset(buf, 0xDD, *ecount * sizeof(*buf));
183 printf("pull2:%s: esize[%u] ecount[%u]\n",
184 state->name, esize, *ecount);
187 void pipe_structtype_push(
188 char * _state,
189 structtype * buf,
190 unsigned long ecount)
192 struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
194 printf("push:%s: ecount[%u]\n",
195 state->name, ecount);
198 void pipe_structtype_alloc(
199 char * _state,
200 unsigned long bsize,
201 structtype * * buf,
202 unsigned long * bcount)
204 struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
206 printf("alloc1:%s: bsize[%u], bcount[%u]\n",
207 state->name, bsize, *bcount);
208 *bcount = bsize / sizeof(**buf);
209 *buf = malloc(*bcount * sizeof(**buf));
210 printf("alloc2:%s: bsize[%u], bcount[%u]\n",
211 state->name, bsize, *bcount);
213 static void midltests(void)
215 struct msg out1;
216 unsigned char out1b[3];
217 struct pipe_structtype_state outs;
218 pipe_structtype outp;
219 struct pipe_structtype_state ins;
220 pipe_structtype inp;
221 struct msg in1;
222 unsigned char in1b[5000];
224 in1.l = sizeof(in1b);
225 memset(&in1b, 0xAA, sizeof(in1b));
226 in1.m = in1b;
228 memset(&outs, 0, sizeof(outs));
229 outs.name = "outp";
230 memset(&outp, 0, sizeof(outp));
231 outp.pull = pipe_structtype_pull;
232 outp.push = pipe_structtype_push;
233 outp.alloc = pipe_structtype_alloc;
234 outp.state = (char *)&outs;
236 memset(&ins, 0, sizeof(ins));
237 ins.name = "inp";
238 ins.count = 100;
239 memset(&inp, 0, sizeof(inp));
240 inp.pull = pipe_structtype_pull;
241 inp.push = pipe_structtype_push;
242 inp.alloc = pipe_structtype_alloc;
243 inp.state = (char *)&ins;
245 out1.l = sizeof(out1b);
246 memset(&out1b, 0xFF, sizeof(out1b));
247 out1.m = out1b;
249 cli_midltests_ping(in1);
250 cli_midltests_fn(&out1, outp, inp, in1);
253 long srv_midltests_fn(
254 /* [ref][out] */ struct msg *out1,
255 /* [out] */ pipe_structtype outp,
256 /* [in] */ pipe_structtype inp,
257 /* [in] */ struct msg in1)
259 structtype inb[500];
260 unsigned long inb_len = 0;
261 structtype *outb = NULL;
262 unsigned long outb_size = 0;
263 unsigned long outb_len = 0;
265 printf("srv_midltests_fn: Start\n");
267 do {
268 inp.pull(inp.state, inb, sizeof(inb), &inb_len);
269 printf("pull inp_len[%u]\n", inb_len);
270 } while (inb_len > 0);
272 outb_size = 5;
273 do {
274 outp.alloc(outp.state, outb_size, &outb, &outb_len);
275 memset(outb, 0xCC, outb_len * sizeof(*outb));
276 outp.push(outp.state, outb, outb_len);
277 printf("push outb_len[%u]\n", outb_len);
278 //Sleep(1000);
279 outb_size--;
280 } while (outb_len > 0);
282 out1->l = 3;
283 out1->m = (unsigned char *)malloc(out1->l);
284 memset(out1->m, 0xBB, out1->l);
285 printf("srv_midltests_fn: End\n");
286 return 0x65757254;
289 long srv_midltests_ping(
290 /* [in] */ struct msg in1)
292 printf("srv_midltests_fn: Start\n");
293 printf("srv_midltests_fn: End\n");
294 return 0x65757254;
296 #endif