dag_get_stream_buffer_level(3)

NAME
dag_get_stream_buffer_level - retrieve the number of outstanding bytes in the memory buffer associated with a stream

SYNOPSIS
#include "dagapi.h "

int
dag_get_stream_buffer_level(int dagfd, int stream_num);

DESCRIPTION
dag_get_stream_buffer_level returns the number of bytes outstanding in the stream's memory buffer.

For transmit streams this is the number of bytes that have been committed by the user but not yet transmitted. Space allocated using dag_tx_get_stream_space(3) which has not been committed for transmission is not counted.

For receive streams this is the number of bytes of data available to the user for reading. This does include bytes that the user may have read but has not yet freed by calling dag_advance_stream(3) or dag_rx_stream_next_record(3).

For efficiency reasons dag_rx_stream_next_record may not free buffer space occupied by previously read packets immediately.

dag_rx_stream_next_record reads hardware registers on the DAG card, so each call will generate bus transactions. If polled at high rates this could potentially interfere with data capture or transmission operations.

RETURN VALUE
On success dag_get_stream_buffer_level returns the number of bytes outstanding in the stream's memory buffer (a non-negative integer), otherwise it returns -1 with errno set appropriately.

ERRORS

EBADF
    dagfd is an invalid file descriptor.

EINVAL
    stream_num refers to a stream that has not been attached.

EXAMPLE
FIXME Sample code.

SEE ALSO
dag_advance_stream(3), dag_attach_stream(3), dag_detach_stream(3), dag_get_stream_buffer_size(3), dag_get_stream_poll(3), dag_rx_get_stream_count(3), dag_rx_stream_next_inline(3), dag_rx_stream_next_record(3), dag_set_stream_poll(3), dag_start_stream(3), dag_stop_stream(3), dag_tx_get_stream_space(3).

BUGS
Report bugs to <support@endace.com>.

LAST UPDATED
$Author: koryn $
$Revision: 2474 $
$Date: 2005-11-10 11:13:19 +1300 (Thu, 10 Nov 2005) $

COPYRIGHT
(c) 2004-2005 Endace Technology, Hamilton, New Zealand. All Rights Reserved.