FreeTDS API: src/tds/stream.c File Reference

FreeTDS API

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 (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

## § 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

  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

Returns
  TDS_SUCCESS of TDS_FAIL

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

  tds | A pointer to the TDSSOCKET structure managing a client/server operation.
  istream | input stream
  ostream | output stream

Returns
  TDS_SUCCESS or TDS_FAIL

## § 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

  stream | input stream to initialize
  tds | A pointer to the TDSSOCKET structure managing a client/server operation.
  wire_size | byte 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

  stream | output stream to initialize
  tds | A pointer to the TDSSOCKET structure managing a client/server operation.

Here is the call 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

  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

Returns
  TDS_SUCCESS on success, TDS_FAIL otherwise

Here is the call 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

  stream | stream to initialize
  ptr | buffer to read from
  len | buffer size in bytes

Here is the call 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

  stream | stream to initialize
  ptr | buffer to write to
  len | buffer size in bytes

Here is the call graph for this function:
Here is the caller graph for this function: