These functions allow for implementing modules refering to bytestreams. These objects can receive data from the bytestream and send data to the bytestream.
An i/o module can check if a given object implements an FTS bytestream and whether it is an input and/or an output using the functions fts_bytestream_check(), fts_bytestream_is_input() and fts_bytestream_is_output(). The API provides functions for declaring a module as a listener to a bytestream (see fts_bytestream_add_listener()) and output functions sending events to a bytestream (see fts_bytestream_output()).
Functions | |
FTS_API int | fts_bytestream_check (fts_object_t *obj) |
Check whether an FTS object implements the bytestream abstraction. | |
int | fts_bytestream_is_input (fts_bytestream_t *stream) |
Check whether an FTS bytestream is an input. | |
int | fts_bytestream_is_output (fts_bytestream_t *stream) |
Check whether an FTS bytestream is an input. | |
FTS_API void | fts_bytestream_add_listener (fts_bytestream_t *stream, void *listener, fts_bytestream_callback_t fun) |
Register listener to a bytestream. | |
FTS_API void | fts_bytestream_remove_listener (fts_bytestream_t *stream, void *listener) |
Remove listener from a bytestream. | |
FTS_API void | fts_bytestream_output (fts_bytestream_t *stream, int n, const unsigned char *c) |
Send a string to a bytestream. | |
FTS_API void | fts_bytestream_output_char (fts_bytestream_t *stream, unsigned char c) |
Send a single character to a bytestream. | |
FTS_API void | fts_bytestream_flush (fts_bytestream_t *stream) |
Flush bytestreams output buffer (if any). |
FTS_API void fts_bytestream_add_listener | ( | fts_bytestream_t * | stream, | |
void * | listener, | |||
fts_bytestream_callback_t | fun | |||
) |
Register listener to a bytestream.
stream | the listened bytestream | |
listener | the listener | |
fun | listener function to be called for incoming data |
FTS_API int fts_bytestream_check | ( | fts_object_t * | obj | ) |
Check whether an FTS object implements the bytestream abstraction.
A module that wants to listen to or output via a bytestream should check if the object it referes to implements the bytestream abstraction
obj | the object to be checked |
FTS_API void fts_bytestream_flush | ( | fts_bytestream_t * | stream | ) |
Flush bytestreams output buffer (if any).
stream | the bytestream |
int fts_bytestream_is_input | ( | fts_bytestream_t * | stream | ) |
Check whether an FTS bytestream is an input.
stream | the bytestream to be checked |
int fts_bytestream_is_output | ( | fts_bytestream_t * | stream | ) |
Check whether an FTS bytestream is an input.
stream | the bytestream to be checked |
FTS_API void fts_bytestream_output | ( | fts_bytestream_t * | stream, | |
int | n, | |||
const unsigned char * | c | |||
) |
Send a string to a bytestream.
stream | the bytestream | |
n | the number of characters | |
c | the characters |
FTS_API void fts_bytestream_output_char | ( | fts_bytestream_t * | stream, | |
unsigned char | c | |||
) |
Send a single character to a bytestream.
stream | the bytestream | |
c | the character |
FTS_API void fts_bytestream_remove_listener | ( | fts_bytestream_t * | stream, | |
void * | listener | |||
) |
Remove listener from a bytestream.
An object listening to a bytestream must be removed as listener before being destroyed. Typically this is done in the object's delete method.
stream | the listened bytestream | |
listener | the listener |