MSR_PARSE - Online Linux Manual PageSection : 3
Updated : 2013/01/07
Source : Libmseed API

NAMEmsr_parse - Detect and parse a SEED data record from a memory buffer

SYNOPSIS#include <libmseed.h> int msr_parse ( char *record, int recbuflen, MSRecord **ppmsr, int reclen, flag dataflag, flag verbose ); int msr_parse_selection ( char *recbuf, int recbuflen, int64_t *offset, MSRecord **ppmsr, int reclen, Selections *selections, flag dataflag, flag verbose ); int ms_detect ( const char *record, int recbuflen );

DESCRIPTION msr_parse will parse a SEED data record from the record buffer and populate the MSRecord structure at ppmsr, allocating one if needed. The recbuflen argument is the length of the record buffer. Records must begin at the start of the buffer. If reclen is 0 or negative the length of record is automatically determined, otherwise reclen should be the correct record length. For auto detection of record length the record should include a 1000 blockette or be followed by another record header in the buffer. If dataflag is true (non-zero) the data samples will be unpacked when parsing the record. This argument is passed directly to msr_unpack(3). msr_parse_selection will parse the first SEED data record from the recbuf buffer that matches the optional selections. The offset value indicates where to start searching the buffer. On success, the MSRecord structure at ppmsr is populated and the offset to the record in the buffer is set. See the example below for the intended usage pattern. ms_detect determines whether the supplied record buffer contains a SEED data record by verifying known signatures, if a record is found the record length is determined by: 1) Searching the buffer up to recbuflen for a Blockette 1000. 2) If no Blockette 1000 is found search at MINRECLEN-byte offsets for the fixed section of the next header in the buffer, thereby implying the record length.

RETURN VALUESmsr_parse returns values: 0 : On success and populates the supplied MSRecord. >0 : Data record was detected but not enough data is present in buffer, the value returned is a hint of how much more data is needed. <0 : On error a negative libmseed error value is returned. ms_detect returns values: -1 : Data record not detected or error 0 : Data record detected but could not determine length >0 : Length of the data record in bytes

EXAMPLE USAGE OF MS_PARSE_SELECTION()The ms_parse_selection() routine uses the initial setting of offset as the starting point to search the buffer. On successful parsing of a miniSEED record the value of offset will be the offset in the buffer to the record parsed. To properly parse all records matching specificed selection criteria, a caller must check and manage the value of offset. In particular, when the end of the buffer is reached a value of MS_GENERROR will be returned and the caller should check if the offset is still within the buffer length to determine if this is a parsing error or simply the end of the buffer. The following example illustrates the intended usage: char *recbuf = <memory buffer containing records>; int64_t recbuflen = <length of buffer>; int64_t offset = 0; MSRecord *msr = NULL; int reclen = -1; Selections *selections = NULL; flag dataflag = 1; flag verbose = 0; // You probaby want to set Selections // For example with a call to ms_readselectionsfile (&selections, selectfile) /* Loop over all selected records in recbuf */ while ( offset < recbuflen ) { if ( msr_parse_selection (recbuf, recbuflen, &offset, &msr, reclen, selections, dataflag, verbose) ) { /* Only print error if offset is still within buffer length */ if ( verbose && offset < recbuflen ) ms_log (2, "Error parsing record at offset %"PRId64"\n", offset); } else /* Successfully found and parsed record */ { /* Do something with the record, for example print the details */ msr_print (msr, verbose); /* Increment offset in buffer for subsequent call to msr_parse_selection() */ offset += msr->reclen; } } /* Clean up */ msr_free (&msr); if ( selections ) ms_freeselections (selections);

SEE ALSOmsr_unpack(3), ms_parse_raw(3) and ms_errorstr(3)

AUTHORChad Trabant IRIS Data Management Center
0
Johanes Gumabo
Data Size   :   12,026 byte
man-msr_parse.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 204,017
Visitor ID   :     :  
Visitor IP   :   18.227.46.202   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (rof_nr_x|149|m___sr_parse.3|102|\n", offset);| ms_log (2, "Error parsing record at offset %"PRId64"\n", offset); )