Files
amnezia-client/client/core/defs.h
T

99 lines
2.5 KiB
C++
Raw Normal View History

2021-01-06 17:12:24 +03:00
#ifndef DEFS_H
#define DEFS_H
2021-04-20 02:09:47 +03:00
#include <QMetaEnum>
2021-01-06 17:12:24 +03:00
#include <QObject>
2023-12-24 21:11:47 +07:00
namespace amnezia
2021-01-06 17:12:24 +03:00
{
2021-03-14 21:19:11 +03:00
2023-12-24 21:11:47 +07:00
constexpr const qint16 qrMagicCode = 1984;
struct ServerCredentials
{
QString hostName;
QString userName;
QString secretData;
int port = 22;
bool isValid() const
{
return !hostName.isEmpty() && !userName.isEmpty() && !secretData.isEmpty() && port > 0;
}
};
enum ErrorCode {
// General error codes
NoError = 0,
2024-01-29 21:33:35 +07:00
UnknownError = 100,
InternalError = 101,
NotImplementedError = 102,
2023-12-24 21:11:47 +07:00
// Server errors
2024-01-29 21:33:35 +07:00
ServerCheckFailed = 200,
ServerPortAlreadyAllocatedError = 201,
ServerContainerMissingError = 202,
ServerDockerFailedError = 203,
ServerCancelInstallation = 204,
ServerUserNotInSudo = 205,
ServerPacketManagerError = 206,
2023-12-24 21:11:47 +07:00
// Ssh connection errors
2024-01-29 21:33:35 +07:00
SshRequestDeniedError = 300,
SshInterruptedError = 301,
SshInternalError = 302,
SshPrivateKeyError = 303,
SshPrivateKeyFormatError = 304,
SshTimeoutError = 305,
2023-12-24 21:11:47 +07:00
// Ssh sftp errors
2024-01-29 21:33:35 +07:00
SshSftpEofError = 400,
SshSftpNoSuchFileError = 401,
SshSftpPermissionDeniedError = 402,
SshSftpFailureError = 403,
SshSftpBadMessageError = 404,
SshSftpNoConnectionError = 405,
SshSftpConnectionLostError = 406,
SshSftpOpUnsupportedError = 407,
SshSftpInvalidHandleError = 408,
SshSftpNoSuchPathError = 409,
SshSftpFileAlreadyExistsError = 410,
SshSftpWriteProtectError = 411,
SshSftpNoMediaError = 412,
2023-12-24 21:11:47 +07:00
// Local errors
2024-01-29 21:33:35 +07:00
OpenVpnConfigMissing = 500,
OpenVpnManagementServerError = 501,
ConfigMissing = 502,
2023-12-24 21:11:47 +07:00
// Distro errors
2024-01-29 21:33:35 +07:00
OpenVpnExecutableMissing = 600,
ShadowSocksExecutableMissing = 601,
CloakExecutableMissing = 602,
AmneziaServiceConnectionFailed = 603,
ExecutableMissing = 604,
2023-12-24 21:11:47 +07:00
// VPN errors
2024-01-29 21:33:35 +07:00
OpenVpnAdaptersInUseError = 700,
OpenVpnUnknownError = 701,
OpenVpnTapAdapterError = 702,
AddressPoolError = 703,
2023-12-24 21:11:47 +07:00
// 3rd party utils errors
2024-01-29 21:33:35 +07:00
OpenSslFailed = 800,
ShadowSocksExecutableCrashed = 801,
CloakExecutableCrashed = 802,
2023-12-24 21:11:47 +07:00
// import and install errors
2024-01-29 21:33:35 +07:00
ImportInvalidConfigError = 900,
2023-12-24 21:11:47 +07:00
// Android errors
2024-01-29 21:33:35 +07:00
AndroidError = 1000
2023-12-24 21:11:47 +07:00
};
2021-01-06 17:12:24 +03:00
} // namespace amnezia
2021-09-30 15:56:48 +03:00
Q_DECLARE_METATYPE(amnezia::ErrorCode)
2021-01-06 17:12:24 +03:00
#endif // DEFS_H