Commit Graph

47 Commits

Author SHA1 Message Date
Andrew Bettison
c17fb19bd4 Add strn_to_uint32()
Use to implement str_to_unit32()
2014-04-29 12:28:20 +09:30
Andrew Bettison
ad8d02827b Change all str_to_int 'base' args from int to unsigned 2014-04-29 12:18:45 +09:30
Andrew Bettison
34188fa489 Replace config 'rhizome.external_blobs' with 'rhizome.max_blob_size' 2013-12-30 16:30:43 +10:30
Andrew Bettison
0c88f8bf89 Replace str_to_uint() with str_to_uint32()
Also str_to_int() with str_to_int32()
2013-12-30 16:30:43 +10:30
Andrew Bettison
4af6cf9d6a Fix -Wsign-compare warnings: use size_t or unsigned for byte counts 2013-12-10 16:52:53 +10:30
Andrew Bettison
48ef87a68b Fix -Wsign-compare warning in alloca_toprint_quoted() 2013-12-09 16:33:44 +10:30
Andrew Bettison
5226e47ef6 Uniform #ifdef __SERVAL_DNA__... for headers 2013-12-04 17:15:36 +10:30
Andrew Bettison
27052384ed Add Base64URL encode/decode functions 2013-11-18 16:22:55 +10:30
Andrew Bettison
e59a62115b Add base64_encodev() multi-buffer Base64 encoder
Also replace base64_encode_len() inline function with macro
BASE64_ENCODED_LEN()
2013-11-18 11:39:23 +10:30
Andrew Bettison
b8e0859880 Fix off-by-one buffer size errors when using tohex() 2013-11-15 17:10:33 +10:30
Andrew Bettison
f2b652c094 Refactor Base64 decoding from HTTP server to str.c
Also add a Base64 encoding function, not tested yet
2013-11-15 17:09:55 +10:30
Andrew Bettison
4fd94783d3 Refactor URI character class functions
To use array lookup instead of boolean OR expressions
2013-11-15 11:19:51 +10:30
Andrew Bettison
9418f9d65d Refactor HTTP string utils into str.[hc]
Improve "str.h" layout and commenting.  Re-implement hexvalue().
2013-11-14 23:13:37 +10:30
Andrew Bettison
973bb9c897 Merge branch 'naf4' into 'development' 2013-11-13 17:59:01 +10:30
Andrew Bettison
1634d68dd0 Format UUID strings as lower case hex 2013-11-13 12:45:02 +10:30
Jeremy Lakeman
9680b24f23 Add support for adding and updating tags in the keyring 2013-11-13 11:59:21 +10:30
Andrew Bettison
4de6c77d45 Add alloca_strdup() macro 2013-10-25 00:20:53 +10:30
Andrew Bettison
1a413b72db Add str_tolower_inplace() function 2013-10-25 00:20:53 +10:30
Andrew Bettison
95e45f452e Improve str_to_int() et al
Always set *afterp to point to the first invalid character
even if conversion fails
2013-10-25 00:20:53 +10:30
Andrew Bettison
05d4215752 Add 'strlen' argument to strn_fromprint() 2013-10-25 00:19:58 +10:30
Andrew Bettison
00cf61721d Rename http_header_complete() to is_http_header_complete() 2013-10-16 11:22:02 +10:30
Andrew Bettison
609e47faba Add str_to_int() and str_to_uint() 2013-10-16 11:16:04 +10:30
Andrew Bettison
a95ef79139 Use sid_t everywhere
Remove stowSid() at last

Change API of tohex() and strbuf_tohex(), to pass string length instead of
binary byte count.  This allows odd numbers of hex digits to be produced.

Remove alloca_tohex_sid(); replace with alloca_tohex_sid_t()

New alloca_tohex_sid_t_trunc() macro
2013-10-09 18:54:21 +10:30
Andrew Bettison
1c96164b62 Issue #11: uint16_t instead of unsigned short for URI port number 2013-10-08 09:56:54 +10:30
Andrew Bettison
ffafae86b1 Issue #11: replace long long with int64_t 2013-10-07 05:54:46 +10:30
Andrew Bettison
34bbfb9b30 Add strn_fromhex(), improve hexvalue()
Implement fromhex() and fromhexstr() using strn_fromhex()
2013-09-03 17:29:41 +09:30
Andrew Bettison
080ccd957a Replace str_fromprint() with strn_fromprint() 2013-09-02 17:31:13 +09:30
Andrew Bettison
ba57855160 Add alloca_str_toprint_quoted() macro to str.h 2013-04-30 17:27:10 +09:30
Andrew Bettison
121ae2d609 Improve timeout control in routing tests 2013-04-22 16:01:38 +09:30
Andrew Bettison
2077265b2d Add str_index(), str_rindex(), et al 2013-04-04 17:42:33 +10:30
Andrew Bettison
133c34325f Fix wrong declaration of strnchr() 2013-02-27 18:10:39 +10:30
Andrew Bettison
14b859616e Add strnchr() to str.c 2013-02-27 15:58:32 +10:30
Andrew Bettison
aeeef0e972 Add uint64_scaled_to_str() function in str.c 2013-02-26 12:59:40 +10:30
Andrew Bettison
5013424ab1 New "str.h" functions: strn_str_cmp(), strn_str_casecmp() 2013-02-13 15:52:44 +10:30
Andrew Bettison
8425882ffc Merge branch 'newconfig' into 'master'
Conflicts:
	commandline.c
	conf.h
	dataformats.c
	log.h
	overlay_address.c
	overlay_interface.c
	packetformats.c
	rhizome.c
	serval.h
	tests/directory_service
	vomp_console.c
2012-12-07 14:09:55 +10:30
Andrew Bettison
c4b90a108b Fix compile warnings on Solaris (gcc 4.4) 2012-11-28 14:13:25 +10:30
Andrew Bettison
494a766b9e Improve str.h and str.c
Move alloca_tohex() from serval.h into str.h so it can be used stand-alone.

Rename str_to_ll_scaled() to str_to_int64_scaled().  Add str_to_uint64_scaled()
and scale_factor().

Add a few more URI parsing functions.  Move some functions out of str.c and
into str.h as inline functions.
2012-11-22 18:15:40 +10:30
Andrew Bettison
960a6293e1 Move str_is_uri() from dataformats.c to str.c
Add lots of URI unpacking functions as well.
2012-11-21 18:08:06 +10:30
Andrew Bettison
c84b7e5db4 Improve str.h functions
Add strn_startswith() and strncase_startswith().

Make all str*_startswith() functions take const char * arguments, to make it
possible to do safe programming with consts.
2012-11-20 18:10:08 +10:30
Andrew Bettison
0e435683f7 Move toprint functions from log.h to str.h
Move alloca_sockaddr() to strbuf_helpers.h

So that stand-alone executables can use them without pulling in the entire
logging framework.
2012-11-20 18:10:08 +10:30
Andrew Bettison
4450116472 Refactor string functions, add str_fromprint()
Move lots of non-Serval-specific string functions from "serval.h"/dataformats.c
to "str.h"/str.c.

Add str_fromprint() function that reverses the effect of toprint(): interprets
escape sequences in the source string "\n\t\r\0\xHH\\" and replaces them with a
single char in the destination string.
2012-11-07 16:42:45 +10:30
Andrew Bettison
d38ce66c95 Improve test framework: create_file()
New executable in Makefile 'all' target: tfw_createfile.

New str.h function: str_to_ll_scaled().
2012-10-31 18:13:33 +10:30
Andrew Bettison
89343c69cd Merge branch 'rhizomedirect' into 'master' 2012-10-05 17:45:30 +09:30
Andrew Bettison
245c7e7f49 Change str_str() to return (char*) not (const char*)
Also rewrite implementation to handle edge cases, rename arguments to be more
self documenting.
2012-10-03 17:13:45 +09:30
Jeremy Lakeman
fa7719fbe8 Write simple vomp console client 2012-09-28 15:23:50 +09:30
gardners
fb82043246 added str_str() to help parse http POST requests for rhizome direct. #9 2012-08-31 13:01:29 +09:30
Jeremy Lakeman
7705676a9e Move str functions to c file to enable reuse 2012-08-09 13:30:52 +09:30