#ifndef TRANSMISSION_H
#define TRANSMISSION_H

typedef struct TransmissionSession TransmissionSession;
struct TransmissionSession {
    char session_header[128];
};

typedef void (*TorrentListCallback)(int id, const char *name, double percentage_done, void *userdata);

int transmission_connect(TransmissionSession *session);

/* Returns 0 if the daemon is running, otherwise returns an error value */
int transmission_is_daemon_running();
int transmission_start_daemon(const char *download_dir);

/*
    The torrent id will be stored in @torrent_id, malloc'ed and
    the torrent name will be stored in @torrent_name, malloc'ed.
*/
int transmission_add_torrent(TransmissionSession *session, const char *url, int *torrent_id, char **torrent_name);

int transmission_list_torrents(TransmissionSession *session, TorrentListCallback callback, void *userdata);

#endif