Botan 1.10.17
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
15namespace Botan {
16
17/**
18* Parse a SCAN-style algorithm name
19* @param scan_name the name
20* @return the name components
21*/
22BOTAN_DLL std::vector<std::string>
23parse_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*/
31BOTAN_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*/
39BOTAN_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*/
47BOTAN_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*/
56BOTAN_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*/
63BOTAN_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*/
70BOTAN_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*/
77BOTAN_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*/
84BOTAN_DLL std::string ipv4_to_string(u32bit ip_addr);
85
86}
87
88#endif
std::vector< std::string > parse_algorithm_name(const std::string &namex)
Definition parsing.cpp:96
std::vector< u32bit > parse_asn1_oid(const std::string &oid)
Definition parsing.cpp:180
std::string ipv4_to_string(u32bit ip)
Definition parsing.cpp:279
u32bit string_to_ipv4(const std::string &str)
Definition parsing.cpp:254
unsigned long long u64bit
Definition types.h:49
std::string to_string(u64bit n, size_t min_len)
Definition parsing.cpp:42
u32bit to_u32bit(const std::string &number)
Definition parsing.cpp:18
bool x500_name_cmp(const std::string &name1, const std::string &name2)
Definition parsing.cpp:213
unsigned int u32bit
Definition types.h:32
u32bit timespec_to_u32bit(const std::string &timespec)
Definition parsing.cpp:65
std::vector< std::string > split_on(const std::string &str, char delim)
Definition parsing.cpp:152