#ifndef CALLBACK_H_
#define CALLBACK_H_
#define _XOPEN_SOURCE
#include <time.h>
#include <glib.h>
//#define _XOPEN_SOURCE //glibc2 needs this
enum error_codes
{
INVALID_SERVICE = 2,
INVALID_METHOD = 3,
AUTHENTICATION_FAILED = 4,
INVALID_FORMAT = 5,
INVALID_PARAMETERS = 6,
INVALID_RESSOURCE = 7,
INVALID_SESSION = 9,
INVALID_API = 10,
SERVICE_OFFLINE = 11,
SUBSCRIBERS_ONLY = 12
};
//should GError be not NULL you have to take care of it
//and finally call g_error_free it
//in the case of an error it is guaranteed that the
//data passed to the callback does not have to be freed
//one element callbacks - called only once
typedef void (*void_callback)(gpointer user_data, GError* error);
typedef void (*utf8_callback)(const gchar* utf8, gpointer user_data, GError* error);
typedef void (*url_callback)(const gchar* url, gpointer user_data, GError* error);
typedef void (*uint_callback)(guint digit, gpointer user_data, GError* error);
typedef void (*boolean_callback)(gboolean istrue, gpointer user_data, GError* error);
typedef void (*date_time_callback)(struct tm, gpointer user_data, GError* error);
//mutliple element callbacks
//terminated by call with is_end == TRUE
typedef void (*multi_utf8_callback)(const gchar* artist_name, gpointer user_data, GError* error, gboolean is_end);
typedef multi_utf8_callback artists_callback;
typedef multi_utf8_callback tags_callback;
typedef multi_utf8_callback tracks_callback;
typedef multi_utf8_callback albums_callback;
typedef multi_utf8_callback events_callback;
typedef multi_utf8_callback users_callback;
#endif /*CALLBACK_H_*/