ms_msg_list.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * $Id$
  3. *
  4. * MSILO module
  5. *
  6. * Copyright (C) 2001-2003 FhG Fokus
  7. *
  8. * This file is part of Kamailio, a free SIP server.
  9. *
  10. * Kamailio is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * Kamailio is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * History:
  25. * --------
  26. * 2003-03-11 major locking changes, now it uses locking.h (andrei)
  27. */
  28. #ifndef _MS_MSG_LIST_H_
  29. #define _MS_MSG_LIST_H_
  30. #include "../../locking.h"
  31. #define MS_MSG_NULL 0
  32. #define MS_MSG_SENT 1
  33. #define MS_MSG_DONE 4
  34. #define MS_MSG_ERRO 8
  35. #define MS_MSG_TSND 16
  36. #define MS_SEM_SENT 0
  37. #define MS_SEM_DONE 1
  38. #define MSG_LIST_OK 0
  39. #define MSG_LIST_ERR -1
  40. #define MSG_LIST_EXIST 1
  41. typedef struct _msg_list_el
  42. {
  43. int msgid;
  44. int flag;
  45. struct _msg_list_el * prev;
  46. struct _msg_list_el * next;
  47. } t_msg_list_el, *msg_list_el;
  48. typedef struct _msg_list
  49. {
  50. int nrsent;
  51. int nrdone;
  52. msg_list_el lsent;
  53. msg_list_el ldone;
  54. gen_lock_t sem_sent;
  55. gen_lock_t sem_done;
  56. } t_msg_list, *msg_list;
  57. msg_list_el msg_list_el_new(void);
  58. void msg_list_el_free(msg_list_el);
  59. void msg_list_el_free_all(msg_list_el);
  60. msg_list msg_list_init(void);
  61. void msg_list_free(msg_list);
  62. int msg_list_check_msg(msg_list, int);
  63. int msg_list_set_flag(msg_list, int, int);
  64. int msg_list_check(msg_list);
  65. msg_list_el msg_list_reset(msg_list);
  66. #endif