osip_fifo.h

Go to the documentation of this file.
00001 /*
00002   The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
00003   Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Aymeric MOIZARD jack@atosc.org
00004   
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009   
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014   
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 #ifndef _FIFO_H_
00021 #define _FIFO_H_
00022 
00023 #ifdef OSIP_MT
00024 #include <osip2/osip_mt.h>
00025 #endif
00026 #include <osipparser2/osip_list.h>
00027 
00042 #ifdef __cplusplus
00043 extern "C"
00044 {
00045 #endif
00046 
00047 
00048 #ifndef DOXYGEN
00049 
00050 #define MAX_LEN 1000
00051   typedef enum
00052   { osip_ok, osip_full, osip_empty }
00053   osip_fifo_state;
00054 
00055 #endif
00056 
00061   typedef struct osip_fifo osip_fifo_t;
00062 
00067   struct osip_fifo
00068   {
00069 #ifdef OSIP_MT
00070     struct osip_mutex *qislocked;  
00071     struct osip_sem *qisempty;     
00072 #endif
00073     osip_list_t queue;             
00074     int nb_elt;                    
00075     osip_fifo_state state;           
00076   };
00077 
00087   void osip_fifo_init (osip_fifo_t * ff);
00092   void osip_fifo_free (osip_fifo_t * ff);
00098   int osip_fifo_insert (osip_fifo_t * ff, void *element);
00104   int osip_fifo_add (osip_fifo_t * ff, void *element);
00109   int osip_fifo_size (osip_fifo_t * ff);
00110 #ifdef OSIP_MT
00111 
00115   void *osip_fifo_get (osip_fifo_t * ff);
00116 #endif
00117 
00121   void *osip_fifo_tryget (osip_fifo_t * ff);
00122 
00123 
00127 #ifdef __cplusplus
00128 }
00129 #endif
00130 
00131 
00132 #endif

Generated on Wed Feb 13 01:03:29 2008 for libosip by  doxygen 1.5.4