MS_FIND_RECLEN(3)

DESCRIPTION
Determine SEED record data length

SYNOPSIS
#include <libmseed.h>
int  ms_find_reclen ( const char *recbuf, int recbuflen,
                            FILE *fileptr );

DESCRIPTION
ms_find_reclen verifies that the specified recbuf buffer contains a SEED data record by looking for data record signatures in the fixed section data header and determines the data record length by 1) searching the buffer up to recbuflen bytes for a Blockette 1000 and, failing that, 2) if fileptr is not NULL reading the next 48 bytes from the file and looking for a data record signature (with detection of the next data record implying the length of the current record). If data is read from fileptr the read position is returned to it's position prior to this function call. The MS_ISVALIDHEADER macro is used to verify that the buffer contains a valid SEED data record. When searching for the next record header to determine record length one of the macros MS_ISVALIDHEADER or MS_ISVALIDBLANK must test positively for a record to be detected. Blank/noise records are records with a valid SEED sequence number followed by ASCII space characters to the end of the record. ms_find_reclen will return 0 when it detects that the buffer contains a SEED data record but cannot determine the record length. This happens when no Blockette 1000 is not found within recbuflen bytes and, assuming a valid fileptr is supplied, no record header is detected in the next 48 bytes of the file. The idea is to then read more data from the file (i.e. the next larger, valid record length) and call ms_find_reclen again and so on until the record length can be determined.

RETURN VALUES
ms_find_reclen returns the length of the Mini-SEED record in bytes or 0 if a data record was detected but the length could not be determined or -1 when no data record was detected.

SEE ALSO
ms_readmsr(3), ms_readtraces(3) and msr_unpack(3).

AUTHOR
Chad Trabant
IRIS Data Management Center