Commit Graph

65 Commits

Author SHA1 Message Date
Andrew Bettison
43e76ec7b5 Change signature of strn_fromprint()
The 'dst' parameter is now (char *) instead of (unsigned char *) because
in general it is used to produce human-readable (ASCII) strings, not
binary data.
2016-10-13 16:23:18 +10:30
Andrew Bettison
41b3e304be Updated some copyright messages and COPYRIGHT.txt 2016-10-13 16:23:18 +10:30
Andrew Bettison
5a77008aa8 Move URI primitives from "str.h" to "uri.h" 2016-09-21 18:47:49 +09:30
Andrew Bettison
5b3d997896 Move Base64 conversions from "str.h" to "base64.h" 2016-09-21 18:47:49 +09:30
Andrew Bettison
cd766cd480 Move numeric conversions from "str.h" to "numeric_str.h" 2016-09-21 18:47:49 +09:30
Jeremy Lakeman
dc7226b6a5 Remove file hash command 2016-08-16 12:22:13 +09:30
Andrew Bettison
3ab7e04497 Add buf_strncpy_nul(), use in place of strlcpy() 2015-11-02 10:11:41 +10:30
Andrew Bettison
367d54f5f8 Add functions to parse uint16_t 2015-10-01 07:05:17 +09:30
Andrew Bettison
f73cd77185 Change arg of ctype functions from char to int
Consistent with functions defined in <ctype>; now all can be used
as a predicate function with the type int (*)(int).
2015-10-01 07:05:17 +09:30
Andrew Bettison
487fe462b2 Add "extern" to some array decls in str.h 2015-09-21 12:30:36 +09:30
Andrew Bettison
0a40d9849c Add uri and www-form-uri encode/decode functions 2015-08-17 19:46:50 +09:30
Andrew Bettison
e73d50b48a Refactor "str.h": rename parameters 'dstlen' to 'dstsiz' 2015-08-17 19:43:58 +09:30
Andrew Bettison
7f564e4dcf Make strn_to_xxx() functions consistent
All strn_to_xxx() functions should take a 'size_t len' parameter

All functions that take a 'const char **endp' parameter should
be named parse_xxx(), and should also have a 'ssize_t len' parameter
which can be -1 to indicate a null-terminated string
2015-03-28 04:53:09 +10:30
Andrew Bettison
72345a3b2f Add alloca_sprintf() macro 2015-03-16 22:33:42 +10:30
Andrew Bettison
bc197ef01d Add alloca_strndup() and strncpy_nul() 2014-11-19 10:47:31 +10:30
Andrew Bettison
c1d8383226 Add strn_digest_passphrase()
Uses SHA512 internally
2014-11-14 13:11:44 +10:30
Andrew Bettison
0a8f6b2bb1 Cosmetic improvements to "str.h" 2014-11-13 09:59:51 +10:30
Andrew Bettison
7736a4ceb1 New HTTP RESTful requests: MeshMS read message(s) 2014-06-24 12:11:58 +09:30
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