Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
NetworkAddress.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
4 * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
5 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
6 */
7
8#pragma once
9
10#include "arch/IArchNetwork.h"
11#include "base/EventTypes.h"
12
14
18{
19public:
23 NetworkAddress() = default;
24
29 explicit NetworkAddress(int port);
30
41 NetworkAddress(const std::string &hostname, int port = 0);
42
44
46
48
50
51
53
61 size_t resolve(size_t index = 0);
62
64
66
68
71 bool operator==(const NetworkAddress &address) const;
72
74
77 bool operator!=(const NetworkAddress &address) const;
78
80
83 bool isValid() const;
84
86
90 const ArchNetAddress &getAddress() const;
91
93
97 int getPort() const;
98
100
103 std::string getHostname() const;
104
106
107private:
108 void checkPort() const;
109
110private:
111 ArchNetAddress m_address = nullptr;
112 std::string m_hostname;
113 int m_port = 0;
114};
ArchNetAddressImpl * ArchNetAddress
Opaque network address type. An opaque type representing a network address.
Definition IArchNetwork.h:45
const ArchNetAddress & getAddress() const
Get address.
Definition NetworkAddress.cpp:189
bool isValid() const
Check address validity.
Definition NetworkAddress.cpp:184
size_t resolve(size_t index=0)
Resolve address.
Definition NetworkAddress.cpp:115
std::string getHostname() const
Get hostname.
Definition NetworkAddress.cpp:199
bool operator!=(const NetworkAddress &address) const
Check address inequality.
Definition NetworkAddress.cpp:179
int getPort() const
Get port.
Definition NetworkAddress.cpp:194
bool operator==(const NetworkAddress &address) const
Check address equality.
Definition NetworkAddress.cpp:174
NetworkAddress & operator=(const NetworkAddress &)
Definition NetworkAddress.cpp:97
~NetworkAddress()
Definition NetworkAddress.cpp:89
NetworkAddress()=default