Data Streams
Functions for reading, writing, etc data streams. More...
Functions | |
zos_result_t | zn_write (uint32_t handle, const void *data, uint32_t size, zos_bool_t auto_flush) |
Write data to streamSee ZentriOS Command API documentation: stream_write. More... | |
zos_result_t | zn_read (uint32_t handle, void *data, uint32_t max_size, uint32_t *bytes_read) |
Read data from streamSee ZentriOS Command API documentation: stream_read. More... | |
zos_result_t | zn_read_with_buffer (uint32_t handle, zos_buffer_t *buf) |
Read data from stream info zos_buffer_tThis has similar functionality as zn_read() except a zos_buffer_t is passed as an argument allowing for zero memory copies. More... | |
zos_result_t | zn_close (uint32_t handle) |
Close streamSee ZentriOS Command API documentation: stream_close. More... | |
zos_result_t | zn_poll (uint32_t handle, uint32_t *rx_bytes_available) |
Poll stream for read dataThis polls the given stream and returns if it has data to be read. More... | |
zos_result_t | zn_poll_rxtx (uint32_t handle, uint32_t *rx_bytes_available, uint32_t *tx_bytes_available) |
Poll stream for RX and TX buffer availableThis polls the given stream and returns if it has data to be read and available TX buffer space. More... | |
Detailed Description
Functions for reading, writing, etc data streams.
Function Documentation
zos_result_t zn_close | ( | uint32_t | handle | ) |
Close streamSee ZentriOS Command API documentation: stream_close.
- Parameters
-
[in] handle
Handle of stream to close (use -1 to close all streams)
- Returns
- zos_result_t result of api call
zos_result_t zn_poll | ( | uint32_t | handle, |
uint32_t * | rx_bytes_available |
||
) |
Poll stream for read dataThis polls the given stream and returns if it has data to be read.
- Parameters
-
[in] handle
Handle of stream to poll [out] rx_bytes_available
Pointer to hold number of bytes available to read
- Returns
- zos_result_t result of api call
zos_result_t zn_poll_rxtx | ( | uint32_t | handle, |
uint32_t * | rx_bytes_available, |
||
uint32_t * | tx_bytes_available |
||
) |
Poll stream for RX and TX buffer availableThis polls the given stream and returns if it has data to be read and available TX buffer space.
- Parameters
-
[in] handle
Handle of stream to poll [out] rx_bytes_available
Pointer to hold number of bytes available to read [out] tx_bytes_available
Pointer to hold available TX buffer space
- Returns
- zos_result_t result of api call
zos_result_t zn_read | ( | uint32_t | handle, |
void * | data, |
||
uint32_t | max_size, |
||
uint32_t * | bytes_read |
||
) |
Read data from streamSee ZentriOS Command API documentation: stream_read.
- Parameters
-
[in] handle
Stream handle returned by API call [out] data
Buffer to hold read data [in] max_size
Maximum amount of data to read [out] bytes_read
Pointer to hold actual amount of data read (set NULL if not used)
- Returns
- zos_result_t result of api call
zos_result_t zn_read_with_buffer | ( | uint32_t | handle, |
zos_buffer_t * | buf |
||
) |
Read data from stream info zos_buffer_tThis has similar functionality as zn_read() except a zos_buffer_t is passed as an argument allowing for zero memory copies.
Only the 'size' field of the given zos_buffer_t argument should be populated with the maximum amount of data to read. The 'data' field should be NULL. When the API call returns:
- the 'size' field is updated with the amount of data actually read
- the 'data' field will be populated with the data pointer (if data was available)
Example usage:
- Parameters
-
[in] handle
Stream handle returned by API call [out] buf
Buffer to hold read data
- Returns
- zos_result_t result of api call
zos_result_t zn_write | ( | uint32_t | handle, |
const void * | data, |
||
uint32_t | size, |
||
zos_bool_t | auto_flush |
||
) |
Write data to streamSee ZentriOS Command API documentation: stream_write.
- Parameters
-
[in] handle
Stream handle returned by API call [in] data
Data to write to stream [in] size
Size of data in bytes to write [in] auto_flush
If ZOS_TRUE, only flush data when the internal buffer is full, ZOS_FALSE flush the data immediately
- Returns
- zos_result_t result of api call