
typedef enum search_type {none, search, browse, complete} search_type;

typedef struct search_result {
 char filename[255];
 char id[100];
 char user[30];
 int size;
 int bitrate;
 int frequency;
 int speed;
 int number; // length in seconds
 unsigned long int ip;
 search_type type;
 struct search_result * prev;
 struct search_result * next;
} search_result;

/* comparison functions should return < 0 if a < b */

typedef int (*compare_fn)(search_result *a, search_result *b);

void add_res(search_result *res);

int compare_file(search_result *a, search_result *b);
int compare_user(search_result *a, search_result *b);
int compare_size(search_result *a, search_result *b);
int compare_bitrate(search_result *a, search_result *b);
int compare_freq(search_result *a, search_result *b);
int compare_speed(search_result *a, search_result *b);
int compare_length(search_result *a, search_result *b);

