--- libaitwww/src/aitwww.c 2012/03/09 10:03:21 1.1.1.1.2.2 +++ libaitwww/src/aitwww.c 2012/03/09 12:33:41 1.1.1.1.2.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitwww.c,v 1.1.1.1.2.2 2012/03/09 10:03:21 misho Exp $ +* $Id: aitwww.c,v 1.1.1.1.2.3 2012/03/09 12:33:41 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -345,6 +345,35 @@ www_delPair(cgi_t * __restrict cgi, const char *name) } return 0; +} + +/* + * www_listPairs() - Walk over CGI session variables + * + * @cgi = Cgi session + * @func = If !=NULL call function for each element + * @arg = Optional argument pass through callback + * return: -1 error or >-1 number of elements + */ +inline int +www_listPairs(cgi_t * __restrict cgi, list_cb_t func, void *arg) +{ + register int ret = 0; + struct tagCGI *t; + + if (!cgi) { + www_SetErr(EINVAL, "Invalid CGI session argument"); + return -1; + } + + SLIST_FOREACH(t, cgi, cgi_node) { + ret++; + + if (func) + func(t, arg); + } + + return ret; } /*