@@ -390,6 +390,28 @@ extern void ms3_printselections (MS3Selections *selections);
390390 \sa mstl3_writemseed()
391391 @{ */
392392
393+ /**
394+ * @brief Container for a list of raw flags and extra headers
395+ *
396+ * A list of bit flags and extra headers with a time range of the
397+ * record they came from. In @ref trace-list functionality, this
398+ * container is used to retain flags and extra headers that
399+ * contributed to each entry.
400+ *
401+ * Note: the list is stored in the reverse order that they entries
402+ * were added.
403+ *
404+ * @see mstl3_add_metadata()
405+ */
406+ typedef struct MS3Metadata
407+ {
408+ nstime_t starttime ; //!< Start time for record containing metadata
409+ nstime_t endtime ; //!< End time for record containing metadata
410+ uint8_t flags ; //!< Record-level bit flags
411+ char * extra ; //!< Record-level extra headers, NULL-terminated if existing
412+ struct MS3Metadata * next ; //!< Pointer to next entry, NULL if the last
413+ } MS3Metadata ;
414+
393415/** @brief Container for a continuous trace segment, linkable */
394416typedef struct MS3TraceSeg {
395417 nstime_t starttime ; //!< Time of first sample
@@ -400,6 +422,7 @@ typedef struct MS3TraceSeg {
400422 int64_t numsamples ; //!< Number of data samples in datasamples
401423 char sampletype ; //!< Sample type code, see @ref sample-types
402424 void * prvtptr ; //!< Private pointer for general use, unused by library
425+ struct MS3Metadata * metadata ; //!< List of flags and extra headers from records that contributed
403426 struct MS3TraceSeg * prev ; //!< Pointer to previous segment
404427 struct MS3TraceSeg * next ; //!< Pointer to next segment, NULL if the last
405428} MS3TraceSeg ;
@@ -449,21 +472,23 @@ typedef struct MS3TraceList {
449472 *
450473 * \sa mstl3_addmsr()
451474 */
452- typedef struct MS3Tolerance {
453- double (* time )(MS3Record * msr );
454- double (* samprate )(MS3Record * msr );
475+ typedef struct MS3Tolerance
476+ {
477+ double (* time ) (MS3Record * msr ); //!< Pointer to function that returns time tolerance
478+ double (* samprate ) (MS3Record * msr ); //!< Pointer to function that returns sample rate tolerance
455479} MS3Tolerance ;
456480
457481extern MS3TraceList * mstl3_init (MS3TraceList * mstl );
458482extern void mstl3_free (MS3TraceList * * ppmstl , int8_t freeprvtptr );
459483extern MS3TraceSeg * mstl3_addmsr (MS3TraceList * mstl , MS3Record * msr , int8_t splitversion ,
460- int8_t autoheal , MS3Tolerance * tolerance );
484+ int8_t autoheal , uint32_t flags , MS3Tolerance * tolerance );
461485extern int64_t mstl3_readbuffer (MS3TraceList * * ppmstl , char * buffer , uint64_t bufferlength ,
462- MS3Tolerance * tolerance , int8_t splitversion ,
463- uint32_t flags , int8_t verbose );
486+ int8_t splitversion , uint32_t flags ,
487+ MS3Tolerance * tolerance , int8_t verbose );
464488extern int64_t mstl3_readbuffer_selection (MS3TraceList * * ppmstl , char * buffer , uint64_t bufferlength ,
489+ int8_t splitversion , uint32_t flags ,
465490 MS3Tolerance * tolerance , MS3Selections * selections ,
466- int8_t splitversion , uint32_t flags , int8_t verbose );
491+ int8_t verbose );
467492extern int mstl3_convertsamples (MS3TraceSeg * seg , char type , int8_t truncate );
468493extern int mstl3_pack (MS3TraceList * mstl , void (* record_handler ) (char * , int , void * ),
469494 void * handlerdata , int reclen , int8_t encoding ,
@@ -946,18 +971,19 @@ extern LIBMSEED_MEMORY libmseed_memory;
946971
947972/** @defgroup control-flags Control flags
948973 @ingroup low-level
949- @brief Parsing and packing control flags
974+ @brief Parsing, packing and trace construction control flags
950975
951976 These are bit flags that can be combined into a bitmask to control
952- aspects of the libraries parsing and packing routines.
977+ aspects of the library's parsing, packing and trace managment routines.
953978
954979 @{ */
955- #define MSF_UNPACKDATA 0x0001 //!< [Parsing] unpack data samples
956- #define MSF_SKIPNOTDATA 0x0002 //!< [Parsing] skip input that cannot be identified as miniSEED
957- #define MSF_VALIDATECRC 0x0004 //!< [Parsing] validate CRC (if version 3)
958- #define MSF_SEQUENCE 0x0008 //!< [Packing] UNSUPPORTED: Maintain a record-level sequence number
959- #define MSF_FLUSHDATA 0x0010 //!< [Packing] pack all available data even if final record would not be filled
960- #define MSF_ATENDOFFILE 0x0020 //!< [Parsing] reading routine is at the end of the file
980+ #define MSF_UNPACKDATA 0x0001 //!< [Parsing] unpack data samples
981+ #define MSF_SKIPNOTDATA 0x0002 //!< [Parsing] skip input that cannot be identified as miniSEED
982+ #define MSF_VALIDATECRC 0x0004 //!< [Parsing] validate CRC (if version 3)
983+ #define MSF_SEQUENCE 0x0008 //!< [Packing] UNSUPPORTED: Maintain a record-level sequence number
984+ #define MSF_FLUSHDATA 0x0010 //!< [Packing] pack all available data even if final record would not be filled
985+ #define MSF_ATENDOFFILE 0x0020 //!< [Parsing] reading routine is at the end of the file
986+ #define MSF_STOREMETADATA 0x0040 //!< [Tracelist] store record-level metadata in trace lists
961987/** @} */
962988
963989#ifdef __cplusplus
0 commit comments