Browse Source

+ f2b_source_stats()

master
Alex 'AdUser' Z 4 years ago
parent
commit
565cacad93
  1. 6
      src/source.c
  2. 7
      src/source.h

6
src/source.c

@ -128,6 +128,12 @@ f2b_source_next(f2b_source_t *source, char *buf, size_t bufsize, bool reset) {
return source->next(source->cfg, buf, bufsize, reset); return source->next(source->cfg, buf, bufsize, reset);
} }
bool
f2b_source_stats(f2b_source_t *source, char *buf, size_t bufsize) {
assert(source != NULL);
return source->stats(source->cfg, buf, bufsize);
}
#define SOURCE_CMD_ARG0(CMD, RETURNS) \ #define SOURCE_CMD_ARG0(CMD, RETURNS) \
RETURNS \ RETURNS \
f2b_source_ ## CMD(f2b_source_t *source) { \ f2b_source_ ## CMD(f2b_source_t *source) { \

7
src/source.h

@ -77,6 +77,13 @@ bool f2b_source_start (f2b_source_t *s);
* @returns >0 on new data available with filling @a buf and 0 on no data/error * @returns >0 on new data available with filling @a buf and 0 on no data/error
*/ */
uint32_t f2b_source_next (f2b_source_t *s, char *buf, size_t bufsize, bool reset); uint32_t f2b_source_next (f2b_source_t *s, char *buf, size_t bufsize, bool reset);
/**
* @brief Get internal stats from source
* @param buf Buffer for data
* @param bufsize Size of buffer for data
* @returns true on success, false on error
*/
bool f2b_source_stats (f2b_source_t *s, char *buf, size_t bufsize);
/** /**
* @brief Stop given source * @brief Stop given source
* @param s Pointer to source struct * @param s Pointer to source struct

Loading…
Cancel
Save