Botan 3.6.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 <botan/types.h>
11#include <cstdint>
12#include <string>
13#include <string_view>
14
15namespace Botan {
16
18 enum class Type : uint8_t {
19 NotSet,
20 IPv4,
21 IPv6,
22 Domain,
23 };
24 static URI fromAny(std::string_view uri);
25 static URI fromIPv4(std::string_view uri);
26 static URI fromIPv6(std::string_view uri);
27 static URI fromDomain(std::string_view uri);
28 URI() = default;
29
30 URI(Type xtype, std::string_view xhost, unsigned short xport) : type{xtype}, host{xhost}, port{xport} {}
31
32 bool operator==(const URI& a) const { return type == a.type && host == a.host && port == a.port; }
33
34 std::string to_string() const;
35
36 const Type type{Type::NotSet};
37 const std::string host{};
38 const uint16_t port{};
39};
40
41} // namespace Botan
42
43#endif
#define BOTAN_TEST_API
Definition compiler.h:51
const Type type
Definition uri.h:36
URI()=default
const uint16_t port
Definition uri.h:38
const std::string host
Definition uri.h:37
URI(Type xtype, std::string_view xhost, unsigned short xport)
Definition uri.h:30
std::string to_string() const
bool operator==(const URI &a) const
Definition uri.h:32