1 #ifndef VFS_TCP_SERVER_H
2 #define VFS_TCP_SERVER_H
5 #include <QSslConfiguration>
24 void sslErrors(
const QList<QSslError> &errors);
34 explicit VFS_tcp_server(quint16 port=0, QHostAddress address=QHostAddress::Any,
bool ssl=
false, QString sslCertPath=
"", QString sslKeyPath=
"");
50 virtual VFS_tcp_client *
newClient(QTcpSocket *socket,
bool ssl=
false, QSslConfiguration sslConfiguration=QSslConfiguration());
64 virtual void clientError(QAbstractSocket::SocketError error);
VFS_node is the base class from which all other VFS_node classes derive.
The base class for all requests between nodes.
Open a listening TCP port for other clients to connect to.
QString _sslKeyPath
ssl key file path
virtual void read(VFS_request *r)
Read the state of this node, which is the result of ls().
virtual void createNewConnection()
The server has received a new connection request.
virtual QString reportDetails()
Report details of this node.
virtual void clientError(QAbstractSocket::SocketError error)
A socket error has occurred.
virtual bool isContainer()
A server is a container.
QSslConfiguration _sslConfiguration
ssl config built up from below paths
QHostAddress _listenAddress
Address(es) allowed to connect, or 0.0.0.0 if all are allowed.
virtual void newConnection(VFS_tcp_client *c)
Attach the clientMessage handler.
virtual bool listen()
Open the server socket and listen for new connections.
virtual ~VFS_tcp_server()
virtual void metadata(VFS_request *r)
Fetch the metadata for this node.
VFSQTcpServer _socket
TCP socket used for connections.
QString _sslCertPath
ssl cert file path
virtual VFS_tcp_client * newClient(QTcpSocket *socket, bool ssl=false, QSslConfiguration sslConfiguration=QSslConfiguration())
Create a new VFS_tcp_client with the new socket.
virtual void clientMessage(QByteArray message)
A message has been received.
quint16 _port
TCP port to listen on, or 0 to find an available one.
VFS_tcp_server(quint16 port=0, QHostAddress address=QHostAddress::Any, bool ssl=false, QString sslCertPath="", QString sslKeyPath="")
Create a VFS_tcp_server node.
virtual void closeConnection()
Close a socket connection.
This is a subclass of QTcpServer, needed to enable SSL.
void setSslConfiguration(QSslConfiguration sslConfiguration)
Set the SSL configuration.
void incomingConnection(qintptr socketDescriptor)
Handle a new incoming connection.
QSslConfiguration _sslConfiguration
The ssl configuration, which will include cert files and ssl mode.
VFSQTcpServer(QObject *parent=nullptr, bool ssl=false)
Create a VFSQTcpServer, which allows to create QSslSocket instances if _ssl is true.
void modeChanged(QSslSocket::SslMode mode)
A slot for when the SSL mode has changed.
void sslErrors(const QList< QSslError > &errors)
One or more ssl errors have occurred.
void sslReady()
SSL is ready, but do nothing.