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
53DAS_API const char* das_except_toStr(das_except_t nType, int nDasVer);
54
63DAS_API das_except_t das_except_fromStr(const char* sType);
64
65typedef enum oob_type {OOB_EXCEPT, OOB_COMMENT} oob_t;
66
68typedef struct out_of_band {
69 oob_t pkttype;
70 void (*clean)(struct out_of_band* pThis);
71} OutOfBand;
72
76DAS_API void OutOfBand_clean(OutOfBand* pThis);
77
78
85typedef struct stream_exception {
86 OutOfBand base;
87
88 das_except_t nType;
89
90 char* sMsg;
91 size_t uMsgLen;
92
93} OobExcept;
94
103DAS_API void OobExcept_init(OobExcept* pThis);
104
117DAS_API void OobExcept_set(OobExcept* pThis, das_except_t nType, const char* sMsg);
118
124DAS_API const char* OobExcept_typeStr(const OobExcept* pThis);
125
130
141
152
153
160typedef struct stream_comment{
161 OutOfBand base;
162
164 char* sType;
165 size_t uTypeLen;
166
168 char* sSrc;
169 size_t uSrcLen;
170
172 char* sVal;
173 size_t uValLen;
174} OobComment;
175
184DAS_API void OobComment_init(OobComment* pThis);
185
196
208
216DAS_API DasErrCode OobComment_decode(OobComment* pThis, DasBuf* sbuf);
217
218
241DAS_API DasErrCode OutOfBand_decode(DasBuf* pBuf, OutOfBand** ppObjs, int* which);
242
243#ifdef __cplusplus
244}
245#endif
246
247#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:189
DAS_API const char * das_except_toStr(das_except_t nType, int nDasVer)
The stream name for an exception type.
DAS_API das_except_t das_except_fromStr(const char *sType)
The exception type for a stream name, from either stream version.
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:160
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:168
char * sVal
The Comment body, for some messages this is an ASCII value.
Definition oob.h:172
char * sType
The type of comment, for example log:info, taskProgress, taskSize, etc.
Definition oob.h:164
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:85
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:68
DAS_API DasErrCode OutOfBand_decode(DasBuf *pBuf, OutOfBand **ppObjs, int *which)
Factory function to produce out of band objects from general data.