s4-kdc: Give information on how long the password history is
[Samba/gebeck_regimport.git] / testprogs / win32 / midltests / todo / midltests-pipe-02.idl
blobe6be283841967e6667603b6ff51dd1d745a6916f
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;
11 struct msg {
12 long l;
13 [size_is(l)] char *m;
16 long midltests_fn(
17 [out,ref] struct msg *out1,
18 [out] pipe_char outp,
19 [in] pipe_char inp,
20 [in] struct msg in1
24 #elif MIDLTESTS_C_CODE
26 struct pipe_char_state {
27 const char *name;
28 unsigned long count;
29 unsigned long sleep;
32 void pipe_char_pull(
33 char * _state,
34 unsigned char * buf,
35 unsigned long esize,
36 unsigned long * ecount)
38 struct pipe_char_state *state = (struct pipe_char_state *)_state;
40 printf("pull1:%s: esize[%u] ecount[%u]\n",
41 state->name, esize, *ecount);
42 *ecount = state->count--;
43 if (*ecount > esize) {
44 *ecount = esize;
46 memset(buf, 0xDD, *ecount);
47 printf("pull2:%s: esize[%u] ecount[%u]\n",
48 state->name, esize, *ecount);
51 void pipe_char_push(
52 char * _state,
53 unsigned char * buf,
54 unsigned long ecount)
56 struct pipe_char_state *state = (struct pipe_char_state *)_state;
58 printf("push:%s: ecount[%u]\n",
59 state->name, ecount);
62 void pipe_char_alloc(
63 char * _state,
64 unsigned long bsize,
65 unsigned char * * buf,
66 unsigned long * bcount)
68 struct pipe_char_state *state = (struct pipe_char_state *)_state;
70 printf("alloc1:%s: bsize[%u], bcount[%u]\n",
71 state->name, bsize, *bcount);
72 *bcount = bsize / sizeof(**buf);
73 *buf = malloc(*bcount * sizeof(**buf));
74 printf("alloc2:%s: bsize[%u], bcount[%u]\n",
75 state->name, bsize, *bcount);
78 static void midltests(void)
80 struct msg out1;
81 unsigned char out1b[3];
82 struct pipe_char_state outs;
83 pipe_char outp;
84 struct pipe_char_state ins;
85 pipe_char inp;
86 struct msg in1;
87 unsigned char in1b[3];
89 in1.l = sizeof(in1b);
90 memset(&in1b, 0xAA, sizeof(in1b));
91 in1.m = in1b;
93 memset(&outs, 0, sizeof(outs));
94 outs.name = "outp";
95 memset(&outp, 0, sizeof(outp));
96 outp.pull = pipe_char_pull;
97 outp.push = pipe_char_push;
98 outp.alloc = pipe_char_alloc;
99 outp.state = (char *)&outs;
101 memset(&ins, 0, sizeof(ins));
102 ins.name = "inp";
103 ins.count = 1;
104 memset(&inp, 0, sizeof(inp));
105 inp.pull = pipe_char_pull;
106 inp.push = pipe_char_push;
107 inp.alloc = pipe_char_alloc;
108 inp.state = (char *)&ins;
110 out1.l = sizeof(out1b);
111 memset(&out1b, 0xFF, sizeof(out1b));
112 out1.m = out1b;
114 cli_midltests_fn(&out1, outp, inp, in1);
117 long srv_midltests_fn(
118 /* [ref][out] */ struct msg *out1,
119 /* [out] */ pipe_char outp,
120 /* [in] */ pipe_char inp,
121 /* [in] */ struct msg in1)
123 char inb[500];
124 unsigned long inb_len = 0;
125 char *outb = NULL;
126 unsigned long outb_size = 0;
127 unsigned long outb_len = 0;
129 printf("srv_midltests_fn: Start\n");
131 do {
132 inp.pull(inp.state, inb, sizeof(inb), &inb_len);
133 printf("pull inp_len[%u]\n", inb_len);
134 } while (inb_len > 0);
136 outb_size = 5;
137 do {
138 outp.alloc(outp.state, outb_size, &outb, &outb_len);
139 memset(outb, 0xCC, outb_len);
140 outp.push(outp.state, outb, outb_len);
141 printf("push outb_len[%u]\n", outb_len);
142 //Sleep(1000);
143 outb_size--;
144 } while (outb_len > 0);
146 out1->l = 3;
147 out1->m = (unsigned char *)malloc(out1->l);
148 memset(out1->m, 0xBB, out1->l);
149 printf("srv_midltests_fn: End\n");
150 return 0x65757254;
153 #endif