1
/******************************************************
2
Copyright (c) 2011 Percona Inc.
4
The xbstream format interface.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; version 2 of the License.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*******************************************************/
26
/* Magic value in a chunk header */
27
#define XB_STREAM_CHUNK_MAGIC "XBSTCK01"
30
/* Chunk can be ignored if unknown version/format */
31
#define XB_STREAM_FLAG_IGNORABLE 0x01
33
typedef struct xb_wstream_struct xb_wstream_t;
35
typedef struct xb_wstream_file_struct xb_wstream_file_t;
37
/************************************************************************
40
xb_wstream_t *xb_stream_write_new(void);
42
xb_wstream_file_t *xb_stream_write_open(xb_wstream_t *stream, const char *path,
45
int xb_stream_write_data(xb_wstream_file_t *file, const void *buf, size_t len);
47
int xb_stream_write_close(xb_wstream_file_t *file);
49
int xb_stream_write_done(xb_wstream_t *stream);
51
/************************************************************************
58
} xb_rstream_result_t;
61
XB_CHUNK_TYPE_UNKNOWN = '\0',
62
XB_CHUNK_TYPE_PAYLOAD = 'P',
63
XB_CHUNK_TYPE_EOF = 'E'
66
typedef struct xb_rstream_struct xb_rstream_t;
79
xb_rstream_t *xb_stream_read_new(void);
81
xb_rstream_result_t xb_stream_read_chunk(xb_rstream_t *stream,
82
xb_rstream_chunk_t *chunk);
84
int xb_stream_read_done(xb_rstream_t *stream);