das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
oob.h
Go to the documentation of this file.
1/* Copyright (C) 2015-2026 Chris Piker <chris-piker@uiowa.edu>
2 *
3 * This file is part of das2C, the Core Das2 C Library.
4 *
5 * Libdas2 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 * Libdas2 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
18
23#ifndef _das_out_of_band_h_
24#define _das_out_of_band_h_
25
26#include <das3/util.h>
27#include <das3/buffer.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33typedef enum except_type {
34 DAS_EX_UNKNOWN, DAS_EX_NO_DATA, DAS_EX_SERVER_ERR, DAS_EX_QUERY_ERR
35} das_except_t;
36
37typedef enum oob_type {OOB_EXCEPT, OOB_COMMENT} oob_t;
38
40typedef struct out_of_band {
41 oob_t pkttype;
42 void (*clean)(struct out_of_band* pThis);
43} OutOfBand;
44
48DAS_API void OutOfBand_clean(OutOfBand* pThis);
49
50
57typedef struct stream_exception {
58 OutOfBand base;
59
60 das_except_t nType;
61
62 char* sMsg;
63 size_t uMsgLen;
64
65} OobExcept;
66
75DAS_API void OobExcept_init(OobExcept* pThis);
76
86DAS_API void OobExcept_set(OobExcept* pThis, das_except_t nType, const char* sMsg);
87
92DAS_API const char* OobExcept_typeStr(const OobExcept* pThis);
93
98
109
120
121
128typedef struct stream_comment{
129 OutOfBand base;
130
132 char* sType;
133 size_t uTypeLen;
134
136 char* sSrc;
137 size_t uSrcLen;
138
140 char* sVal;
141 size_t uValLen;
142} OobComment;
143
152DAS_API void OobComment_init(OobComment* pThis);
153
164
176
184DAS_API DasErrCode OobComment_decode(OobComment* pThis, DasBuf* sbuf);
185
186
209DAS_API DasErrCode OutOfBand_decode(DasBuf* pBuf, OutOfBand** ppObjs, int* which);
210
211#ifdef __cplusplus
212}
213#endif
214
215#endif /* _das_out_of_band_h_ */
Utility to assist with encode and decode operations.
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition defs.h:184
DAS_API void OobExcept_set(OobExcept *pThis, das_except_t nType, const char *sMsg)
Set an exception structure to a particular exception.
DAS_API void OutOfBand_clean(OutOfBand *pThis)
Clean up extra memory allocated when an out of band object is initialized.
Buffer class to handle accumulating byte streams.
Definition buffer.h:47
describes human-consumable messages that exist on the stream.
Definition oob.h:128
DAS_API void OobComment_init(OobComment *pThis)
Initialize an Exception Structure This only needs to be called once, the same structure will be reuse...
DAS_API DasErrCode OobComment_encode(OobComment *pThis, DasBuf *pBuf)
Serialize a comment into a buffer in das2.2 format.
char * sSrc
The source of the comment, typically the name of a program.
Definition oob.h:136
char * sVal
The Comment body, for some messages this is an ASCII value.
Definition oob.h:140
char * sType
The type of comment, for example log:info, taskProgress, taskSize, etc.
Definition oob.h:132
DAS_API DasErrCode OobComment_encode3(OobComment *pThis, DasBuf *pBuf)
Serialize a comment into a buffer in das3.0 format.
describes an exception that can live in a stream.
Definition oob.h:57
DAS_API DasErrCode OobExcept_encode3(OobExcept *pThis, DasBuf *pBuf)
Serialize an exception into a buffer in das3.0 format.
DAS_API const char * OobExcept_typeStr(const OobExcept *pThis)
Return the das3.0 wire type string for an exception (e.g.
DAS_API DasErrCode OobExcept_encode(OobExcept *pThis, DasBuf *pBuf)
Serialize an exception into a buffer in das2.2 format.
DAS_API void OobExcept_init(OobExcept *pThis)
Initialize an Exception Structure This only needs to be called once, the same structure will be reuse...
DAS_API DasErrCode OobExcept_decode(OobExcept *pThis, DasBuf *str)
Parse text data into a stream exception.
A container for Out-of-Band data.
Definition oob.h:40
DAS_API DasErrCode OutOfBand_decode(DasBuf *pBuf, OutOfBand **ppObjs, int *which)
Factory function to produce out of band objects from general data.