michael@0: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #if !defined(__formdata_H__) michael@0: #define __formdata_H__ michael@0: michael@0: /* michael@0: ** formdata.h michael@0: ** michael@0: ** Play (quick and dirty) utility API to parse up form get data into michael@0: ** name value pairs. michael@0: */ michael@0: michael@0: typedef struct __struct_FormData michael@0: /* michael@0: ** Structure to hold the breakdown of any form data. michael@0: ** michael@0: ** mNArray Each form datum is a name value pair. michael@0: ** This array holds the names. michael@0: ** You can find the corresponding value at the same index in michael@0: ** mVArray. michael@0: ** Never NULL, but perhpas an empty string. michael@0: ** mVArray Each form datum is a name value pair. michael@0: ** This array holds the values. michael@0: ** You can find the corresponding name at the same index in michael@0: ** mNArray. michael@0: ** Never NULL, but perhpas an empty string. michael@0: ** mNVCount Count of array items in both mNArray and mVArray. michael@0: ** mStorage Should be ignored by users of this API. michael@0: ** In reality holds the duped and decoded form data. michael@0: */ michael@0: { michael@0: char** mNArray; michael@0: char** mVArray; michael@0: unsigned mNVCount; michael@0: char* mStorage; michael@0: } michael@0: FormData; michael@0: michael@0: FormData* FormData_Create(const char* inFormData) michael@0: /* michael@0: ** Take a contiguous string of form data, possibly hex encoded, and return michael@0: ** the name value pairs parsed up and decoded. michael@0: ** A caller of this routine should call FormData_Destroy at some point. michael@0: ** michael@0: ** inFormData The form data to parse up and decode. michael@0: ** returns FormData* The result of our effort. michael@0: ** This should be passed to FormData_Destroy at some michael@0: ** point of the memory will be leaked. michael@0: */ michael@0: ; michael@0: michael@0: void FormData_Destroy(FormData* inDestroy) michael@0: /* michael@0: ** Release to the heap the structure previously created via FormData_Create. michael@0: ** michael@0: ** inDestroy The object to free off. michael@0: */ michael@0: ; michael@0: michael@0: #endif /* __formdata_H__ */