- remlen = block->binbuf;
-
- /* Clear state flags */
- rec->state = 0;
-
- /*
- * Get the header. There is always a full header,
- * otherwise we find it in the next block.
- */
- if (remlen >= RECHDR_LENGTH) {
- Dmsg3(90, "read_record_block: remlen=%d data_len=%d rem=%d\n",
- remlen, rec->data_len, rec->remainder);
-
- unser_begin(block->bufp, RECHDR_LENGTH);
- unser_uint32(VolSessionId);
- unser_uint32(VolSessionTime);
- unser_int32(FileIndex);
- unser_int32(Stream);
- unser_uint32(data_bytes);
-
- ASSERT(unser_length(block->bufp) == RECHDR_LENGTH);
- block->bufp += RECHDR_LENGTH;
- block->binbuf -= RECHDR_LENGTH;
- remlen -= RECHDR_LENGTH;
-
- /*
- * if Stream is negative, it means that this is a continuation
- * of a previous partially written record.
- */
- if (Stream < 0) { /* continuation record? */
- Dmsg1(500, "Got negative Stream => continuation. remainder=%d\n",
- rec->remainder);
- rec->state |= REC_CONTINUATION;
- if (!rec->remainder) { /* if we didn't read previously */
- rec->data_len = 0; /* return data as if no continuation */
- } else if (rec->VolSessionId != VolSessionId ||
- rec->VolSessionTime != VolSessionTime ||
- rec->Stream != -Stream) {
- rec->state |= REC_NO_MATCH;
- return 0; /* This is from some other Session */
- }
- rec->Stream = -Stream; /* set correct Stream */
- } else { /* Regular record */
- rec->Stream = Stream;
- rec->data_len = 0; /* transfer to beginning of data */