das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
processor.h
Go to the documentation of this file.
1/* Copyright (C) 2015-2017 Chris Piker <chris-piker@uiowa.edu>
2 *
3 * This file is part of das2C, the Core Das2 C Library.
4 *
5 * Das2C is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License version 2.1 as published
7 * by the Free Software Foundation.
8 *
9 * Das2C is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * version 2.1 along with das2C; if not, see <http://www.gnu.org/licenses/>.
16 */
17
24#ifndef _das_processor_h_
25#define _das_processor_h_
26
27#include <das3/stream.h>
28#include <das3/oob.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
41typedef DasErrCode (*DasStreamHandler)(DasStream* sd, void* ud);
42
50typedef DasErrCode (*PktDescHandler)(DasStream* sd, PktDesc* pd, void* ud);
51
68typedef DasErrCode (*PktRedefHandler)(DasStream* sd, DasDesc* pd, void* ud);
69
81typedef DasErrCode (*PktDataHandler)(PktDesc* pd, void* ud);
82
83
94typedef DasErrCode (*DsDescHandler)(DasStream* sd, int pi, DasDs* dd, void* ud);
95
110typedef DasErrCode (*DsDataHandler)(DasStream* sd, int pi, DasDs* dd, void* ud);
111
133 DasStream* sd, int pi, DasDesc* dd, const DasBuf* pb, void* ud
134);
135
142typedef DasErrCode (*CloseHandler)(DasStream* sd, void* ud);
143
149typedef DasErrCode (*ExceptionHandler)(OobExcept* se, void* ud);
150
156typedef DasErrCode (*CommentHandler)(OobComment* se, void* ud);
157
158
224
237DAS_API void StreamHandler_init(StreamHandler* pThis, void* pUserData);
238
251DAS_API StreamHandler* new_StreamHandler(void* pUserData);
252
254DAS_API void del_StreamHandler(StreamHandler* pThis);
255
256#ifdef __cplusplus
257}
258#endif
259
260#endif /* _das_processor_h_ */
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition defs.h:189
Defines the "Out of Band" objects in a stream.
DasErrCode(* PktDataHandler)(PktDesc *pd, void *ud)
Callback function invoked when a data packet is encountered in the input.
Definition processor.h:81
DasErrCode(* CloseHandler)(DasStream *sd, void *ud)
Callback functions that are invoked on Stream Close callback function that is called at the end of th...
Definition processor.h:142
DasErrCode(* CommentHandler)(OobComment *se, void *ud)
Callback functions that handle comments.
Definition processor.h:156
DasErrCode(* DasStreamHandler)(DasStream *sd, void *ud)
Definition of the callback function invoked when a stream header is encountered in the input.
Definition processor.h:41
DasErrCode(* ExceptionHandler)(OobExcept *se, void *ud)
Callback functions that handle exceptions.
Definition processor.h:149
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.
Definition processor.h:110
DasErrCode(* RawDataHandler)(DasStream *sd, int pi, DasDesc *dd, const DasBuf *pb, void *ud)
Callback function invoked with the undecoded bytes of a data packet.
Definition processor.h:132
DAS_API void del_StreamHandler(StreamHandler *pThis)
Type safe wrapper around free()
DasErrCode(* DsDescHandler)(DasStream *sd, int pi, DasDs *dd, void *ud)
Callback function invoked when a dataset header is encountered on the input stream.
Definition processor.h:94
DasErrCode(* PktDescHandler)(DasStream *sd, PktDesc *pd, void *ud)
Definition of the callback function invoked when a packet header is encountered in the input.
Definition processor.h:50
DasErrCode(* PktRedefHandler)(DasStream *sd, DasDesc *pd, void *ud)
Definition of the callback function invoked when a packet header is going to be deleted.
Definition processor.h:68
Objects representing a single das stream.
Buffer class to handle accumulating byte streams.
Definition buffer.h:47
Base structure for Stream Header Items.
Definition descriptor.h:74
Das Datasets.
Definition dataset.h:159
Describes the stream itself, in particular the compression used, current packetDescriptors,...
Definition stream.h:91
describes human-consumable messages that exist on the stream.
Definition oob.h:160
describes an exception that can live in a stream.
Definition oob.h:85
Holds information for a single packet type in a Das2 stream.
Definition packet.h:138
A set of callbacks used for input and output stream processing.
Definition processor.h:163
DsDescHandler dsDescHandler
Sets the function to be called when each dataset definition is read in (das3)
Definition processor.h:184
RawDataHandler rawDataHandler
Sets the function to be called with the raw bytes of each data packet, before any decoding.
Definition processor.h:192
CloseHandler closeHandler
Sets the function to be called the reading of the stream is completed.
Definition processor.h:216
void * userData
An optional User-data pointer that is passed along to all callbacks.
Definition processor.h:221
DAS_API void StreamHandler_init(StreamHandler *pThis, void *pUserData)
Initialize a stream processor with default callbacks.
PktDataHandler pktDataHandler
Sets the function to be called when each data packet is read in.
Definition processor.h:180
PktRedefHandler pktRedefHandler
Sets the function to be called when a packet ID is about to be re-defined before the old pkt descript...
Definition processor.h:177
PktDescHandler pktDescHandler
Sets the function to be called when each <packet> element is read in.
Definition processor.h:173
CommentHandler commentHandler
StreamCommentHandler receives stream annotations.
Definition processor.h:212
ExceptionHandler exceptionHandler
Sets the function to be called when a stream exception is read in.
Definition processor.h:199
DAS_API StreamHandler * new_StreamHandler(void *pUserData)
Create a new stream processor with default callbacks.
DasStreamHandler streamDescHandler
The function to be called when the stream header is read in.
Definition processor.h:168
DsDataHandler dsDataHandler
Sets the function to be called when each dataset receives new data (das3)
Definition processor.h:188