summaryrefslogtreecommitdiff
path: root/scan_urlencoded_query.h
diff options
context:
space:
mode:
authorerdgeist <>2009-01-05 18:05:39 +0000
committererdgeist <>2009-01-05 18:05:39 +0000
commit779d6c235ff8fe5284fd10dc82a9b99e7fa38d06 (patch)
tree043369d2a98a45b902e5d0968e28d78c1771b143 /scan_urlencoded_query.h
parent8bdc0d73f6f0bcaf83b7fb3d39e79e8fa4e6050d (diff)
* http and udp routines now use thread local buffers passed in workstruct containers. In other words they do not use static_buffer anymore and are considered to be thread safe.
* the new workstruct also introduces a well defined buffer and result passing path * a new function scan_find_keywords is a wrapper around scan_urlencoded_query that maps keys in url to values passed in an array of ot_keywords structs * this new function cleans up much of url parameter parsing work, where read_ptr and write_ptr have been introduced rather than the confusing char *c, *data variables * I now use memcmp instead of byte_diff to allow compiler to optimize constant size string compares * got rid of UTORRENT_1600_WORKAROUND * livesync_ticker is now only called from one (currently main) thread to avoid race conditions
Diffstat (limited to 'scan_urlencoded_query.h')
-rw-r--r--scan_urlencoded_query.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/scan_urlencoded_query.h b/scan_urlencoded_query.h
index 7ff6e42..a0b77af 100644
--- a/scan_urlencoded_query.h
+++ b/scan_urlencoded_query.h
@@ -8,6 +8,11 @@
8 8
9#include <sys/types.h> 9#include <sys/types.h>
10 10
11typedef struct {
12 char *key;
13 int value;
14} ot_keywords;
15
11typedef enum { 16typedef enum {
12 SCAN_PATH = 1, 17 SCAN_PATH = 1,
13 SCAN_SEARCHPATH_PARAM = 2, 18 SCAN_SEARCHPATH_PARAM = 2,
@@ -21,9 +26,20 @@ typedef enum {
21 flags determines, what to parse 26 flags determines, what to parse
22 returns number of valid converted characters in deststring 27 returns number of valid converted characters in deststring
23 or -1 for parse error 28 or -1 for parse error
29 or -2 for terminator found
24*/ 30*/
25ssize_t scan_urlencoded_query(char **string, char *deststring, SCAN_SEARCHPATH_FLAG flags); 31ssize_t scan_urlencoded_query(char **string, char *deststring, SCAN_SEARCHPATH_FLAG flags);
26 32
33/* string in: pointer to source
34 out: pointer to next scan position
35 flags determines, what to parse
36 returns value for matched keyword
37 or -1 for parse error
38 or -2 for terminator found
39 or -3 for no keyword matched
40 */
41int scan_find_keywords( const ot_keywords * keywords, char **string, SCAN_SEARCHPATH_FLAG flags);
42
27/* string in: pointer to value of a param=value pair to skip 43/* string in: pointer to value of a param=value pair to skip
28 out: pointer to next scan position on return 44 out: pointer to next scan position on return
29*/ 45*/