1 #ifndef MIDLTESTS_C_CODE
4 uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
5 pointer_default(unique)
9 typedef pipe char pipe_char
;
17 [out,ref] struct msg
*out1
,
24 #elif MIDLTESTS_C_CODE
26 struct pipe_char_state
{
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
) {
46 memset
(buf
, 0xDD, *ecount
);
47 printf
("pull2:%s: esize[%u] ecount[%u]\n",
48 state
->name
, esize
, *ecount
);
56 struct pipe_char_state
*state
= (struct pipe_char_state
*)_state
;
58 printf
("push:%s: ecount[%u]\n",
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)
81 unsigned char out1b
[3];
82 struct pipe_char_state outs
;
84 struct pipe_char_state ins
;
87 unsigned char in1b
[3];
90 memset
(&in1b
, 0xAA, sizeof
(in1b
));
93 memset
(&outs
, 0, sizeof
(outs
));
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
));
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
));
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
)
124 unsigned long inb_len
= 0;
126 unsigned long outb_size
= 0;
127 unsigned long outb_len
= 0;
129 printf
("srv_midltests_fn: Start\n");
132 inp.pull
(inp.state
, inb
, sizeof
(inb
), &inb_len
);
133 printf
("pull inp_len[%u]\n", inb_len
);
134 } while
(inb_len
> 0);
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
);
144 } while
(outb_len
> 0);
147 out1
->m
= (unsigned char *)malloc
(out1
->l
);
148 memset
(out1
->m
, 0xBB, out1
->l
);
149 printf
("srv_midltests_fn: End\n");