SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2015 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 {
57  void *element;
58  };
59 #endif
60 
65  typedef struct osip_list osip_list_t;
66 
71  typedef struct {
75  int pos;
77 
82  struct osip_list {
83 
84  int nb_elt;
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 
160  void *osip_list_get_first (const osip_list_t * li, osip_list_iterator_t * it);
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif
Structure for referencing a list of elements.
Definition: osip_list.h:82
__node_t * node
Next node containing element.
Definition: osip_list.h:85
Structure for referencing a node in a osip_list_t element.
Definition: osip_list.h:55
int nb_elt
Number of element in the list.
Definition: osip_list.h:84
void * osip_list_get(const osip_list_t *li, int pos)
Get an element from a list.
void osip_list_special_free(osip_list_t *li, void(*free_func)(void *))
Free a list of element.
int osip_list_clone(const osip_list_t *src, osip_list_t *dst, int(*clone_func)(void *, void **))
Clone a list of element.
osip_list_t * li
li
Definition: osip_list.h:74
void * osip_list_get_first(const osip_list_t *li, osip_list_iterator_t *it)
Get first iterator from list.
int osip_list_remove(osip_list_t *li, int pos)
Remove an element from a list.
__node_t * actual
actual
Definition: osip_list.h:72
__node_t ** prev
prev
Definition: osip_list.h:73
int osip_list_size(const osip_list_t *li)
Get the size of a list of element.
int osip_list_eol(const osip_list_t *li, int pos)
Check if the end of list is detected .
__node_t * next
next __node_t containing element
Definition: osip_list.h:56
void * element
element in Current node
Definition: osip_list.h:57
void osip_list_ofchar_free(osip_list_t *li)
Free a list of element where elements are pointer to 'char'.
void * osip_list_get_next(osip_list_iterator_t *it)
GEt next iterator.
int osip_list_init(osip_list_t *li)
Initialise a osip_list_t element.
int osip_list_add(osip_list_t *li, void *element, int pos)
Add an element in a list.
void * osip_list_iterator_remove(osip_list_iterator_t *it)
Remove current iterator.