From b34502af8247606ae3b5693cd3046566b16a3e6d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 8 Jul 2011 08:38:17 +0000 Subject: Refactor http utilities svn path=/trunk/netsurf/; revision=12595 --- utils/http/parameter.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 utils/http/parameter.h (limited to 'utils/http/parameter.h') diff --git a/utils/http/parameter.h b/utils/http/parameter.h new file mode 100644 index 000000000..2f5d41a54 --- /dev/null +++ b/utils/http/parameter.h @@ -0,0 +1,59 @@ +/* + * Copyright 2010 John-Mark Bell + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NETSURF_UTILS_HTTP_PARAMETER_H_ +#define NETSURF_UTILS_HTTP_PARAMETER_H_ + +#include + +#include "utils/errors.h" + +typedef struct http_parameter http_parameter; + +/** + * Find a named item in an HTTP parameter list + * + * \param list List to search + * \param name Name of item to search for + * \param value Pointer to location to receive value + * \return NSERROR_OK on success, + * NSERROR_NOT_FOUND if requested item does not exist + */ +nserror http_parameter_list_find_item(const http_parameter *list, + lwc_string *name, lwc_string **value); + +/** + * Iterate over a parameter list + * + * \param cur Pointer to current iteration position, list head to start + * \param name Pointer to location to receive item name + * \param value Pointer to location to receive item value + * \return Pointer to next iteration position, or NULL for end of iteration + */ +const http_parameter *http_parameter_list_iterate(const http_parameter *cur, + lwc_string **name, lwc_string **value); + +/** + * Destroy a list of HTTP parameters + * + * \param list List to destroy + */ +void http_parameter_list_destroy(http_parameter *list); + +#endif + -- cgit v1.2.3