das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
processor.h File Reference

Callback processing for das2 stream reads and writes. More...

#include <das3/stream.h>
#include <das3/oob.h>
Include dependency graph for processor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

interface  StreamHandler
 A set of callbacks used for input and output stream processing. More...
 

Typedefs

typedef DasErrCode(* DasStreamHandler) (DasStream *sd, void *ud)
 Definition of the callback function invoked when a stream header is encountered in the input.
 
typedef DasErrCode(* PktDescHandler) (DasStream *sd, PktDesc *pd, void *ud)
 Definition of the callback function invoked when a packet header is encountered in the input.
 
typedef DasErrCode(* PktRedefHandler) (DasStream *sd, DasDesc *pd, void *ud)
 Definition of the callback function invoked when a packet header is going to be deleted.
 
typedef DasErrCode(* PktDataHandler) (PktDesc *pd, void *ud)
 Callback function invoked when a data packet is encountered in the input.
 
typedef DasErrCode(* DsDescHandler) (DasStream *sd, int pi, DasDs *dd, void *ud)
 Callback function invoked when a dataset header is encountered on the input stream.
 
typedef DasErrCode(* DsDataHandler) (DasStream *sd, int pi, DasDs *dd, void *ud)
 Callback function invoked when new data packets for a dataset are encountered on the stream.
 
typedef DasErrCode(* RawDataHandler) (DasStream *sd, int pi, DasDesc *dd, const DasBuf *pb, void *ud)
 Callback function invoked with the undecoded bytes of a data packet.
 
typedef DasErrCode(* CloseHandler) (DasStream *sd, void *ud)
 Callback functions that are invoked on Stream Close callback function that is called at the end of the stream.
 
typedef DasErrCode(* ExceptionHandler) (OobExcept *se, void *ud)
 Callback functions that handle exceptions.
 
typedef DasErrCode(* CommentHandler) (OobComment *se, void *ud)
 Callback functions that handle comments.
 

Functions

DAS_API void del_StreamHandler (StreamHandler *pThis)
 Type safe wrapper around free()
 

Detailed Description

Callback processing for das2 stream reads and writes.

These structure allow one to hook in Das2 Stream object processing that is triggered when Headers and Data are read or written to a file.

Typedef Documentation

◆ DasStreamHandler

typedef DasErrCode(* DasStreamHandler) (DasStream *sd, void *ud)

Definition of the callback function invoked when a stream header is encountered in the input.

Parameters
sdA pointer to the parsed DasStream
pdA pointer to a user data structure, may be NULL.
See also
StreamHandler

◆ PktDescHandler

typedef DasErrCode(* PktDescHandler) (DasStream *sd, PktDesc *pd, void *ud)

Definition of the callback function invoked when a packet header is encountered in the input.

Parameters
sdA pointer to the parsed Stream Descriptor
pdA pointer to the parsed Packet Descriptor
udA pointer to a user data structure, may be NULL.
See also
StreamHandler

◆ PktRedefHandler

typedef DasErrCode(* PktRedefHandler) (DasStream *sd, DasDesc *pd, void *ud)

Definition of the callback function invoked when a packet header is going to be deleted.

This only occurs if streams re-define packet IDs

Parameters
sdA pointer to the parsed Stream Descriptor
pdThe descriptor about to be deleted. das2 streams keep a PktDesc in the ID slot, das3 streams a DasDs, so check DasDesc_type() before casting. Handlers that only want the signal can ignore it entirely.
udA pointer to a user data structure, may be NULL.
Returns
DAS_OKAY to let the redefinition proceed. Any other value refuses it: the old descriptor is left intact and the read stops with that code. Refuse if you were accumulating data that can't survive the descriptor going away.
See also
StreamHandler

◆ PktDataHandler

typedef DasErrCode(* PktDataHandler) (PktDesc *pd, void *ud)

Callback function invoked when a data packet is encountered in the input.

Note
Decoding happens on demand. If no processor supplies a packet data handler, DasIO reads past the data bytes without parsing them, so a program only pays for values it asked for. To validate packet contents without otherwise using them, register a handler that does nothing.
Parameters
pdA pointer to the parsed Packet Descriptor
udA pointer to a user data structure, may be NULL.
See also
StreamHandler

◆ DsDescHandler

typedef DasErrCode(* DsDescHandler) (DasStream *sd, int pi, DasDs *dd, void *ud)

Callback function invoked when a dataset header is encountered on the input stream.

Parameters
sdA pointer to the parsed Stream Descriptor
piThe packet ID associated with this dataset
ddA pointer to a parsed DasDs (dataset) definition
udA pointer to a user data structure, may be NULL

◆ DsDataHandler

typedef DasErrCode(* DsDataHandler) (DasStream *sd, int pi, DasDs *dd, void *ud)

Callback function invoked when new data packets for a dataset are encountered on the stream.

Note
Decoding happens on demand. If no processor supplies a dataset data handler, DasIO reads past the data bytes without parsing them, so a program only pays for values it asked for. To validate packet contents without otherwise using them, register a handler that just calls DasDs_clearRagged0() so the dataset does not grow without bound.
Parameters
sdA pointer to the parsed Stream Descriptor
piThe packet ID associated with this dataset
ddA pointer to a parsed DasDs (dataset) definition
udA pointer to a user data structure, may be NULL

◆ RawDataHandler

typedef DasErrCode(* RawDataHandler) (DasStream *sd, int pi, DasDesc *dd, const DasBuf *pb, void *ud)

Callback function invoked with the undecoded bytes of a data packet.

Raw handlers run before any decoding, so a program that registers only these never pays for value parsing at all.

The buffer holds exactly one packet payload with the read point at its start; DasBuf_direct() gives the pointer and length. The buffer is reused for the next packet, so copy what you need before returning. DasIO restores the read point after each call, so multiple stream processors handlers may use the buffer.

Parameters
sdA pointer to the parsed Stream Descriptor
piThe packet ID the bytes belong to
ddThe descriptor in that ID slot, a PktDesc for das2 model reads or a DasDs for das3, so check DasDesc_type() before casting. It is what DasIO used to find the payload length on das2 wire input.
pbThe payload bytes
udA pointer to a user data structure, may be NULL
See also
StreamHandler

◆ CloseHandler

typedef DasErrCode(* CloseHandler) (DasStream *sd, void *ud)

Callback functions that are invoked on Stream Close callback function that is called at the end of the stream.

Parameters
sdA pointer to the parsed Stream Descriptor
udA pointer to a user data structure, may be NULL.
See also
StreamHandler

◆ ExceptionHandler

typedef DasErrCode(* ExceptionHandler) (OobExcept *se, void *ud)

Callback functions that handle exceptions.

Parameters
seA pointer to the parsed Exception
udA pointer to a user data structure, may be NULL.
See also
StreamHandler

◆ CommentHandler

typedef DasErrCode(* CommentHandler) (OobComment *se, void *ud)

Callback functions that handle comments.

Parameters
seA pointer to the parsed Comment
udA pointer to a user data structure, may be NULL.
See also
StreamHandler