/*
 * tinylib -- a deliberately small stand-in for "some C library you did not
 * write". It has the three features that make wrapping interesting: an
 * opaque handle with an explicit close, integer error codes, and a callback.
 */
#ifndef TINYLIB_H
#define TINYLIB_H

#define TINY_OK      0
#define TINY_EINVAL  1
#define TINY_ENOMEM  2
#define TINY_ERANGE  3

typedef struct tiny_handle tiny_handle;

/* Invoked by tiny_push, on the calling thread. */
typedef void (*tiny_cb)(void *userdata, int value);

int  tiny_open(const char *name, tiny_handle **out);
void tiny_close(tiny_handle *h);
int  tiny_push(tiny_handle *h, int value);
int  tiny_total(tiny_handle *h, long *out);
void tiny_set_callback(tiny_handle *h, tiny_cb cb, void *userdata);
const char *tiny_strerror(int rc);

#endif /* TINYLIB_H */
