/*
 * response_list.h
 *
 * Definition and declarations of responses queue
 * 
 */
 
 
#ifndef _RESPONSE_LIST_H_
#define _RESPONSE_LIST_H_

#include <bs_proto.h>

/* response_t */
typedef struct response {
	bs_pdu_res_t *res;
	int ressz;
} response_t;

/* lst_iitem - each element of the list points to the next element */
typedef struct res_lst_iitem {
	response_t response;
	struct res_lst_iitem *next;
} res_lst_iitem_t;

/* list_t */
typedef struct {
	res_lst_iitem_t *first;
	res_lst_iitem_t *last;
} res_list_t;


/* lst_new - allocates memory for list_t and initializes it */
res_list_t* res_lst_new();

/* lst_destroy - frees memory of list_t and all its items */
void res_lst_destroy(res_list_t *list);

/* lst_insert - inserts a new item with value 'response' in list 'list' */
void res_lst_insert(res_list_t *list, response_t *response);

/* lst_print - prints the content of list 'list' to standard output */
void res_lst_print(res_list_t *list);

/* lst_pop - removes the first item from the list 'list' and returns a pointer to it */
response_t* res_lst_pop(res_list_t *list);

#endif
