From 779d6c235ff8fe5284fd10dc82a9b99e7fa38d06 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Mon, 5 Jan 2009 18:05:39 +0000 Subject: * 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 --- scan_urlencoded_query.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'scan_urlencoded_query.h') 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 @@ #include +typedef struct { + char *key; + int value; +} ot_keywords; + typedef enum { SCAN_PATH = 1, SCAN_SEARCHPATH_PARAM = 2, @@ -21,9 +26,20 @@ typedef enum { flags determines, what to parse returns number of valid converted characters in deststring or -1 for parse error + or -2 for terminator found */ ssize_t scan_urlencoded_query(char **string, char *deststring, SCAN_SEARCHPATH_FLAG flags); +/* string in: pointer to source + out: pointer to next scan position + flags determines, what to parse + returns value for matched keyword + or -1 for parse error + or -2 for terminator found + or -3 for no keyword matched + */ +int scan_find_keywords( const ot_keywords * keywords, char **string, SCAN_SEARCHPATH_FLAG flags); + /* string in: pointer to value of a param=value pair to skip out: pointer to next scan position on return */ -- cgit v1.2.3