FreeTDS API
|
Handle stream of data. More...
#include <config.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/iconv.h>
#include <freetds/stream.h>
Functions | |
TDSRET | tds_convert_stream (TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream) |
Reads and writes from a stream converting characters. | |
TDSRET | tds_copy_stream (TDSINSTREAM *istream, TDSOUTSTREAM *ostream) |
Reads and writes from a stream to another. | |
void | tds_datain_stream_init (TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size) |
Initialize a data input stream. | |
static int | tds_datain_stream_read (TDSINSTREAM *stream, void *ptr, size_t len) |
Reads data from network for input stream. | |
void | tds_dataout_stream_init (TDSDATAOUTSTREAM *stream, TDSSOCKET *tds) |
Initialize a data output stream. | |
static int | tds_dataout_stream_write (TDSOUTSTREAM *stream, size_t len) |
Writes data to network for output stream. | |
TDSRET | tds_dynamic_stream_init (TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated) |
Initialize a dynamic output stream. | |
static int | tds_dynamic_stream_write (TDSOUTSTREAM *stream, size_t len) |
Writes data to a dynamic allocated buffer. | |
void | tds_staticin_stream_init (TDSSTATICINSTREAM *stream, const void *ptr, size_t len) |
Initialize an input stream for read from a static allocated buffer. | |
static int | tds_staticin_stream_read (TDSINSTREAM *stream, void *ptr, size_t len) |
Reads data from a static allocated buffer. | |
void | tds_staticout_stream_init (TDSSTATICOUTSTREAM *stream, void *ptr, size_t len) |
Initialize an output stream for write into a static allocated buffer. | |
static int | tds_staticout_stream_write (TDSOUTSTREAM *stream, size_t len) |
Writes data to a static allocated buffer. | |
Handle stream of data.
TDSRET tds_convert_stream | ( | TDSSOCKET * | tds, |
TDSICONV * | char_conv, | ||
TDS_ICONV_DIRECTION | direction, | ||
TDSINSTREAM * | istream, | ||
TDSOUTSTREAM * | ostream | ||
) |
Reads and writes from a stream converting characters.
Convert a stream from istream to ostream using a specific conversion.
tds | A pointer to the TDSSOCKET structure managing a client/server operation. |
char_conv | conversion structure |
direction | specify conversion to server or from server |
istream | input stream |
ostream | output stream |
TDSRET tds_copy_stream | ( | TDSINSTREAM * | istream, |
TDSOUTSTREAM * | ostream | ||
) |
Reads and writes from a stream to another.
Copy data from a stream to another.
tds | A pointer to the TDSSOCKET structure managing a client/server operation. |
istream | input stream |
ostream | output stream |
void tds_datain_stream_init | ( | TDSDATAINSTREAM * | stream, |
TDSSOCKET * | tds, | ||
size_t | wire_size | ||
) |
Initialize a data input stream.
This stream read data from network.
stream | input stream to initialize |
tds | A pointer to the TDSSOCKET structure managing a client/server operation. |
wire_size | byte to read |
void tds_dataout_stream_init | ( | TDSDATAOUTSTREAM * | stream, |
TDSSOCKET * | tds | ||
) |
Initialize a data output stream.
This stream writes data to network.
stream | output stream to initialize |
tds | A pointer to the TDSSOCKET structure managing a client/server operation. |
TDSRET tds_dynamic_stream_init | ( | TDSDYNAMICSTREAM * | stream, |
void ** | ptr, | ||
size_t | allocated | ||
) |
Initialize a dynamic output stream.
This stream write data into a dynamic allocated buffer.
stream | stream to initialize |
ptr | pointer to pointer to buffer to fill. Buffer will be extended as needed |
allocated | bytes initialially allocated for the buffer. Useful to reuse buffers |
void tds_staticin_stream_init | ( | TDSSTATICINSTREAM * | stream, |
const void * | ptr, | ||
size_t | len | ||
) |
Initialize an input stream for read from a static allocated buffer.
stream | stream to initialize |
ptr | buffer to read from |
len | buffer size in bytes |
void tds_staticout_stream_init | ( | TDSSTATICOUTSTREAM * | stream, |
void * | ptr, | ||
size_t | len | ||
) |
Initialize an output stream for write into a static allocated buffer.
stream | stream to initialize |
ptr | buffer to write to |
len | buffer size in bytes |