diff options
Diffstat (limited to 'source3/rpc_parse/parse_prs.c')
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f5f4eb67b8..6bb07c5f64 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -65,6 +65,30 @@ BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io) } /******************************************************************* + read from a socket into memory. + ********************************************************************/ +BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout) +{ + BOOL ok; + size_t prev_size = ps->buffer_size; + if (!prs_grow(ps, len)) + { + return False; + } + + if (timeout > 0) + { + ok = (read_with_timeout(fd, &ps->data_p[prev_size], + len, len,timeout) == len); + } + else + { + ok = (read_data(fd, &ps->data_p[prev_size], len) == len); + } + return ok; +} + +/******************************************************************* Delete the memory in a parse structure - if we own it. ********************************************************************/ |