modules_k/msilo/ms_msg_list.h

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