amnezia-client/client/core/defs.h
pokamest ba3ef98d1e
Fix for server busy check (#287)
Fix for server busy check
2023-08-16 16:08:08 +01:00

79 lines
1.8 KiB
C++

#ifndef DEFS_H
#define DEFS_H
#include <QMetaEnum>
#include <QObject>
namespace amnezia {
constexpr const qint16 qrMagicCode = 1984;
struct ServerCredentials
{
QString hostName;
QString userName;
QString password;
int port = 22;
bool isValid() const { return !hostName.isEmpty() && !userName.isEmpty() && !password.isEmpty() && port > 0; }
};
enum ErrorCode
{
// General error codes
NoError = 0,
UnknownError,
InternalError,
NotImplementedError,
// Server errors
ServerCheckFailed,
ServerPortAlreadyAllocatedError,
ServerContainerMissingError,
ServerDockerFailedError,
ServerCancelInstallation,
ServerUserNotInSudo,
ServerPacketManagerError,
// Ssh connection errors
SshRequsetDeniedError, SshInterruptedError, SshInternalError,
SshPrivateKeyError, SshPrivateKeyFormatError,
// Ssh sftp errors
SshSftpEofError, SshSftpNoSuchFileError, SshSftpPermissionDeniedError,
SshSftpFailureError, SshSftpBadMessageError, SshSftpNoConnectionError,
SshSftpConnectionLostError, SshSftpOpUnsupportedError, SshSftpInvalidHandleError,
SshSftpNoSuchPathError, SshSftpFileAlreadyExistsError, SshSftpWriteProtectError,
SshSftpNoMediaError,
// Local errors
FailedToSaveConfigData,
OpenVpnConfigMissing,
OpenVpnManagementServerError,
ConfigMissing,
// Distro errors
OpenVpnExecutableMissing,
ShadowSocksExecutableMissing,
CloakExecutableMissing,
AmneziaServiceConnectionFailed,
ExecutableMissing,
// VPN errors
OpenVpnAdaptersInUseError,
OpenVpnUnknownError,
OpenVpnTapAdapterError,
AddressPoolError,
// 3rd party utils errors
OpenSslFailed,
OpenVpnExecutableCrashed,
ShadowSocksExecutableCrashed,
CloakExecutableCrashed
};
} // namespace amnezia
Q_DECLARE_METATYPE(amnezia::ErrorCode)
#endif // DEFS_H