blob: 6b644b99c85a2ca70d8f31faa2d1fe5635341ed8 [file] [log] [blame]
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001#ifndef HEADER_CURL_LLIST_H
2#define HEADER_CURL_LLIST_H
Kristian Monsen5ab50182010-05-14 18:53:44 +01003/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
Elliott Hughes82be86d2017-09-20 17:00:17 -070010 * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
Kristian Monsen5ab50182010-05-14 18:53:44 +010011 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
Alex Deymo8f1a2142016-06-28 14:49:26 -070014 * are also available at https://curl.haxx.se/docs/copyright.html.
Kristian Monsen5ab50182010-05-14 18:53:44 +010015 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ***************************************************************************/
24
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070025#include "curl_setup.h"
Kristian Monsen5ab50182010-05-14 18:53:44 +010026#include <stddef.h>
27
28typedef void (*curl_llist_dtor)(void *, void *);
29
30struct curl_llist_element {
31 void *ptr;
Kristian Monsen5ab50182010-05-14 18:53:44 +010032 struct curl_llist_element *prev;
33 struct curl_llist_element *next;
34};
35
36struct curl_llist {
37 struct curl_llist_element *head;
38 struct curl_llist_element *tail;
Kristian Monsen5ab50182010-05-14 18:53:44 +010039 curl_llist_dtor dtor;
Kristian Monsen5ab50182010-05-14 18:53:44 +010040 size_t size;
41};
42
Elliott Hughes82be86d2017-09-20 17:00:17 -070043void Curl_llist_init(struct curl_llist *, curl_llist_dtor);
44void Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *,
45 const void *, struct curl_llist_element *node);
46void Curl_llist_remove(struct curl_llist *, struct curl_llist_element *,
47 void *);
Kristian Monsen5ab50182010-05-14 18:53:44 +010048size_t Curl_llist_count(struct curl_llist *);
49void Curl_llist_destroy(struct curl_llist *, void *);
Elliott Hughes82be86d2017-09-20 17:00:17 -070050void Curl_llist_move(struct curl_llist *, struct curl_llist_element *,
51 struct curl_llist *, struct curl_llist_element *);
Kristian Monsen5ab50182010-05-14 18:53:44 +010052
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070053#endif /* HEADER_CURL_LLIST_H */
54