libosip  5.3.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-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 _LIST_H_
21 #define _LIST_H_
22 
23 #ifdef ENABLE_MPATROL
24 #include <mpatrol.h>
25 #endif
26 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #ifndef DOXYGEN
48 typedef struct __node __node_t;
49 
54 struct __node {
55  __node_t *next;
56  void *element;
57 };
58 #endif
59 
64 typedef struct osip_list osip_list_t;
65 
71 
77  __node_t *actual;
78  __node_t **prev;
80  int pos;
81 };
82 
87 struct osip_list {
88  int nb_elt;
89  __node_t *node;
90 };
91 
101 int osip_list_init(osip_list_t *li);
108 void osip_list_special_free(osip_list_t *li, void (*free_func)(void *));
116 int osip_list_clone(const osip_list_t *src, osip_list_t *dst, int (*clone_func)(void *, void **));
126 int osip_list_size(const osip_list_t *li);
132 int osip_list_eol(const osip_list_t *li, int pos);
139 int osip_list_add(osip_list_t *li, void *element, int pos);
145 void *osip_list_get(const osip_list_t *li, int pos);
151 int osip_list_remove(osip_list_t *li, int pos);
152 
157 #define osip_list_iterator_has_elem(it) (0 != (it).actual && (it).pos < (it).li->nb_elt)
174 
175 #ifdef __cplusplus
176 }
177 #endif
179 #endif
void osip_list_ofchar_free(osip_list_t *li)
Definition: osip_list.c:66
void * osip_list_get_first(const osip_list_t *li, osip_list_iterator_t *it)
Definition: osip_list.c:200
int osip_list_clone(const osip_list_t *src, osip_list_t *dst, int(*clone_func)(void *, void **))
Definition: osip_list.c:33
int osip_list_eol(const osip_list_t *li, int pos)
Definition: osip_list.c:86
void osip_list_special_free(osip_list_t *li, void(*free_func)(void *))
Definition: osip_list.c:51
int osip_list_remove(osip_list_t *li, int pos)
Definition: osip_list.c:251
void * osip_list_get_next(osip_list_iterator_t *it)
Definition: osip_list.c:215
int osip_list_add(osip_list_t *li, void *element, int pos)
Definition: osip_list.c:97
int osip_list_init(osip_list_t *li)
Definition: osip_list.c:25
void * osip_list_get(const osip_list_t *li, int pos)
Definition: osip_list.c:178
int osip_list_size(const osip_list_t *li)
Definition: osip_list.c:79
void * osip_list_iterator_remove(osip_list_iterator_t *it)
Definition: osip_list.c:233
Definition: osip_list.h:76
__node_t * actual
Definition: osip_list.h:77
osip_list_t * li
Definition: osip_list.h:79
int pos
Definition: osip_list.h:80
__node_t ** prev
Definition: osip_list.h:78
Definition: osip_list.h:87
int nb_elt
Definition: osip_list.h:88
__node_t * node
Definition: osip_list.h:89