diff options
author | Jack Lloyd <[email protected]> | 2020-11-05 03:47:06 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2020-11-06 11:31:22 -0500 |
commit | a55e4b22b6cbeeb30ca787d4ea4e3933ccccbdf1 (patch) | |
tree | 3d066440f30d30a46179caded3f1273d06a4dd95 /src/lib/utils/parsing.cpp | |
parent | 7c27982e27b953682554de3c4b22843e0e7461e7 (diff) |
Remove deprecated headers, make more headers internal
Now modules default to internal headers instead of defaulting to public; making
a new public API should be a visible and intentional choice.
Brings the public header count from over 300 to around 150.
Also removes the deprecated tls_blocking interface
Diffstat (limited to 'src/lib/utils/parsing.cpp')
-rw-r--r-- | src/lib/utils/parsing.cpp | 85 |
1 files changed, 3 insertions, 82 deletions
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp index 8004dbdd0..13cb26f24 100644 --- a/src/lib/utils/parsing.cpp +++ b/src/lib/utils/parsing.cpp @@ -7,10 +7,10 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/parsing.h> +#include <botan/internal/parsing.h> #include <botan/exceptn.h> -#include <botan/charset.h> -#include <botan/loadstor.h> +#include <botan/internal/charset.h> +#include <botan/internal/loadstor.h> #include <algorithm> #include <cctype> #include <limits> @@ -59,37 +59,6 @@ uint32_t to_u32bit(const std::string& str) } /* -* Convert a string into a time duration -*/ -uint32_t timespec_to_u32bit(const std::string& timespec) - { - if(timespec.empty()) - return 0; - - const char suffix = timespec[timespec.size()-1]; - std::string value = timespec.substr(0, timespec.size()-1); - - uint32_t scale = 1; - - if(Charset::is_digit(suffix)) - value += suffix; - else if(suffix == 's') - scale = 1; - else if(suffix == 'm') - scale = 60; - else if(suffix == 'h') - scale = 60 * 60; - else if(suffix == 'd') - scale = 24 * 60 * 60; - else if(suffix == 'y') - scale = 365 * 24 * 60 * 60; - else - throw Decoding_Error("timespec_to_u32bit: Bad input " + timespec); - - return scale * to_u32bit(value); - } - -/* * Parse a SCAN-style algorithm name */ std::vector<std::string> parse_algorithm_name(const std::string& namex) @@ -194,19 +163,6 @@ std::string string_join(const std::vector<std::string>& strs, char delim) } /* -* Parse an ASN.1 OID string -*/ -std::vector<uint32_t> parse_asn1_oid(const std::string& oid) - { -#if defined(BOTAN_HAS_ASN1) - return OID(oid).get_components(); -#else - BOTAN_UNUSED(oid); - throw Not_Implemented("ASN1 support not available"); -#endif - } - -/* * X.500 String Comparison */ bool x500_name_cmp(const std::string& name1, const std::string& name2) @@ -289,41 +245,6 @@ std::string ipv4_to_string(uint32_t ip) return str; } -std::string erase_chars(const std::string& str, const std::set<char>& chars) - { - std::string out; - - for(auto c: str) - if(chars.count(c) == 0) - out += c; - - return out; - } - -std::string replace_chars(const std::string& str, - const std::set<char>& chars, - char to_char) - { - std::string out = str; - - for(size_t i = 0; i != out.size(); ++i) - if(chars.count(out[i])) - out[i] = to_char; - - return out; - } - -std::string replace_char(const std::string& str, char from_char, char to_char) - { - std::string out = str; - - for(size_t i = 0; i != out.size(); ++i) - if(out[i] == from_char) - out[i] = to_char; - - return out; - } - namespace { std::string tolower_string(const std::string& in) |