modules_s/msilo/ms_msg_list.h

00001 
00029 /*
00030  * History:
00031  * --------
00032  *  2003-03-11  major locking changes, now it uses locking.h (andrei)
00033  */
00034 
00035 #ifndef _MS_MSG_LIST_H_
00036 #define _MS_MSG_LIST_H_
00037 
00038 
00039 #include "../../locking.h"
00040 
00041 #define MS_MSG_NULL     0
00042 #define MS_MSG_SENT     1
00043 #define MS_MSG_DONE     4
00044 #define MS_MSG_ERRO     8
00045 
00046 #define MS_SEM_SENT     0
00047 #define MS_SEM_DONE 1
00048 
00049 #define MSG_LIST_OK             0
00050 #define MSG_LIST_ERR    -1
00051 #define MSG_LIST_EXIST  1
00052 
00053 typedef struct _msg_list_el
00054 {
00055         int msgid;
00056         int flag;
00057         struct _msg_list_el * prev;
00058         struct _msg_list_el * next;
00059 } t_msg_list_el, *msg_list_el;
00060 
00061 typedef struct _msg_list
00062 {
00063         int nrsent;
00064         int nrdone;
00065         msg_list_el lsent;
00066         msg_list_el ldone;
00067         gen_lock_t  sem_sent;
00068         gen_lock_t  sem_done;
00069 } t_msg_list, *msg_list;
00070 
00071 msg_list_el msg_list_el_new();
00072 void msg_list_el_free(msg_list_el);
00073 void msg_list_el_free_all(msg_list_el);
00074 
00075 msg_list msg_list_init();
00076 void msg_list_free(msg_list);
00077 int msg_list_check_msg(msg_list, int);
00078 int msg_list_set_flag(msg_list, int, int);
00079 int msg_list_check(msg_list);
00080 msg_list_el msg_list_reset(msg_list);
00081 
00082 #endif
00083