libmseed 3.1.4
The miniSEED data format library
Loading...
Searching...
No Matches
libmseed.h File Reference
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <inttypes.h>
#include <sys/time.h>

Go to the source code of this file.

Data Structures

struct  MS3Record
 miniSEED record container More...
 
struct  MS3SelectTime
 Data selection structure time window definition containers. More...
 
struct  MS3Selections
 Data selection structure definition containers. More...
 
struct  MS3RecordPtr
 A miniSEED record pointer and metadata. More...
 
struct  MS3RecordList
 Record list, holds MS3RecordPtr entries that contribute to a given MS3TraceSeg. More...
 
struct  MS3TraceSeg
 Container for a continuous trace segment, linkable. More...
 
struct  MS3TraceID
 Container for a trace ID, linkable. More...
 
struct  MS3TraceList
 Container for a collection of continuous trace segment, linkable. More...
 
struct  MS3Tolerance
 Callback functions that return time and sample rate tolerances. More...
 
struct  LMIO
 Type definition for data source I/O: file-system versus URL. More...
 
struct  MS3FileParam
 State container for reading miniSEED records from files or URLs. More...
 
struct  MSEHEventDetection
 Container for event detection parameters for use in extra headers. More...
 
struct  MSEHCalibration
 Container for calibration parameters for use in extra headers. More...
 
struct  MSEHTimingException
 Container for timing exception parameters for use in extra headers. More...
 
struct  MSEHRecenter
 Container for recenter parameters for use in extra headers. More...
 
struct  MSLogEntry
 Log registry entry. More...
 
struct  MSLogRegistry
 Log message registry. More...
 
struct  MSLogParam
 Logging parameters. Callers should not modify these values directly and generally should not need to access them. More...
 
struct  LeapSecond
 Leap second list container. More...
 
struct  LIBMSEED_MEMORY
 

Macros

#define LIBMSEED_VERSION   "3.1.4"
 Library version.
 
#define LIBMSEED_RELEASE   "2025.113"
 Library release date.
 
#define PRIsize_t   "zu"
 A printf() macro for portably printing size_t values.
 
#define MINRECLEN   40
 Minimum miniSEED record length supported.
 
#define MAXRECLEN   10485760
 Maximum miniSEED record length supported (10MiB)
 
#define MAXRECLENv2   131172
 Maximum v2 miniSEED record length supported (131+ KiB or 2^17)
 
#define LM_SIDLEN   64
 Length of source ID string.
 
#define MS_ISRATETOLERABLE(A, B)
 Macro to test default sample rate tolerance: abs(1-sr1/sr2) < 0.0001.
 
#define MS2_ISDATAINDICATOR(X)
 Macro to test a character for miniSEED 2.x data record/quality indicators.
 
#define MS3_ISVALIDHEADER(X)
 
#define MS2_ISVALIDHEADER(X)
 
#define bit(x, y)
 
#define DEPRECATED
 
#define NSTMODULUS   1000000000
 Define the high precision time tick interval as 1/modulus seconds corresponding to nanoseconds.
 
#define NSTERROR   -2145916800000000000LL
 Error code for routines that normally return a high precision time. The time value corresponds to '1902-01-01T00:00:00.000000000Z'.
 
#define NSTUNSET   -2145916799999999999LL
 Special nstime_t value meaning "unset". The time value corresponds to '1902-01-01T00:00:00.000000001Z'.
 
#define MS_EPOCH2NSTIME(X)
 macro to convert Unix/POSIX epoch time to high precision epoch time
 
#define MS_NSTIME2EPOCH(X)
 Macro to convert high precision epoch time to Unix/POSIX epoch time.
 
#define MS_HPTIME2NSTIME(X)
 Convert a hptime_t value (used by previous releases) to nstime_t.
 
#define MS_NSTIME2HPTIME(X)
 Convert an nstime_t value to hptime_t (used by previous releases)
 
#define MS_PACK_DEFAULT_RECLEN   4096
 Default record length to use when MS3Record.reclen == -1.
 
#define MS_PACK_DEFAULT_ENCODING   DE_STEIM2
 Default data encoding to use when MS3Record.encoding == -1.
 
#define MS3Record_INITIALIZER
 Initialializer for a MS3Record.
 
#define MSTRACEID_SKIPLIST_HEIGHT   8
 Maximum skip list height for MSTraceIDs.
 
#define MS3Tolerance_INITIALIZER
 Initialializer for the tolerances MS3Tolerance.
 
#define mstl3_addmsr(mstl, msr, splitversion, autoheal, flags, tolerance)
 Add a MS3Record to a MS3TraceList.
 
#define LMIO_INITIALIZER
 Initialializer for the internal stream handle LMIO.
 
#define MS3FileParam_INITIALIZER
 Initialializer for the internal file or URL I/O parameters MS3FileParam.
 
#define mseh_get(msr, ptr, valueptr, type, maxlength)
 A simple wrapper to access any type of extra header.
 
#define mseh_get_number(msr, ptr, valueptr)
 A simple wrapper to access a number type extra header.
 
#define mseh_get_int64(msr, ptr, valueptr)
 A simple wrapper to access a number type extra header.
 
#define mseh_get_string(msr, ptr, buffer, maxlength)
 A simple wrapper to access a string type extra header.
 
#define mseh_get_boolean(msr, ptr, valueptr)
 A simple wrapper to access a boolean type extra header.
 
#define mseh_exists(msr, ptr)
 A simple wrapper to test existence of an extra header.
 
#define mseh_set(msr, ptr, valueptr, type)
 A simple wrapper to set any type of extra header.
 
#define mseh_set_number(msr, ptr, valueptr)
 A simple wrapper to set a number type extra header.
 
#define mseh_set_int64(msr, ptr, valueptr)
 A simple wrapper to set a number type extra header.
 
#define mseh_set_string(msr, ptr, valueptr)
 A simple wrapper to set a string type extra header.
 
#define mseh_set_boolean(msr, ptr, valueptr)
 A simple wrapper to set a boolean type extra header.
 
#define MAX_LOG_MSG_LENGTH   200
 
#define MSLogRegistry_INITIALIZER
 Initialializer for MSLogRegistry.
 
#define MSLogParam_INITIALIZER
 Initialializer for MSLogParam.
 
#define ms_log(level, ...)
 Wrapper for ms_rlog(), call as ms_log (level, format, ...)
 
#define ms_log_l(logp, level, ...)
 Wrapper for ms_rlog_l(), call as ms_log_l (logp, level, format, ...)
 
#define ms_loginit(log_print, logprefix, diag_print, errprefix)
 Convenience wrapper for ms_rloginit(), omitting max messages, disabling registry.
 
#define ms_loginit_l(logp, log_print, logprefix, diag_print, errprefix)
 Convenience wrapper for ms_rloginit_l(), omitting max messages, disabling registry.
 
#define ms_dabs(val)
 
#define DE_ASCII   DE_TEXT
 Mapping of legacy DE_ASCII to DE_TEXT.
 
#define DE_TEXT   0
 Text encoding (UTF-8)
 
#define DE_INT16   1
 16-bit integer
 
#define DE_INT32   3
 32-bit integer
 
#define DE_FLOAT32   4
 32-bit float (IEEE)
 
#define DE_FLOAT64   5
 64-bit float (IEEE)
 
#define DE_STEIM1   10
 Steim-1 compressed integers.
 
#define DE_STEIM2   11
 Steim-2 compressed integers.
 
#define DE_GEOSCOPE24   12
 [Legacy] GEOSCOPE 24-bit integer
 
#define DE_GEOSCOPE163   13
 [Legacy] GEOSCOPE 16-bit gain ranged, 3-bit exponent
 
#define DE_GEOSCOPE164   14
 [Legacy] GEOSCOPE 16-bit gain ranged, 4-bit exponent
 
#define DE_CDSN   16
 [Legacy] CDSN 16-bit gain ranged
 
#define DE_SRO   30
 [Legacy] SRO 16-bit gain ranged
 
#define DE_DWWSSN   32
 [Legacy] DWWSSN 16-bit gain ranged
 
#define MSSWAP_HEADER   0x01
 Header needed byte swapping.
 
#define MSSWAP_PAYLOAD   0x02
 Data payload needed byte swapping.
 
#define MS_ENDOFFILE   1
 End of file reached return value.
 
#define MS_NOERROR   0
 No error.
 
#define MS_GENERROR   -1
 Generic unspecified error.
 
#define MS_NOTSEED   -2
 Data not SEED.
 
#define MS_WRONGLENGTH   -3
 Length of data read was not correct.
 
#define MS_OUTOFRANGE   -4
 SEED record length out of range.
 
#define MS_UNKNOWNFORMAT   -5
 Unknown data encoding format.
 
#define MS_STBADCOMPFLAG   -6
 Steim, invalid compression flag(s)
 
#define MS_INVALIDCRC   -7
 Invalid CRC.
 
#define MSF_UNPACKDATA   0x0001
 [Parsing] Unpack data samples
 
#define MSF_SKIPNOTDATA   0x0002
 [Parsing] Skip input that cannot be identified as miniSEED
 
#define MSF_VALIDATECRC   0x0004
 [Parsing] Validate CRC (if version 3)
 
#define MSF_PNAMERANGE   0x0008
 [Parsing] Parse and utilize byte range from path name suffix
 
#define MSF_ATENDOFFILE   0x0010
 [Parsing] Reading routine is at the end of the file
 
#define MSF_SEQUENCE   0x0020
 [Packing] UNSUPPORTED: Maintain a record-level sequence number
 
#define MSF_FLUSHDATA   0x0040
 [Packing] Pack all available data even if final record would not be filled
 
#define MSF_PACKVER2   0x0080
 [Packing] Pack as miniSEED version 2 instead of 3
 
#define MSF_RECORDLIST   0x0100
 [TraceList] Build a MS3RecordList for each MS3TraceSeg
 
#define MSF_MAINTAINMSTL   0x0200
 [TraceList] Do not modify a trace list when packing
 
#define MSF_PPUPDATETIME   0x0400
 [TraceList] Store update time (as nstime_t) at MS3TraceSeg.prvtptr
 

Typedefs

typedef int64_t nstime_t
 libmseed time type, integer nanoseconds since the Unix/POSIX epoch (00:00:00 Thursday, 1 January 1970)
 
typedef struct LM_PARSED_JSON_s LM_PARSED_JSON
 Internal structure for holding parsed JSON extra headers.
 
typedef int8_t flag
 

Enumerations

enum  ms_timeformat_t {
  ISOMONTHDAY = 0 , ISOMONTHDAY_Z = 1 , ISOMONTHDAY_DOY = 2 , ISOMONTHDAY_DOY_Z = 3 ,
  ISOMONTHDAY_SPACE = 4 , ISOMONTHDAY_SPACE_Z = 5 , SEEDORDINAL = 6 , UNIXEPOCH = 7 ,
  NANOSECONDEPOCH = 8
}
 Time format identifiers. More...
 
enum  ms_subseconds_t {
  NONE = 0 , MICRO = 1 , NANO = 2 , MICRO_NONE = 3 ,
  NANO_NONE = 4 , NANO_MICRO = 5 , NANO_MICRO_NONE = 6
}
 Subsecond format identifiers. More...
 

Functions

int ms_nstime2time (nstime_t nstime, uint16_t *year, uint16_t *yday, uint8_t *hour, uint8_t *min, uint8_t *sec, uint32_t *nsec)
 Convert an nstime_t to individual date-time components.
 
char * ms_nstime2timestr (nstime_t nstime, char *timestr, ms_timeformat_t timeformat, ms_subseconds_t subsecond)
 Convert an nstime_t to a time string.
 
DEPRECATED char * ms_nstime2timestrz (nstime_t nstime, char *timestr, ms_timeformat_t timeformat, ms_subseconds_t subsecond)
 Convert an nstime_t to a time string with 'Z' suffix.
 
nstime_t ms_time2nstime (int year, int yday, int hour, int min, int sec, uint32_t nsec)
 Convert specified date-time values to a high precision epoch time.
 
nstime_t ms_timestr2nstime (const char *timestr)
 Convert a time string to a high precision epoch time.
 
nstime_t ms_mdtimestr2nstime (const char *timestr)
 Convert a time string (year-month-day) to a high precision epoch time.
 
nstime_t ms_seedtimestr2nstime (const char *seedtimestr)
 Convert an SEED-style (ordinate date, i.e. day-of-year) time string to a high precision epoch time.
 
int ms_doy2md (int year, int yday, int *month, int *mday)
 Compute the month and day-of-month from a year and day-of-year.
 
int ms_md2doy (int year, int month, int mday, int *yday)
 Compute the day-of-year from a year, month and day-of-month.
 
int msr3_parse (const char *record, uint64_t recbuflen, MS3Record **ppmsr, uint32_t flags, int8_t verbose)
 Parse miniSEED from a buffer.
 
int msr3_pack (const MS3Record *msr, void(*record_handler)(char *, int, void *), void *handlerdata, int64_t *packedsamples, uint32_t flags, int8_t verbose)
 Pack data into miniSEED records.
 
int msr3_repack_mseed3 (const MS3Record *msr, char *record, uint32_t recbuflen, int8_t verbose)
 Repack a parsed miniSEED record into a version 3 record.
 
int msr3_pack_header3 (const MS3Record *msr, char *record, uint32_t recbuflen, int8_t verbose)
 Pack a miniSEED version 3 header into the specified buffer.
 
int msr3_pack_header2 (const MS3Record *msr, char *record, uint32_t recbuflen, int8_t verbose)
 Pack a miniSEED version 2 header into the specified buffer.
 
int64_t msr3_unpack_data (MS3Record *msr, int8_t verbose)
 Unpack data samples for a MS3Record.
 
int msr3_data_bounds (const MS3Record *msr, uint32_t *dataoffset, uint32_t *datasize)
 Determine the data payload bounds for a MS3Record.
 
int64_t ms_decode_data (const void *input, uint64_t inputsize, uint8_t encoding, uint64_t samplecount, void *output, uint64_t outputsize, char *sampletype, int8_t swapflag, const char *sid, int8_t verbose)
 Decode data samples to a supplied buffer.
 
MS3Recordmsr3_init (MS3Record *msr)
 Initialize and return an MS3Record.
 
void msr3_free (MS3Record **ppmsr)
 Free all memory associated with a MS3Record.
 
MS3Recordmsr3_duplicate (const MS3Record *msr, int8_t datadup)
 Duplicate a MS3Record.
 
nstime_t msr3_endtime (const MS3Record *msr)
 Calculate time of the last sample in a record.
 
void msr3_print (const MS3Record *msr, int8_t details)
 Print header values of an MS3Record.
 
int msr3_resize_buffer (MS3Record *msr)
 Resize data sample buffer of MS3Record to what is needed.
 
double msr3_sampratehz (const MS3Record *msr)
 Calculate sample rate in samples/second (Hertz) for a given MS3Record.
 
nstime_t msr3_nsperiod (const MS3Record *msr)
 Calculate sample period in nanoseconds/sample for a given MS3Record.
 
double msr3_host_latency (const MS3Record *msr)
 Calculate data latency based on the host time.
 
int64_t ms3_detect (const char *record, uint64_t recbuflen, uint8_t *formatversion)
 Detect miniSEED record in buffer.
 
int ms_parse_raw3 (const char *record, int maxreclen, int8_t details)
 Parse and verify a miniSEED 3.x record header.
 
int ms_parse_raw2 (const char *record, int maxreclen, int8_t details, int8_t swapflag)
 Parse and verify a miniSEED 2.x record header.
 
const MS3Selectionsms3_matchselect (const MS3Selections *selections, const char *sid, nstime_t starttime, nstime_t endtime, int pubversion, const MS3SelectTime **ppselecttime)
 Test the specified parameters for a matching selection entry.
 
const MS3Selectionsmsr3_matchselect (const MS3Selections *selections, const MS3Record *msr, const MS3SelectTime **ppselecttime)
 Test the MS3Record for a matching selection entry.
 
int ms3_addselect (MS3Selections **ppselections, const char *sidpattern, nstime_t starttime, nstime_t endtime, uint8_t pubversion)
 Add selection parameters to selection list.
 
int ms3_addselect_comp (MS3Selections **ppselections, char *network, char *station, char *location, char *channel, nstime_t starttime, nstime_t endtime, uint8_t pubversion)
 Add selection parameters to a selection list based on separate source name codes.
 
int ms3_readselectionsfile (MS3Selections **ppselections, const char *filename)
 Read data selections from a file.
 
void ms3_freeselections (MS3Selections *selections)
 Free all memory associated with a MS3Selections.
 
void ms3_printselections (const MS3Selections *selections)
 Print the selections list using the ms_log() facility.
 
MS3TraceListmstl3_init (MS3TraceList *mstl)
 Initialize a MS3TraceList container.
 
void mstl3_free (MS3TraceList **ppmstl, int8_t freeprvtptr)
 Free all memory associated with a MS3TraceList.
 
MS3TraceIDmstl3_findID (MS3TraceList *mstl, const char *sid, uint8_t pubversion, MS3TraceID **prev)
 Find matching MS3TraceID in a MS3TraceList.
 
MS3TraceSegmstl3_addmsr_recordptr (MS3TraceList *mstl, const MS3Record *msr, MS3RecordPtr **pprecptr, int8_t splitversion, int8_t autoheal, uint32_t flags, const MS3Tolerance *tolerance)
 Add data coverage from an MS3Record to a MS3TraceList.
 
int64_t mstl3_readbuffer (MS3TraceList **ppmstl, const char *buffer, uint64_t bufferlength, int8_t splitversion, uint32_t flags, const MS3Tolerance *tolerance, int8_t verbose)
 Parse miniSEED from a buffer and populate a MS3TraceList.
 
int64_t mstl3_readbuffer_selection (MS3TraceList **ppmstl, const char *buffer, uint64_t bufferlength, int8_t splitversion, uint32_t flags, const MS3Tolerance *tolerance, const MS3Selections *selections, int8_t verbose)
 Parse miniSEED from a buffer and populate a MS3TraceList.
 
int64_t mstl3_unpack_recordlist (MS3TraceID *id, MS3TraceSeg *seg, void *output, uint64_t outputsize, int8_t verbose)
 Unpack data samples in a Record List associated with a MS3TraceList.
 
int mstl3_convertsamples (MS3TraceSeg *seg, char type, int8_t truncate)
 Convert the data samples associated with an MS3TraceSeg to another data type.
 
int mstl3_resize_buffers (MS3TraceList *mstl)
 Resize data sample buffers of MS3TraceList to what is needed.
 
int64_t mstl3_pack (MS3TraceList *mstl, void(*record_handler)(char *, int, void *), void *handlerdata, int reclen, int8_t encoding, int64_t *packedsamples, uint32_t flags, int8_t verbose, char *extra)
 Pack MS3TraceList data into miniSEED records.
 
int64_t mstraceseg3_pack (MS3TraceID *id, MS3TraceSeg *seg, void(*record_handler)(char *, int, void *), void *handlerdata, int reclen, int8_t encoding, int64_t *packedsamples, uint32_t flags, int8_t verbose, char *extra)
 Pack a MS3TraceSeg data into miniSEED records.
 
void mstl3_printtracelist (const MS3TraceList *mstl, ms_timeformat_t timeformat, int8_t details, int8_t gaps, int8_t versions)
 Print trace list summary information for a MS3TraceList.
 
void mstl3_printsynclist (const MS3TraceList *mstl, const char *dccid, ms_subseconds_t subseconds)
 Print SYNC trace list summary information for a MS3TraceList.
 
void mstl3_printgaplist (const MS3TraceList *mstl, ms_timeformat_t timeformat, double *mingap, double *maxgap)
 Print gap/overlap list summary information for a MS3TraceList.
 
int ms3_readmsr (MS3Record **ppmsr, const char *mspath, uint32_t flags, int8_t verbose)
 Read miniSEED records from a file or URL.
 
int ms3_readmsr_r (MS3FileParam **ppmsfp, MS3Record **ppmsr, const char *mspath, uint32_t flags, int8_t verbose)
 Read miniSEED records from a file or URL in a thread-safe way.
 
int ms3_readmsr_selection (MS3FileParam **ppmsfp, MS3Record **ppmsr, const char *mspath, uint32_t flags, const MS3Selections *selections, int8_t verbose)
 Read miniSEED records from a file or URL with optional selection.
 
int ms3_readtracelist (MS3TraceList **ppmstl, const char *mspath, const MS3Tolerance *tolerance, int8_t splitversion, uint32_t flags, int8_t verbose)
 Read miniSEED from a file into a trace list.
 
int ms3_readtracelist_timewin (MS3TraceList **ppmstl, const char *mspath, const MS3Tolerance *tolerance, nstime_t starttime, nstime_t endtime, int8_t splitversion, uint32_t flags, int8_t verbose)
 Read miniSEED from a file into a trace list, with time range selection.
 
int ms3_readtracelist_selection (MS3TraceList **ppmstl, const char *mspath, const MS3Tolerance *tolerance, const MS3Selections *selections, int8_t splitversion, uint32_t flags, int8_t verbose)
 Read miniSEED from a file into a trace list, with selection filtering.
 
int ms3_url_useragent (const char *program, const char *version)
 Set User-Agent header for URL-based requests.
 
int ms3_url_userpassword (const char *userpassword)
 Set authentication credentials for URL-based requests.
 
int ms3_url_addheader (const char *header)
 Add header to any URL-based requests.
 
void ms3_url_freeheaders (void)
 Free all set headers for URL-based requests.
 
int64_t msr3_writemseed (MS3Record *msr, const char *mspath, int8_t overwrite, uint32_t flags, int8_t verbose)
 Write miniSEED from an MS3Record container to a file.
 
int64_t mstl3_writemseed (MS3TraceList *mst, const char *mspath, int8_t overwrite, int maxreclen, int8_t encoding, uint32_t flags, int8_t verbose)
 Write miniSEED from an MS3TraceList container to a file.
 
int libmseed_url_support (void)
 Run-time test for URL support in libmseed.
 
MS3FileParamms3_mstl_init_fd (int fd)
 Initialize MS3FileParam parameters for a file descriptor.
 
int ms_sid2nslc_n (const char *sid, char *net, size_t netsize, char *sta, size_t stasize, char *loc, size_t locsize, char *chan, size_t chansize)
 Parse network, station, location and channel codes from an FDSN Source ID.
 
DEPRECATED int ms_sid2nslc (const char *sid, char *net, char *sta, char *loc, char *chan)
 
int ms_nslc2sid (char *sid, int sidlen, uint16_t flags, const char *net, const char *sta, const char *loc, const char *chan)
 Convert network, station, location and channel to an FDSN Source ID.
 
int ms_seedchan2xchan (char *xchan, const char *seedchan)
 Convert SEED 2.x channel to extended channel.
 
int ms_xchan2seedchan (char *seedchan, const char *xchan)
 Convert extended channel to SEED 2.x channel.
 
int ms_strncpclean (char *dest, const char *source, int length)
 Copy string, removing spaces, always terminated.
 
int ms_strncpcleantail (char *dest, const char *source, int length)
 Copy string, removing trailing spaces, always terminated.
 
int ms_strncpopen (char *dest, const char *source, int length)
 Copy fixed number of characters into unterminated string.
 
int mseh_get_ptr_r (const MS3Record *msr, const char *ptr, void *value, char type, uint32_t maxlength, LM_PARSED_JSON **parsestate)
 Search for and return an extra header value.
 
int mseh_set_ptr_r (MS3Record *msr, const char *ptr, void *value, char type, LM_PARSED_JSON **parsestate)
 Set the value of extra header values.
 
int mseh_add_event_detection_r (MS3Record *msr, const char *ptr, MSEHEventDetection *eventdetection, LM_PARSED_JSON **parsestate)
 Add event detection to the extra headers of the given record.
 
int mseh_add_calibration_r (MS3Record *msr, const char *ptr, MSEHCalibration *calibration, LM_PARSED_JSON **parsestate)
 Add calibration to the extra headers of the given record.
 
int mseh_add_timing_exception_r (MS3Record *msr, const char *ptr, MSEHTimingException *exception, LM_PARSED_JSON **parsestate)
 Add timing exception to the extra headers of the given record.
 
int mseh_add_recenter_r (MS3Record *msr, const char *ptr, MSEHRecenter *recenter, LM_PARSED_JSON **parsestate)
 Add recenter event to the extra headers of the given record.
 
int mseh_serialize (MS3Record *msr, LM_PARSED_JSON **parsestate)
 Generate extra headers string (serialize) from internal state.
 
void mseh_free_parsestate (LM_PARSED_JSON **parsestate)
 Free internally parsed (deserialized) JSON data.
 
int mseh_replace (MS3Record *msr, char *jsonstring)
 Replace extra headers with supplied JSON.
 
int mseh_print (const MS3Record *msr, int indent)
 Print the extra header structure for the specified MS3Record.
 
int ms_rlog (const char *function, int level, const char *format,...)
 Register log message using global logging parameters.
 
int ms_rlog_l (MSLogParam *logp, const char *function, int level, const char *format,...)
 Register log message using specified logging parameters.
 
void ms_rloginit (void(*log_print)(const char *), const char *logprefix, void(*diag_print)(const char *), const char *errprefix, int maxmessages)
 Initialize the global logging parameters.
 
MSLogParamms_rloginit_l (MSLogParam *logp, void(*log_print)(const char *), const char *logprefix, void(*diag_print)(const char *), const char *errprefix, int maxmessages)
 Initialize specified MSLogParam logging parameters.
 
int ms_rlog_emit (MSLogParam *logp, int count, int context)
 Emit, aka send to print functions, messages from log registry.
 
int ms_rlog_free (MSLogParam *logp)
 Free, without emitting, all messages from log registry.
 
int ms_readleapseconds (const char *envvarname)
 Read leap second file specified by an environment variable.
 
int ms_readleapsecondfile (const char *filename)
 Read leap second from the specified file.
 
uint8_t ms_samplesize (char sampletype)
 Determine data sample size for each type.
 
int ms_encoding_sizetype (uint8_t encoding, uint8_t *samplesize, char *sampletype)
 Return sample size and/or type for given encoding value.
 
const char * ms_encodingstr (uint8_t encoding)
 Descriptive string for data encodings.
 
const char * ms_errorstr (int errorcode)
 Descriptive string for library Return codes.
 
nstime_t ms_sampletime (nstime_t time, int64_t offset, double samprate)
 Calculate the time of a sample in an array.
 
int ms_bigendianhost (void)
 Runtime test for host endianess.
 
int64_t lmp_ftell64 (FILE *stream)
 
int lmp_fseek64 (FILE *stream, int64_t offset, int whence)
 
uint64_t lmp_nanosleep (uint64_t nanoseconds)
 
nstime_t lmp_systemtime (void)
 
uint32_t ms_crc32c (const uint8_t *input, int length, uint32_t previousCRC32C)
 
void * libmseed_memory_prealloc (void *ptr, size_t size, size_t *currentsize)
 

Variables

LeapSecondleapsecondlist
 
LIBMSEED_MEMORY libmseed_memory
 
size_t libmseed_prealloc_block_size
 

Detailed Description

Interface declarations for the miniSEED Library (libmseed).

This file is part of the miniSEED Library.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (C) 2024:

Author
Chad Trabant, EarthScope Data Services

Macro Definition Documentation

◆ MS_ISRATETOLERABLE

#define MS_ISRATETOLERABLE ( A,
B )
Value:
(fabs (1.0 - ((A) / (B))) < 0.0001)

Macro to test default sample rate tolerance: abs(1-sr1/sr2) < 0.0001.

◆ MS2_ISDATAINDICATOR

#define MS2_ISDATAINDICATOR ( X)
Value:
((X)=='D' || (X)=='R' || (X)=='Q' || (X)=='M')

Macro to test a character for miniSEED 2.x data record/quality indicators.

◆ MS3_ISVALIDHEADER

#define MS3_ISVALIDHEADER ( X)

Macro to test a buffer for a miniSEED 3.x data record signature by checking header values at known byte offsets:

  • 0 = "M"
  • 1 = "S"
  • 2 = 3
  • 12 = valid hour (0-23)
  • 13 = valid minute (0-59)
  • 14 = valid second (0-60)

Usage, X buffer must contain at least 15 bytes:

MS3_ISVALIDHEADER ((char *)X)
#define MS3_ISVALIDHEADER(X)
Definition libmseed.h:168

◆ MS2_ISVALIDHEADER

#define MS2_ISVALIDHEADER ( X)

Macro to test a buffer for a miniSEED 2.x data record signature by checking header values at known byte offsets:

  • [0-5] = Digits, spaces or NULL, SEED sequence number
  • 6 = Data record quality indicator
  • 7 = Space or NULL [not valid SEED]
  • 24 = Start hour (0-23)
  • 25 = Start minute (0-59)
  • 26 = Start second (0-60)

Usage, X buffer must contain at least 27 bytes:

MS2_ISVALIDHEADER ((char *)X)
#define MS2_ISVALIDHEADER(X)
Definition libmseed.h:190

◆ bit

#define bit ( x,
y )
Value:
((x)&(y)) ? 1 : 0

A simple bitwise AND test to return 0 or 1

◆ DEPRECATED

#define DEPRECATED

Annotation for deprecated API components

Typedef Documentation

◆ flag

typedef int8_t flag

Single byte flag type, for legacy use