Botan
3.6.1
Crypto and TLS for C&
src
lib
utils
socket
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
15
namespace
Botan
{
16
17
struct
BOTAN_TEST_API
URI
{
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
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition
compiler.h:51
Botan
Definition
alg_id.cpp:13
Botan::URI
Definition
uri.h:17
Botan::URI::type
const Type type
Definition
uri.h:36
Botan::URI::URI
URI()=default
Botan::URI::port
const uint16_t port
Definition
uri.h:38
Botan::URI::host
const std::string host
Definition
uri.h:37
Botan::URI::URI
URI(Type xtype, std::string_view xhost, unsigned short xport)
Definition
uri.h:30
Botan::URI::to_string
std::string to_string() const
Botan::URI::operator==
bool operator==(const URI &a) const
Definition
uri.h:32
Botan::URI::Type
Type
Definition
uri.h:18
Generated by
1.12.0