FreeTDS API
Loading...
Searching...
No Matches
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.
 
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.
 

Detailed Description

Handle stream of data.

Function Documentation

◆ tds_convert_stream()

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:

◆ tds_copy_stream()

TDSRET tds_copy_stream ( 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:

◆ tds_datain_stream_init()

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:

◆ tds_dataout_stream_init()

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:

◆ tds_dynamic_stream_init()

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:

◆ tds_staticin_stream_init()

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:

◆ tds_staticout_stream_init()

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: