libosip  4.0.0
osip_fifo.h
Go to the documentation of this file.
1 /*
2  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3  Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _FIFO_H_
21 #define _FIFO_H_
22 
23 #ifndef OSIP_MONOTHREAD
24 #include <osip2/osip_mt.h>
25 #endif
26 #include <osipparser2/osip_list.h>
27 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 #ifndef DOXYGEN
48 
49  typedef enum { osip_ok, osip_empty } osip_fifo_state;
50 
51 #endif
52 
57  typedef struct osip_fifo osip_fifo_t;
58 
63  struct osip_fifo {
64 #ifndef OSIP_MONOTHREAD
66  struct osip_sem *qisempty;
67 #endif
69  int nb_elt;
70  osip_fifo_state state;
71  };
72 
82  void osip_fifo_init (osip_fifo_t * ff);
87  void osip_fifo_free (osip_fifo_t * ff);
93  int osip_fifo_insert (osip_fifo_t * ff, void *element);
99  int osip_fifo_add (osip_fifo_t * ff, void *element);
104  int osip_fifo_size (osip_fifo_t * ff);
105 #ifndef OSIP_MONOTHREAD
106 
110  void *osip_fifo_get (osip_fifo_t * ff);
111 #endif
112 
116  void *osip_fifo_tryget (osip_fifo_t * ff);
117 
118 
122 #ifdef __cplusplus
123 }
124 #endif
125 #endif