HTP  0.5
htp_list.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2009-2010 Open Information Security Foundation
3  * Copyright (c) 2010-2013 Qualys, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * - Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12 
13  * - Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16 
17  * - Neither the name of the Qualys, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  ***************************************************************************/
33 
39 #ifndef HTP_LIST_H
40 #define HTP_LIST_H
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 // The default list implementation is array-based. The
47 // linked list version is not fully implemented yet.
48 #define htp_list_t htp_list_array_t
49 #define htp_list_add htp_list_array_push
50 #define htp_list_create htp_list_array_create
51 #define htp_list_clear htp_list_array_clear
52 #define htp_list_destroy htp_list_array_destroy
53 #define htp_list_get htp_list_array_get
54 #define htp_list_pop htp_list_array_pop
55 #define htp_list_push htp_list_array_push
56 #define htp_list_replace htp_list_array_replace
57 #define htp_list_size htp_list_array_size
58 #define htp_list_shift htp_list_array_shift
59 
60 // Data structures
61 
64 
65 #include "htp_core.h"
66 #include "bstr.h"
67 
68 // Functions
69 
77 
86 
94 
103 void *htp_list_array_get(const htp_list_array_t *l, size_t idx);
104 
112 
122 
133 htp_status_t htp_list_array_replace(htp_list_array_t *l, size_t idx, void *e);
134 
141 size_t htp_list_array_size(const htp_list_array_t *l);
142 
150 
151 
152 // Linked list
153 
160 
168 
176 
184 
193 
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif /* HTP_LIST_H */
207 
htp_status_t htp_list_array_push(htp_list_array_t *l, void *e)
Definition: htp_list.c:116
int htp_list_linked_empty(const htp_list_linked_t *l)
htp_list_linked_t * htp_list_linked_create(void)
void htp_list_linked_destroy(htp_list_linked_t *l)
Definition: htp_list_private.h:63
void * htp_list_array_get(const htp_list_array_t *l, size_t idx)
Definition: htp_list.c:85
void htp_list_array_destroy(htp_list_array_t *l)
Definition: htp_list.c:78
void htp_list_array_clear(htp_list_array_t *l)
Definition: htp_list.c:69
void * htp_list_array_shift(htp_list_array_t *l)
Definition: htp_list.c:194
void * htp_list_linked_shift(htp_list_linked_t *l)
int htp_status_t
Definition: htp_core.h:46
htp_list_t * htp_list_array_create(size_t size)
Definition: htp_list.c:45
Definition: htp_list_private.h:50
size_t htp_list_array_size(const htp_list_array_t *l)
Definition: htp_list.c:188
htp_status_t htp_list_linked_push(htp_list_linked_t *l, void *e)
void * htp_list_linked_pop(htp_list_linked_t *l)
htp_status_t htp_list_array_replace(htp_list_array_t *l, size_t idx, void *e)
Definition: htp_list.c:170
void * htp_list_array_pop(htp_list_array_t *l)
Definition: htp_list.c:96