Lines Matching refs:rstrm

134 	RECSTREAM *rstrm = (RECSTREAM *)mem_alloc(sizeof (RECSTREAM));  in xdrrec_create()  local
135 if (rstrm == NULL) { in xdrrec_create()
146 rstrm->sendsize = sendsize = fix_buf_size(sendsize); in xdrrec_create()
147 rstrm->recvsize = recvsize = fix_buf_size(recvsize); in xdrrec_create()
148 rstrm->the_buffer = mem_alloc(sendsize + recvsize + BYTES_PER_XDR_UNIT); in xdrrec_create()
149 if (rstrm->the_buffer == NULL) { in xdrrec_create()
153 for (rstrm->out_base = rstrm->the_buffer; in xdrrec_create()
154 (uintptr_t)rstrm->out_base % BYTES_PER_XDR_UNIT != 0; in xdrrec_create()
155 rstrm->out_base++); in xdrrec_create()
156 rstrm->in_base = rstrm->out_base + sendsize; in xdrrec_create()
161 xdrs->x_private = (caddr_t)rstrm; in xdrrec_create()
162 rstrm->tcp_handle = tcp_handle; in xdrrec_create()
163 rstrm->readit = readit; in xdrrec_create()
164 rstrm->writeit = writeit; in xdrrec_create()
165 rstrm->out_finger = rstrm->out_boundry = rstrm->out_base; in xdrrec_create()
166 rstrm->frag_header = (uint32_t *)rstrm->out_base; in xdrrec_create()
167 rstrm->out_finger += sizeof (uint_t); in xdrrec_create()
168 rstrm->out_boundry += sendsize; in xdrrec_create()
169 rstrm->frag_sent = FALSE; in xdrrec_create()
170 rstrm->in_size = recvsize; in xdrrec_create()
171 rstrm->in_boundry = rstrm->in_base; in xdrrec_create()
172 rstrm->in_finger = (rstrm->in_boundry += recvsize); in xdrrec_create()
173 rstrm->fbtbc = 0; in xdrrec_create()
174 rstrm->last_frag = TRUE; in xdrrec_create()
187 RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); in xdrrec_getint32() local
188 int32_t *bufip = (int32_t *)(rstrm->in_finger); in xdrrec_getint32()
192 if ((rstrm->fbtbc >= sizeof (int32_t)) && in xdrrec_getint32()
193 (((ptrdiff_t)rstrm->in_boundry in xdrrec_getint32()
196 rstrm->fbtbc -= sizeof (int32_t); in xdrrec_getint32()
197 rstrm->in_finger += sizeof (int32_t); in xdrrec_getint32()
209 RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); in xdrrec_putint32() local
210 int32_t *dest_ip = ((int32_t *)(rstrm->out_finger)); in xdrrec_putint32()
212 if ((rstrm->out_finger += sizeof (int32_t)) > rstrm->out_boundry) { in xdrrec_putint32()
217 rstrm->out_finger -= sizeof (int32_t); in xdrrec_putint32()
218 rstrm->frag_sent = TRUE; in xdrrec_putint32()
219 if (! flush_out(rstrm, FALSE)) in xdrrec_putint32()
221 dest_ip = ((int32_t *)(rstrm->out_finger)); in xdrrec_putint32()
222 rstrm->out_finger += sizeof (int32_t); in xdrrec_putint32()
237 RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); in xdrrec_getbytes() local
242 current = frag_len = rstrm->fbtbc; in xdrrec_getbytes()
244 if (rstrm->last_frag) in xdrrec_getbytes()
246 if (!set_input_fragment(rstrm)) in xdrrec_getbytes()
252 if (!get_input_bytes(rstrm, addr, frag_len, current)) in xdrrec_getbytes()
255 rstrm->fbtbc -= current; in xdrrec_getbytes()
264 RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); in xdrrec_putbytes() local
268 current = rstrm->out_boundry - rstrm->out_finger; in xdrrec_putbytes()
270 bcopy(addr, rstrm->out_finger, current); in xdrrec_putbytes()
271 rstrm->out_finger += current; in xdrrec_putbytes()
274 if (rstrm->out_finger == rstrm->out_boundry) { in xdrrec_putbytes()
275 rstrm->frag_sent = TRUE; in xdrrec_putbytes()
276 if (! flush_out(rstrm, FALSE)) in xdrrec_putbytes()
286 RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; in xdrrec_getpos() local
289 pos = lseek((int)(intptr_t)rstrm->tcp_handle, 0, 1); in xdrrec_getpos()
294 pos += rstrm->out_finger - rstrm->out_base; in xdrrec_getpos()
298 pos -= rstrm->in_boundry - rstrm->in_finger; in xdrrec_getpos()
311 RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; in xdrrec_setpos() local
320 newpos = rstrm->out_finger - delta; in xdrrec_setpos()
321 if ((newpos > (caddr_t)(rstrm->frag_header)) && in xdrrec_setpos()
322 (newpos < rstrm->out_boundry)) { in xdrrec_setpos()
323 rstrm->out_finger = newpos; in xdrrec_setpos()
329 newpos = rstrm->in_finger - delta; in xdrrec_setpos()
330 if ((delta < (int)(rstrm->fbtbc)) && in xdrrec_setpos()
331 (newpos <= rstrm->in_boundry) && in xdrrec_setpos()
332 (newpos >= rstrm->in_base)) { in xdrrec_setpos()
333 rstrm->in_finger = newpos; in xdrrec_setpos()
334 rstrm->fbtbc -= delta; in xdrrec_setpos()
345 RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; in xdrrec_inline() local
351 if ((rstrm->out_finger + len) <= rstrm->out_boundry) { in xdrrec_inline()
352 buf = (int32_t *)rstrm->out_finger; in xdrrec_inline()
353 rstrm->out_finger += len; in xdrrec_inline()
358 if ((len <= rstrm->fbtbc) && in xdrrec_inline()
359 ((rstrm->in_finger + len) <= rstrm->in_boundry)) { in xdrrec_inline()
360 buf = (int32_t *)rstrm->in_finger; in xdrrec_inline()
361 rstrm->fbtbc -= len; in xdrrec_inline()
362 rstrm->in_finger += len; in xdrrec_inline()
372 RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; in xdrrec_destroy() local
374 mem_free(rstrm->the_buffer, in xdrrec_destroy()
375 rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT); in xdrrec_destroy()
376 mem_free((caddr_t)rstrm, sizeof (RECSTREAM)); in xdrrec_destroy()
391 RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); in xdrrec_skiprecord() local
393 while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) { in xdrrec_skiprecord()
394 if (! skip_input_bytes(rstrm, rstrm->fbtbc)) in xdrrec_skiprecord()
396 rstrm->fbtbc = 0; in xdrrec_skiprecord()
397 if ((! rstrm->last_frag) && (! set_input_fragment(rstrm))) in xdrrec_skiprecord()
400 rstrm->last_frag = FALSE; in xdrrec_skiprecord()
413 RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); in xdrrec_eof() local
415 while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) { in xdrrec_eof()
416 if (! skip_input_bytes(rstrm, rstrm->fbtbc)) in xdrrec_eof()
418 rstrm->fbtbc = 0; in xdrrec_eof()
419 if ((! rstrm->last_frag) && (! set_input_fragment(rstrm))) in xdrrec_eof()
422 if (rstrm->in_finger == rstrm->in_boundry) in xdrrec_eof()
437 RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); in xdrrec_endofrecord() local
440 if (sendnow || rstrm->frag_sent || in xdrrec_endofrecord()
441 ((ptrdiff_t)rstrm->out_finger + sizeof (uint32_t) in xdrrec_endofrecord()
442 >= (ptrdiff_t)rstrm->out_boundry)) { in xdrrec_endofrecord()
443 rstrm->frag_sent = FALSE; in xdrrec_endofrecord()
444 return (flush_out(rstrm, TRUE)); in xdrrec_endofrecord()
446 len = (ptrdiff_t)rstrm->out_finger - (ptrdiff_t)rstrm->frag_header; in xdrrec_endofrecord()
448 *(rstrm->frag_header) = htonl((uint32_t)len | LAST_FRAG); in xdrrec_endofrecord()
449 rstrm->frag_header = (uint32_t *)rstrm->out_finger; in xdrrec_endofrecord()
450 rstrm->out_finger += sizeof (uint32_t); in xdrrec_endofrecord()
459 flush_out(RECSTREAM *rstrm, bool_t eor) in flush_out() argument
464 len = (ptrdiff_t)rstrm->out_finger - (ptrdiff_t)rstrm->frag_header; in flush_out()
467 *(rstrm->frag_header) = htonl(len | eormask); in flush_out()
468 len = rstrm->out_finger - rstrm->out_base; in flush_out()
469 if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len) in flush_out()
473 rstrm->frag_header = (uint32_t *)rstrm->out_base; in flush_out()
474 rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof (uint32_t); in flush_out()
479 fill_input_buf(RECSTREAM *rstrm, int frag_len) in fill_input_buf() argument
485 where = rstrm->in_base; in fill_input_buf()
486 i = (uintptr_t)rstrm->in_boundry % BYTES_PER_XDR_UNIT; in fill_input_buf()
488 len = (frag_len < (rstrm->in_size - i)) ? frag_len : in fill_input_buf()
489 rstrm->in_size - i; in fill_input_buf()
493 if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1) in fill_input_buf()
495 rstrm->in_finger = where; in fill_input_buf()
497 rstrm->in_boundry = where; in fill_input_buf()
502 get_input_bytes(RECSTREAM *rstrm, caddr_t addr, int frag_len, int len) in get_input_bytes() argument
507 current = rstrm->in_boundry - rstrm->in_finger; in get_input_bytes()
520 if (! fill_input_buf(rstrm, frag_len)) in get_input_bytes()
526 bcopy(rstrm->in_finger, addr, current); in get_input_bytes()
527 rstrm->in_finger += current; in get_input_bytes()
535 set_input_fragment(RECSTREAM *rstrm) in set_input_fragment() argument
539 if (! get_input_bytes(rstrm, (caddr_t)&header, 0, sizeof (header))) in set_input_fragment()
542 rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE; in set_input_fragment()
543 rstrm->fbtbc = header & (~LAST_FRAG); in set_input_fragment()
546 rstrm->fbtbc, rstrm->last_frag ? "TRUE" : "FALSE"); in set_input_fragment()
552 skip_input_bytes(RECSTREAM *rstrm, int32_t cnt) in skip_input_bytes() argument
559 current = rstrm->in_boundry - rstrm->in_finger; in skip_input_bytes()
561 if (! fill_input_buf(rstrm, cnt)) in skip_input_bytes()
566 rstrm->in_finger += current; in skip_input_bytes()