#include <mythsocket.h>
Definition at line 24 of file mythsocket.h.
Public Types | |
| enum | State { Connected, Connecting, HostLookup, Idle } |
Public Member Functions | |
| MythSocket (int socket=-1, MythSocketCBs *cb=NULL) | |
| void | close (void) |
| void | deleteLater (void) |
| void | UpRef (void) |
| bool | DownRef (void) |
| State | state (void) |
| QString | stateToString (void) |
| QString | stateToString (const State state) |
| QString | errorToString (void) |
| QString | errorToString (const Error error) |
| void | setSocket (int socket, Type type=QSocketDevice::Stream) |
| void | setCallbacks (MythSocketCBs *cb) |
| Q_LONG | readBlock (char *data, Q_ULONG len) |
| Q_LONG | writeBlock (const char *data, Q_ULONG len) |
| Attempt to write 'len' bytes to socket. | |
| bool | readStringList (QStringList &list, bool quickTimeout=false) |
| bool | writeStringList (QStringList &list) |
| bool | writeData (const char *data, Q_ULONG len) |
| Write len bytes to data to socket. | |
| bool | connect (const QHostAddress &addr, Q_UINT16 port) |
| connect to host | |
| bool | connect (const QString &host, Q_UINT16 port) |
| connect to host | |
| void | Lock () |
| void | Unlock () |
Protected Member Functions | |
| ~MythSocket () | |
| void | setState (const State state) |
Static Protected Member Functions | |
| static void | StartReadyReadThread (void) |
| static void * | readyReadThread (void *) |
| static void | AddToReadyRead (MythSocket *sock) |
| static void | RemoveFromReadyRead (MythSocket *sock) |
| static void | WakeReadyReadThread (void) |
| static void | ShutdownReadyReadThread (void) |
Protected Attributes | |
| MythSocketCBs * | m_cb |
| State | m_state |
| QHostAddress | m_addr |
| Q_UINT16 | m_port |
| int | m_ref_count |
| bool | m_notifyread |
| QMutex | m_ref_lock |
| QMutex | m_lock |
Static Protected Attributes | |
| static const uint | kSocketBufferSize = 128000 |
| static pthread_t | m_readyread_thread = (pthread_t)0 |
| static bool | m_readyread_run = false |
| static QMutex | m_readyread_lock |
| static QPtrList< MythSocket > | m_readyread_list |
| static QPtrList< MythSocket > | m_readyread_dellist |
| static QPtrList< MythSocket > | m_readyread_addlist |
| static int | m_readyread_pipe [2] = {-1, -1} |
Friends | |
| class | QPtrList< MythSocket > |
| void | readyReadThread_iffound (MythSocket *) |
| enum MythSocket::State |
| MythSocket::MythSocket | ( | int | socket = -1, |
|
| MythSocketCBs * | cb = NULL | |||
| ) |
Definition at line 40 of file mythsocket.cpp.
| MythSocket::~MythSocket | ( | ) | [protected] |
Definition at line 53 of file mythsocket.cpp.
| void MythSocket::close | ( | void | ) |
Definition at line 190 of file mythsocket.cpp.
Referenced by connect(), MainServer::HandleDone(), readBlock(), ZMClient::readData(), readStringList(), readyReadThread_iffound(), setSocket(), ZMClient::shutdown(), LCD::shutdown(), ShutdownReadyReadThread(), telnet(), writeBlock(), writeData(), and ~MythSocket().
| void MythSocket::deleteLater | ( | void | ) |
| void MythSocket::UpRef | ( | void | ) |
Definition at line 75 of file mythsocket.cpp.
Referenced by AddToReadyRead(), MainServer::customEvent(), PlaybackSock::SendReceiveStringList(), and ProcessRequestThread::setup().
| bool MythSocket::DownRef | ( | void | ) |
Definition at line 83 of file mythsocket.cpp.
Referenced by RemoteFile::Close(), MythContext::connectionClosed(), MythContext::ConnectServer(), ZMClient::connectToHost(), LCD::connectToHost(), MainServer::customEvent(), RemoteEncoder::openControlSocket(), RemoteFile::openSocket(), readyReadThread(), MainServer::reconnectTimeout(), PreviewGenerator::RemotePreviewTeardown(), ProcessRequestThread::run(), PlaybackSock::SendReceiveStringList(), MythContext::SendReceiveStringList(), FileTransfer::~FileTransfer(), LCD::~LCD(), MythContextPrivate::~MythContextPrivate(), PlaybackSock::~PlaybackSock(), RemoteEncoder::~RemoteEncoder(), RemoteFile::~RemoteFile(), and ZMClient::~ZMClient().
| MythSocket::State MythSocket::state | ( | void | ) |
Definition at line 107 of file mythsocket.cpp.
Referenced by MythContext::AllowShutdown(), MythContext::BlockShutdown(), connect(), MythContext::ConnectServer(), LCD::connectToHost(), readBlock(), readStringList(), MythContext::readyRead(), readyReadThread(), MainServer::reconnectTimeout(), LCD::sendToServer(), setSocket(), writeBlock(), writeData(), and writeStringList().
| QString MythSocket::stateToString | ( | void | ) | [inline] |
| QString MythSocket::stateToString | ( | const State | state | ) |
Definition at line 123 of file mythsocket.cpp.
| QString MythSocket::errorToString | ( | void | ) | [inline] |
Definition at line 48 of file mythsocket.h.
Referenced by connect(), LCD::connectionFailed(), ZMClient::readData(), readStringList(), writeData(), and writeStringList().
| QString MythSocket::errorToString | ( | const Error | error | ) |
Definition at line 140 of file mythsocket.cpp.
| void MythSocket::setSocket | ( | int | socket, | |
| Type | type = QSocketDevice::Stream | |||
| ) |
| void MythSocket::setCallbacks | ( | MythSocketCBs * | cb | ) |
Definition at line 59 of file mythsocket.cpp.
Referenced by LCD::connectToHost(), MythContext::ConnectToMasterServer(), MainServer::newConnection(), and MainServer::reconnectTimeout().
| Q_LONG MythSocket::readBlock | ( | char * | data, | |
| Q_ULONG | len | |||
| ) |
Definition at line 196 of file mythsocket.cpp.
Referenced by RemoteFile::Read(), ZMClient::readData(), readStringList(), LCD::readyRead(), and RemoteFile::Reset().
| Q_LONG MythSocket::writeBlock | ( | const char * | data, | |
| Q_ULONG | len | |||
| ) |
Attempt to write 'len' bytes to socket.
Definition at line 225 of file mythsocket.cpp.
Referenced by writeData(), and writeStringList().
Definition at line 393 of file mythsocket.cpp.
Referenced by MythContext::AllowShutdown(), MythContext::BlockShutdown(), MythContext::CheckProtoVersion(), RemoteFile::Close(), MythContext::ConnectServer(), RemoteEncoder::openControlSocket(), RemoteFile::openSocket(), MainServer::ProcessRequestWork(), RemoteFile::Read(), MythContext::readyRead(), MainServer::reconnectTimeout(), PreviewGenerator::RemotePreviewRun(), RemoteFile::Seek(), ZMClient::sendReceiveStringList(), RemoteEncoder::SendReceiveStringList(), PlaybackSock::SendReceiveStringList(), MythContext::SendReceiveStringList(), and RemoteFile::SetTimeout().
| bool MythSocket::writeStringList | ( | QStringList & | list | ) |
Definition at line 251 of file mythsocket.cpp.
Referenced by MythContext::AllowShutdown(), MythContext::BlockShutdown(), MythContext::CheckProtoVersion(), RemoteFile::Close(), MythContext::ConnectServer(), MainServer::customEvent(), MainServer::HandleAnnounce(), MainServer::HandleVersion(), RemoteEncoder::openControlSocket(), RemoteFile::openSocket(), RemoteFile::Read(), MainServer::reconnectTimeout(), PreviewGenerator::RemotePreviewRun(), RemoteFile::Seek(), ZMClient::sendReceiveStringList(), RemoteEncoder::SendReceiveStringList(), PlaybackSock::SendReceiveStringList(), MythContext::SendReceiveStringList(), MainServer::SendResponse(), and RemoteFile::SetTimeout().
| bool MythSocket::writeData | ( | const char * | data, | |
| Q_ULONG | len | |||
| ) |
Write len bytes to data to socket.
Definition at line 341 of file mythsocket.cpp.
Referenced by FileTransfer::RequestBlock().
| bool MythSocket::connect | ( | const QHostAddress & | addr, | |
| Q_UINT16 | port | |||
| ) |
connect to host
Definition at line 605 of file mythsocket.cpp.
Referenced by connect(), MythContext::ConnectServer(), ZMClient::connectToHost(), LCD::connectToHost(), RemoteEncoder::openControlSocket(), RemoteFile::openSocket(), MainServer::reconnectTimeout(), and telnet().
| bool MythSocket::connect | ( | const QString & | host, | |
| Q_UINT16 | port | |||
| ) |
| void MythSocket::Lock | ( | void | ) |
Definition at line 578 of file mythsocket.cpp.
Referenced by MythContext::AllowShutdown(), MythContext::BlockShutdown(), MythContext::ConnectServer(), LCD::connectToHost(), MainServer::customEvent(), MainServer::ProcessRequest(), MainServer::reconnectTimeout(), and PlaybackSock::SendReceiveStringList().
| void MythSocket::Unlock | ( | void | ) |
Definition at line 584 of file mythsocket.cpp.
Referenced by MythContext::AllowShutdown(), MythContext::BlockShutdown(), MythContext::ConnectServer(), LCD::connectToHost(), MainServer::customEvent(), MainServer::ProcessRequest(), MainServer::reconnectTimeout(), and PlaybackSock::SendReceiveStringList().
| void MythSocket::setState | ( | const State | state | ) | [protected] |
| void MythSocket::StartReadyReadThread | ( | void | ) | [static, protected] |
| void * MythSocket::readyReadThread | ( | void * | ) | [static, protected] |
| void MythSocket::AddToReadyRead | ( | MythSocket * | sock | ) | [static, protected] |
| void MythSocket::RemoveFromReadyRead | ( | MythSocket * | sock | ) | [static, protected] |
| void MythSocket::WakeReadyReadThread | ( | void | ) | [static, protected] |
Definition at line 712 of file mythsocket.cpp.
Referenced by AddToReadyRead(), connect(), Lock(), readStringList(), RemoveFromReadyRead(), ShutdownReadyReadThread(), and Unlock().
| void MythSocket::ShutdownReadyReadThread | ( | void | ) | [static, protected] |
friend class QPtrList< MythSocket > [friend] |
Definition at line 101 of file mythsocket.h.
| void readyReadThread_iffound | ( | MythSocket * | sock | ) | [friend] |
MythSocketCBs* MythSocket::m_cb [protected] |
Definition at line 72 of file mythsocket.h.
Referenced by connect(), DownRef(), MythSocket(), readBlock(), readStringList(), readyReadThread_iffound(), setCallbacks(), and writeBlock().
State MythSocket::m_state [protected] |
QHostAddress MythSocket::m_addr [protected] |
Definition at line 74 of file mythsocket.h.
Q_UINT16 MythSocket::m_port [protected] |
Definition at line 75 of file mythsocket.h.
int MythSocket::m_ref_count [protected] |
bool MythSocket::m_notifyread [protected] |
Definition at line 78 of file mythsocket.h.
Referenced by readBlock(), readStringList(), readyReadThread(), and readyReadThread_iffound().
const uint MythSocket::kSocketBufferSize = 128000 [static, protected] |
QMutex MythSocket::m_ref_lock [protected] |
QMutex MythSocket::m_lock [protected] |
pthread_t MythSocket::m_readyread_thread = (pthread_t)0 [static, protected] |
Definition at line 85 of file mythsocket.h.
Referenced by ShutdownReadyReadThread(), and StartReadyReadThread().
bool MythSocket::m_readyread_run = false [static, protected] |
Definition at line 86 of file mythsocket.h.
Referenced by readyReadThread(), ShutdownReadyReadThread(), and StartReadyReadThread().
QMutex MythSocket::m_readyread_lock [static, protected] |
Definition at line 87 of file mythsocket.h.
Referenced by AddToReadyRead(), readyReadThread(), RemoveFromReadyRead(), and StartReadyReadThread().
QPtrList< MythSocket > MythSocket::m_readyread_list [static, protected] |
QPtrList< MythSocket > MythSocket::m_readyread_dellist [static, protected] |
Definition at line 89 of file mythsocket.h.
Referenced by readyReadThread(), and RemoveFromReadyRead().
QPtrList< MythSocket > MythSocket::m_readyread_addlist [static, protected] |
int MythSocket::m_readyread_pipe = {-1, -1} [static, protected] |
Definition at line 91 of file mythsocket.h.
Referenced by readyReadThread(), ShutdownReadyReadThread(), StartReadyReadThread(), and WakeReadyReadThread().
1.5.5