summaryrefslogtreecommitdiff
path: root/src/protocol/fqterm_telnet_socket.cpp
blob: af04a8cc87d5c29f7afc82f90d5ac5c906f7dac3 (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
51
52
53
54
55
#include "fqterm.h"
#include "fqterm_telnet_socket.h"

namespace FQTerm {
FQTermTelnetSocket::FQTermTelnetSocket()
    : FQTermSocket() {
  private_socket_ = new FQTermSocketPrivate();
  FQ_VERIFY(connect(private_socket_, SIGNAL(connected()), this, SIGNAL(connected())));
  FQ_VERIFY(connect(private_socket_, SIGNAL(hostFound()), this, SIGNAL(hostFound())));
  FQ_VERIFY(connect(private_socket_, SIGNAL(connectionClosed()), this, SIGNAL(connectionClosed())));
  FQ_VERIFY(connect(private_socket_, SIGNAL(delayedCloseFinished()),
                    this, SIGNAL(delayedCloseFinished())));
  FQ_VERIFY(connect(private_socket_, SIGNAL(readyRead()), this, SIGNAL(readyRead())));
  FQ_VERIFY(connect(private_socket_, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError))));
  FQ_VERIFY(connect(private_socket_, SIGNAL(socketState(int)), this, SIGNAL(socketState(int))));
}

FQTermTelnetSocket::~FQTermTelnetSocket() {
  delete private_socket_;
}

void FQTermTelnetSocket::flush() {
  private_socket_->flush();
}

void FQTermTelnetSocket::setProxy(int nProxyType, bool bAuth,
                                  const QString &strProxyHost,
                                  quint16 uProxyPort,
                                  const QString &strProxyUsr,
                                  const QString &strProxyPwd) {
  private_socket_->setProxy(nProxyType, bAuth, strProxyHost, uProxyPort, strProxyUsr,
                            strProxyPwd);
}

void FQTermTelnetSocket::connectToHost(const QString &host, quint16 port) {
  private_socket_->connectToHost(host, port);
}

void FQTermTelnetSocket::close() {
  private_socket_->close();
}

QByteArray FQTermTelnetSocket::readBlock(unsigned long maxlen) {
  return private_socket_->readBlock(maxlen);
}

long FQTermTelnetSocket::writeBlock(const QByteArray &data) {
  return private_socket_->writeBlock(data);
}

unsigned long FQTermTelnetSocket::bytesAvailable() {
  return private_socket_->bytesAvailable();
}

}