summaryrefslogtreecommitdiff
path: root/scan_urlencoded_query.h
diff options
context:
space:
mode:
Diffstat (limited to 'scan_urlencoded_query.h')
-rw-r--r--scan_urlencoded_query.h63
1 files changed, 0 insertions, 63 deletions
diff --git a/scan_urlencoded_query.h b/scan_urlencoded_query.h
deleted file mode 100644
index 6f12c03..0000000
--- a/scan_urlencoded_query.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever.
3
4 $id$ */
5
6#ifndef SCAN_URLENCODED_QUERY_H__
7#define SCAN_URLENCODED_QUERY_H__
8
9#include <stddef.h>
10#include <stdint.h>
11#include <sys/types.h>
12
13typedef struct {
14 char *key;
15 int value;
16} ot_keywords;
17
18typedef enum {
19 SCAN_PATH = 1,
20 SCAN_SEARCHPATH_PARAM = 2,
21 SCAN_SEARCHPATH_VALUE = 4,
22 SCAN_SEARCHPATH_TERMINATOR = 8
23} SCAN_SEARCHPATH_FLAG;
24
25/* string in: pointer to source
26 out: pointer to next scan position
27 deststring pointer to destination
28 flags determines, what to parse
29 returns number of valid converted characters in deststring
30 or -1 for parse error
31 or -2 for terminator found
32*/
33ssize_t scan_urlencoded_query(char **string, char *deststring, SCAN_SEARCHPATH_FLAG flags);
34
35/* string in: pointer to source
36 out: pointer to next scan position
37 flags determines, what to parse
38 returns value for matched keyword
39 or -1 for parse error
40 or -2 for terminator found
41 or -3 for no keyword matched
42 */
43int scan_find_keywords(const ot_keywords *keywords, char **string, SCAN_SEARCHPATH_FLAG flags);
44
45/* string in: pointer to value of a param=value pair to skip
46 out: pointer to next scan position on return
47*/
48void scan_urlencoded_skipvalue(char **string);
49
50/* data pointer to len chars of string
51 len length of chars in data to parse
52 number number to receive result
53 returns number of bytes not parsed, mostly !=0 means fail
54 */
55ssize_t scan_fixed_int(char *data, size_t len, int *number);
56
57/* The other direction: percent encode len bytes from src into dest and return
58 how many characters were written, or how many would be needed when dest is
59 NULL. dest needs room for three times len.
60 */
61size_t fmt_urlencoded(char *dest, const uint8_t *src, size_t len);
62
63#endif