libosip  4.1.0
osip_list.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 
21 #ifndef _LIST_H_
22 #define _LIST_H_
23 
24 #ifdef ENABLE_MPATROL
25 #include <mpatrol.h>
26 #endif
27 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #ifndef DOXYGEN
45 
49  typedef struct __node __node_t;
50 
55  struct __node {
56  __node_t *next;
57  void *element;
58  };
59 #endif
60 
65  typedef struct osip_list osip_list_t;
66 
71  typedef struct {
72  __node_t *actual;
73  __node_t **prev;
75  int pos;
77 
82  struct osip_list {
83 
84  int nb_elt;
85  __node_t *node;
87  };
88 
98  int osip_list_init (osip_list_t * li);
105  void osip_list_special_free (osip_list_t * li, void (*free_func) (void *));
113  int osip_list_clone (const osip_list_t * src, osip_list_t * dst, int (*clone_func) (void *, void **));
123  int osip_list_size (const osip_list_t * li);
129  int osip_list_eol (const osip_list_t * li, int pos);
136  int osip_list_add (osip_list_t * li, void *element, int pos);
142  void *osip_list_get (const osip_list_t * li, int pos);
148  int osip_list_remove (osip_list_t * li, int pos);
149 
154 #define osip_list_iterator_has_elem( it ) ( 0 != (it).actual && (it).pos < (it).li->nb_elt )
155 
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif