blob: b577dd0c4629ed1f3bc62c53eb3d01f5261185f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef FTPCONTROLCHANNEL_H
#define FTPCONTROLCHANNEL_H
#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qtcpsocket.h>
#include <QtCore/qobject.h>
class FtpControlChannel : public QObject
{
Q_OBJECT
public:
explicit FtpControlChannel(QObject *parent = nullptr);
// Connect to an FTP server
void connectToServer(const QString &server);
// Send a command to the server
void command(const QByteArray &command, const QByteArray ¶ms);
public slots:
void error(QAbstractSocket::SocketError);
signals:
// Connection established. Local address and port are known.
void opened(const QHostAddress &localAddress, int localPort);
// Connection closed
void closed();
// Informational message
void info(const QByteArray &info);
// Reply to a previously sent command
void reply(int code, const QByteArray ¶meters);
// Something is wrong
void invalidReply(const QByteArray &reply);
private:
void onReadyRead();
QTcpSocket m_socket;
QByteArray m_buffer;
};
#endif // FTPCONTROLCHANNEL_H
|