Botan: src/utils/parsing.h Source File

Botan 1.10.12

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

parsing.h
Go to the documentation of this file.
1 /*
2 * Parser Functions
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_PARSER_H__
9 #define BOTAN_PARSER_H__
10
11 #include <botan/types.h>
12 #include <string>
13 #include <vector>
14
15 namespace Botan {
16
17 /**
18 * Parse a SCAN-style algorithm name
19 * @param scan_name the name
20 * @return the name components
21 */
22 BOTAN_DLL std::vector<std::string>
23 parse_algorithm_name(const std::string& scan_name);
24
25 /**
26 * Split a string
27 * @param str the input string
28 * @param delim the delimitor
29 * @return string split by delim
30 */
31 BOTAN_DLL std::vector<std::string> split_on(
32 const std::string& str, char delim);
33
34 /**
35 * Parse an ASN.1 OID
36 * @param oid the OID in string form
37 * @return OID components
38 */
39 BOTAN_DLL std::vector<u32bit> parse_asn1_oid(const std::string& oid);
40
41 /**
42 * Compare two names using the X.509 comparison algorithm
43 * @param name1 the first name
44 * @param name2 the second name
45 * @return true if name1 is the same as name2 by the X.509 comparison rules
46 */
47 BOTAN_DLL bool x500_name_cmp(const std::string& name1,
48 const std::string& name2);
49
50 /**
51 * Convert a number to a string
52 * @param n the integer to convert to a string
53 * @param min_len the min length of the output string
54 * @return n convert to a string
55 */
56 BOTAN_DLL std::string to_string(u64bit n, size_t min_len = 0);
57
58 /**
59 * Convert a string to a number
60 * @param str the string to convert
61 * @return number value of the string
62 */
63 BOTAN_DLL u32bit to_u32bit(const std::string& str);
64
65 /**
66 * Convert a time specification to a number
67 * @param timespec the time specification
68 * @return number of seconds represented by timespec
69 */
70 BOTAN_DLL u32bit timespec_to_u32bit(const std::string& timespec);
71
72 /**
73 * Convert a string representation of an IPv4 address to a number
74 * @param ip_str the string representation
75 * @return integer IPv4 address
76 */
77 BOTAN_DLL u32bit string_to_ipv4(const std::string& ip_str);
78
79 /**
80 * Convert an IPv4 address to a string
81 * @param ip_addr the IPv4 address to convert
82 * @return string representation of the IPv4 address
83 */
84 BOTAN_DLL std::string ipv4_to_string(u32bit ip_addr);
85
86 }
87
88 #endif
Botan::parse_algorithm_name
std::vector< std::string > parse_algorithm_name(const std::string &namex)
Definition: parsing.cpp:96
Botan::x500_name_cmp
bool x500_name_cmp(const std::string &name1, const std::string &name2)
Definition: parsing.cpp:213
Botan::ipv4_to_string
std::string ipv4_to_string(u32bit ip)
Definition: parsing.cpp:277
Botan::split_on
std::vector< std::string > split_on(const std::string &str, char delim)
Definition: parsing.cpp:152
Botan::u64bit
unsigned long long u64bit
Definition: types.h:49
Botan
Definition: algo_base.h:14
Botan::timespec_to_u32bit
u32bit timespec_to_u32bit(const std::string &timespec)
Definition: parsing.cpp:65
Botan::to_string
std::string to_string(u64bit n, size_t min_len)
Definition: parsing.cpp:42
Botan::to_u32bit
u32bit to_u32bit(const std::string &number)
Definition: parsing.cpp:18
Botan::u32bit
unsigned int u32bit
Definition: types.h:32
oid
OID oid
Definition: x509_ext.cpp:446
Botan::parse_asn1_oid
std::vector< u32bit > parse_asn1_oid(const std::string &oid)
Definition: parsing.cpp:180
Botan::string_to_ipv4
u32bit string_to_ipv4(const std::string &str)
Definition: parsing.cpp:252