1 /* This file is part of GNU Radius 2 Copyright (C) 2003,2004,2007,2008 Free Software Foundation, Inc. 3 4 Written by Sergey Poznyakoff 5 6 GNU Radius is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3 of the License, or 9 (at your option) any later version. 10 11 GNU Radius is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Radius; if not, write to the Free Software 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 19 20 #ifndef _gnu_radius_list_h 21 #define _gnu_radius_list_h 22 23 typedef struct grad_list grad_list_t; 24 typedef struct grad_iterator grad_iterator_t; 25 26 typedef int (*list_iterator_t)(void *item, void *data); 27 typedef int (*list_comp_t)(const void *, const void *); 28 29 grad_list_t *grad_list_create(); 30 void grad_list_destroy(grad_list_t **list, list_iterator_t free, void *data); 31 void grad_list_iterate(grad_list_t *list, list_iterator_t itr, void *data); 32 void *grad_list_item(grad_list_t *list, size_t n); 33 size_t grad_list_count(grad_list_t *list); 34 void grad_list_append(grad_list_t *list, void *data); 35 void grad_list_prepend(grad_list_t *list, void *data); 36 int grad_list_insert_sorted(grad_list_t *list, void *data, list_comp_t cmp); 37 void *grad_list_locate(grad_list_t *list, void *data, list_comp_t cmp); 38 void *grad_list_remove(grad_list_t *list, void *data, list_comp_t cmp); 39 40 void *grad_iterator_current(grad_iterator_t *ip); 41 grad_iterator_t *grad_iterator_create(grad_list_t *list); 42 void grad_iterator_destroy(grad_iterator_t **ip); 43 void *grad_iterator_first(grad_iterator_t *ip); 44 void *grad_iterator_next(grad_iterator_t *ip); 45 46 47 #endif 48 49