libosip 3.6.0

osip_list.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 
00021 #ifndef _LIST_H_
00022 #define _LIST_H_
00023 
00024 #ifdef ENABLE_MPATROL
00025 #include <mpatrol.h>
00026 #endif
00027 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00048 #ifndef DOXYGEN
00049 
00053         typedef struct __node __node_t;
00054 
00059         struct __node {
00060                 __node_t *next;                         
00061                 void *element;                  
00062         };
00063 #endif
00064 
00069         typedef struct osip_list osip_list_t;
00070 
00075         typedef struct {
00076                 __node_t *actual;
00077                 __node_t **prev;
00078                 osip_list_t *li;
00079                 int pos;
00080         } osip_list_iterator_t;
00081 
00086         struct osip_list {
00087 
00088                 int nb_elt;             
00089                 __node_t *node; 
00091         };
00092 
00102         int osip_list_init(osip_list_t * li);
00109         void osip_list_special_free(osip_list_t * li, void (*free_func) (void *));
00117         int osip_list_clone(const osip_list_t * src, osip_list_t * dst,
00118                                                 int (*clone_func) (void *, void **));
00123         void osip_list_ofchar_free(osip_list_t * li);
00128         int osip_list_size(const osip_list_t * li);
00134         int osip_list_eol(const osip_list_t * li, int pos);
00141         int osip_list_add(osip_list_t * li, void *element, int pos);
00147         void *osip_list_get(const osip_list_t * li, int pos);
00153         int osip_list_remove(osip_list_t * li, int pos);
00154 
00159 #define osip_list_iterator_has_elem( it ) ( 0 != (it).actual && (it).pos < (it).li->nb_elt )
00160 
00165         void *osip_list_get_first(osip_list_t * li, osip_list_iterator_t * it);
00170         void *osip_list_get_next(osip_list_iterator_t * it);
00175         void *osip_list_iterator_remove(osip_list_iterator_t * it);
00176 
00177 #ifdef __cplusplus
00178 }
00179 #endif
00180 
00181 #endif