00001
00005 #ifndef _das2_oob_h_
00006 #define _das2_oob_h_
00007
00008 #include <das2/util.h>
00009 #include <das2/buffer.h>
00010
00012 #define EXCEPTION_UNTYPED ""
00013
00015 #define DAS2_EXCEPT_NO_DATA_IN_INTERVAL "NoDataInInterval"
00016 #define DAS2_EXCEPT_ILLEGAL_ARGUMENT "IllegalArgument"
00017 #define DAS2_EXCEPT_SERVER_ERROR "ServerError"
00018
00019 typedef enum oob_type {OOB_EXCEPT, OOB_COMMENT} oob_t;
00020
00022 typedef struct out_of_band {
00023 oob_t pkttype;
00024 void (*clean)(struct out_of_band* pThis);
00025 } OutOfBand;
00026
00030 void OutOfBand_clean(OutOfBand* pThis);
00031
00037 typedef struct stream_exception {
00038 OutOfBand base;
00039
00040 char* sType;
00041 size_t uTypeLen;
00042
00043 char* sMsg;
00044 size_t uMsgLen;
00045
00046 } OobExcept;
00047
00055 void OobExcept_init(OobExcept* pThis);
00056
00067 void OobExcept_set(OobExcept* pThis, const char* sType, const char* sMsg);
00068
00072 ErrorCode OobExcept_decode(OobExcept* pThis, DasBuf* str);
00073
00081 ErrorCode OobExcept_encode(OobExcept* pThis, DasBuf* pBuf);
00082
00083
00089 typedef struct stream_comment{
00090 OutOfBand base;
00091
00093 char* sType;
00094 size_t uTypeLen;
00095
00097 char* sSrc;
00098 size_t uSrcLen;
00099
00101 char* sVal;
00102 size_t uValLen;
00103 } OobComment;
00104
00112 void OobComment_init(OobComment* pThis);
00113
00121 ErrorCode OobComment_encode(OobComment* pThis, DasBuf* pBuf);
00122
00130 ErrorCode OobComment_decode(OobComment* pThis, DasBuf* sbuf);
00131
00132
00155 ErrorCode OutOfBand_decode(DasBuf* pBuf, OutOfBand** ppObjs, int* which);
00156
00157
00158 #endif