FreeTDS API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Functions
stream.c File Reference

Handle stream of data. More...

#include <config.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/iconv.h>
#include <freetds/stream.h>
Include dependency graph for stream.c:

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. More...
 
TDSRET tds_copy_stream (TDSSOCKET *tds, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
 Reads and writes from a stream to another. More...
 
void tds_datain_stream_init (TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
 Initialize a data input stream. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static int tds_staticout_stream_write (TDSOUTSTREAM *stream, size_t len)
 Writes data to a static allocated buffer.
 

Detailed Description

Handle stream of data.

Function Documentation

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.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
char_convconversion structure
directionspecify conversion to server or from server
istreaminput stream
ostreamoutput stream
Returns
TDS_SUCCESS of TDS_FAIL

Here is the call graph for this function:

Here is the caller graph for this function:

TDSRET tds_copy_stream ( TDSSOCKET tds,
TDSINSTREAM istream,
TDSOUTSTREAM ostream 
)

Reads and writes from a stream to another.

Copy data from a stream to another.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
istreaminput stream
ostreamoutput stream
Returns
TDS_SUCCESS or TDS_FAIL

Here is the caller graph for this function:

void tds_datain_stream_init ( TDSDATAINSTREAM stream,
TDSSOCKET tds,
size_t  wire_size 
)

Initialize a data input stream.

This stream read data from network.

Parameters
streaminput stream to initialize
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
wire_sizebyte to read

Here is the call graph for this function:

Here is the caller graph for this function:

void tds_dataout_stream_init ( TDSDATAOUTSTREAM stream,
TDSSOCKET tds 
)

Initialize a data output stream.

This stream writes data to network.

Parameters
streamoutput stream to initialize
tdsA pointer to the TDSSOCKET structure managing a client/server operation.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
streamstream to initialize
ptrpointer to pointer to buffer to fill. Buffer will be extended as needed
allocatedbytes initialially allocated for the buffer. Useful to reuse buffers
Returns
TDS_SUCCESS on success, TDS_FAIL otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

void tds_staticin_stream_init ( TDSSTATICINSTREAM stream,
const void *  ptr,
size_t  len 
)

Initialize an input stream for read from a static allocated buffer.

Parameters
streamstream to initialize
ptrbuffer to read from
lenbuffer size in bytes

Here is the call graph for this function:

Here is the caller graph for this function:

void tds_staticout_stream_init ( TDSSTATICOUTSTREAM stream,
void *  ptr,
size_t  len 
)

Initialize an output stream for write into a static allocated buffer.

Parameters
streamstream to initialize
ptrbuffer to write to
lenbuffer size in bytes

Here is the call graph for this function:

Here is the caller graph for this function: