3 * $Id: url.h,v 1.4 2004/04/08 01:36:13 mdw Exp $
5 * Parsing and construction of url-encoded name/value pairs
7 * (c) 1999 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the mLib utilities library.
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with mLib; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
37 /*----- Header files ------------------------------------------------------*/
43 /*----- Data structures ---------------------------------------------------*/
45 typedef struct url_ectx {
51 typedef struct url_dctx {
55 /*----- Functions provided ------------------------------------------------*/
57 /* --- @url_initenc@ --- *
59 * Arguments: @url_ectx *ctx@ = pointer to context block
63 * Use: Initializes a URL encoding context.
66 extern void url_initenc(url_ectx */*ctx*/);
68 /* --- @url_enc@ --- *
70 * Arguments: @url_ectx *ctx@ = pointer to encoding context
71 * @dstr *d@ = pointer to output string
72 * @const char *name@ = pointer to name
73 * @const char *value@ = pointer to value
77 * Use: Writes an assignment between @name@ and @value@ to the
78 * output string, encoding the values properly.
81 extern void url_enc(url_ectx */*ctx*/, dstr */*d*/,
82 const char */*name*/, const char */*value*/);
84 /* --- @url_initdec@ --- *
86 * Arguments: @url_dctx *ctx@ = pointer to context block
87 * @const char *p@ = string to read data from
91 * Use: Initializes a URL decoding context.
94 extern void url_initdec(url_dctx */*ctx*/, const char */*p*/);
96 /* --- @url_dec@ --- *
98 * Arguments: @url_dctx *ctx@ = pointer to decode context
99 * @dstr *n@ = pointer to output string for name
100 * @dstr *v@ = pointer to output string for value
102 * Returns: Nonzero if it read something, zero if there's nothing left
104 * Use: Decodes the next name/value pair from a urlencoded string.
107 extern int url_dec(url_dctx */*ctx*/, dstr */*n*/, dstr */*v*/);
109 /*----- That's all, folks -------------------------------------------------*/