Botan 2.19.5 Crypto and TLS for C&

uri.h
Go to the documentation of this file.
1/*
2* (C) 2019 Nuno Goncalves <nunojpg@gmail.com>
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_URI_H_
8#define BOTAN_URI_H_
9
10#include <cstdint>
11#include <string>
12
13#include <botan/build.h>
14
15 namespace Botan {
16
17 struct BOTAN_TEST_API URI
18 {
19 enum class Type : uint8_t
20 {
21 NotSet,
22 IPv4,
23 IPv6,
24 Domain,
25 };
26 static URI fromAny(const std::string& uri);
27 static URI fromIPv4(const std::string& uri);
28 static URI fromIPv6(const std::string& uri);
29 static URI fromDomain(const std::string& uri);
30 URI() = default;
31 URI(Type xtype, const std::string& xhost, unsigned short xport)
32 : type { xtype }
33 , host { xhost }
34 , port { xport }
35 {}
36 bool operator==(const URI& a) const
37 {
38 return type == a.type && host == a.host && port == a.port;
39 }
40 std::string to_string() const;
41
42 const Type type{Type::NotSet};
43 const std::string host{};
44 const uint16_t port{};
45 };
46
47}
48
49#endif
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition: compiler.h:51
Botan
Definition: alg_id.cpp:13
type
MechanismType type
Definition: p11_mechanism.cpp:44
Botan::URI
Definition: uri.h:18
Botan::URI::type
const Type type
Definition: uri.h:42
Botan::URI::URI
URI()=default
Botan::URI::port
const uint16_t port
Definition: uri.h:44
Botan::URI::host
const std::string host
Definition: uri.h:43
Botan::URI::URI
URI(Type xtype, const std::string &xhost, unsigned short xport)
Definition: uri.h:31
Botan::URI::to_string
std::string to_string() const
Botan::URI::operator==
bool operator==(const URI &a) const
Definition: uri.h:36
Botan::URI::Type
Type
Definition: uri.h:20