Botan 2.19.1
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
15namespace Botan {
16
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
#define BOTAN_TEST_API
Definition: compiler.h:51
Definition: alg_id.cpp:13
MechanismType type
Definition: uri.h:18
const Type type
Definition: uri.h:42
URI()=default
const uint16_t port
Definition: uri.h:44
const std::string host
Definition: uri.h:43
URI(Type xtype, const std::string &xhost, unsigned short xport)
Definition: uri.h:31
std::string to_string() const
bool operator==(const URI &a) const
Definition: uri.h:36
Type
Definition: uri.h:20