libosip  5.3.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-2020 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 #ifndef DOXYGEN
47 
48 typedef enum { osip_ok, osip_empty } osip_fifo_state;
49 
50 #endif
51 
56 typedef struct osip_fifo osip_fifo_t;
57 
62 struct osip_fifo {
63 #ifndef OSIP_MONOTHREAD
65  struct osip_sem *qisempty;
66 #endif
68  int nb_elt;
69  osip_fifo_state state;
70 };
71 
81 void osip_fifo_init(osip_fifo_t *ff);
86 void osip_fifo_free(osip_fifo_t *ff);
92 int osip_fifo_insert(osip_fifo_t *ff, void *element);
98 int osip_fifo_add(osip_fifo_t *ff, void *element);
103 int osip_fifo_size(osip_fifo_t *ff);
104 #ifndef OSIP_MONOTHREAD
109 void *osip_fifo_get(osip_fifo_t *ff);
110 #endif
115 void *osip_fifo_tryget(osip_fifo_t *ff);
116 
119 #ifdef __cplusplus
120 }
121 #endif
122 #endif
int osip_fifo_insert(osip_fifo_t *ff, void *element)
Definition: port_fifo.c:53
void osip_fifo_free(osip_fifo_t *ff)
Definition: port_fifo.c:166
void * osip_fifo_tryget(osip_fifo_t *ff)
Definition: port_fifo.c:120
void * osip_fifo_get(osip_fifo_t *ff)
Definition: port_fifo.c:82
int osip_fifo_add(osip_fifo_t *ff, void *element)
Definition: port_fifo.c:38
void osip_fifo_init(osip_fifo_t *ff)
Definition: port_fifo.c:27
int osip_fifo_size(osip_fifo_t *ff)
Definition: port_fifo.c:68
oSIP list Routines
oSIP Thread, Mutex and Semaphore definitions
Definition: osip_fifo.h:62
int nb_elt
Definition: osip_fifo.h:68
osip_list_t queue
Definition: osip_fifo.h:67
osip_fifo_state state
Definition: osip_fifo.h:69
struct osip_mutex * qislocked
Definition: osip_fifo.h:64
struct osip_sem * qisempty
Definition: osip_fifo.h:65
Definition: osip_list.h:87