MythTV  master
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BufferedSocketDevice Class Reference

#include <bufferedsocketdevice.h>

Public Member Functions

 BufferedSocketDevice (int nSocket)
 
 BufferedSocketDevice (MSocketDevice *pSocket=nullptr, bool bTakeOwnership=false)
 
virtual ~BufferedSocketDevice ()
 
MSocketDevice * SocketDevice ()
 
void SetSocketDevice (MSocketDevice *pSocket)
 
void SetDestAddress (QHostAddress hostAddress, quint16 nPort)
 
bool Connect (const QHostAddress &addr, quint16 port)
 
void Close ()
 
void Flush ()
 
qint64 Size ()
 
bool At (qlonglong index)
 
bool AtEnd ()
 
qulonglong BytesAvailable ()
 
qulonglong WaitForMore (std::chrono::milliseconds msecs, bool *timeout=nullptr)
 
qulonglong BytesToWrite () const
 
void ClearPendingData ()
 
void ClearReadBuffer ()
 
qlonglong ReadBlock (char *data, qulonglong maxlen)
 
qlonglong WriteBlock (const char *data, qulonglong len)
 
qlonglong WriteBlockDirect (const char *data, qulonglong len)
 
int Getch ()
 
int Putch (int ch)
 
int Ungetch (int ch)
 
bool CanReadLine ()
 
QString ReadLine ()
 
QString ReadLine (std::chrono::milliseconds msecs)
 
qlonglong ReadLine (char *data, qulonglong maxlen)
 
quint16 Port () const
 
quint16 PeerPort () const
 
QHostAddress Address () const
 
QHostAddress PeerAddress () const
 
void SetReadBufferSize (qulonglong bufSize)
 
qulonglong ReadBufferSize () const
 
bool IsValid ()
 
int socket ()
 

Static Public Member Functions

static qint64 At ()
 

Protected Member Functions

int ReadBytes ()
 
bool ConsumeWriteBuf (qulonglong nbytes)
 

Protected Attributes

MSocketDevice * m_pSocket {nullptr}
 
qulonglong m_nMaxReadBufferSize {0}
 
qint64 m_nWriteSize {0}
 write total buf size More...
 
qint64 m_nWriteIndex {0}
 write index More...
 
bool m_bHandleSocketDelete {true}
 
QHostAddress m_destHostAddress
 
quint16 m_nDestPort {0}
 
MMembuf m_bufRead
 
std::deque< QByteArray * > m_bufWrite
 

Detailed Description

Definition at line 38 of file bufferedsocketdevice.h.

Constructor & Destructor Documentation

◆ BufferedSocketDevice() [1/2]

BufferedSocketDevice::BufferedSocketDevice ( int  nSocket)
explicit

Definition at line 29 of file bufferedsocketdevice.cpp.

◆ BufferedSocketDevice() [2/2]

BufferedSocketDevice::BufferedSocketDevice ( MSocketDevice *  pSocket = nullptr,
bool  bTakeOwnership = false 
)
explicit

Definition at line 49 of file bufferedsocketdevice.cpp.

◆ ~BufferedSocketDevice()

BufferedSocketDevice::~BufferedSocketDevice ( )
virtual

Definition at line 67 of file bufferedsocketdevice.cpp.

Member Function Documentation

◆ ReadBytes()

int BufferedSocketDevice::ReadBytes ( )
protected

◆ ConsumeWriteBuf()

bool BufferedSocketDevice::ConsumeWriteBuf ( qulonglong  nbytes)
protected

Definition at line 218 of file bufferedsocketdevice.cpp.

Referenced by Flush().

◆ SocketDevice()

MSocketDevice * BufferedSocketDevice::SocketDevice ( )

Definition at line 113 of file bufferedsocketdevice.cpp.

◆ SetSocketDevice()

void BufferedSocketDevice::SetSocketDevice ( MSocketDevice *  pSocket)

Definition at line 122 of file bufferedsocketdevice.cpp.

◆ SetDestAddress()

void BufferedSocketDevice::SetDestAddress ( QHostAddress  hostAddress,
quint16  nPort 
)

Definition at line 136 of file bufferedsocketdevice.cpp.

◆ Connect()

bool BufferedSocketDevice::Connect ( const QHostAddress &  addr,
quint16  port 
)

Definition at line 101 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute().

◆ Close()

void BufferedSocketDevice::Close ( )

Definition at line 76 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute(), and ~BufferedSocketDevice().

◆ Flush()

void BufferedSocketDevice::Flush ( )

Definition at line 254 of file bufferedsocketdevice.cpp.

Referenced by Close(), WriteBlock(), and WriteBlockDirect().

◆ Size()

qlonglong BufferedSocketDevice::Size ( )

Definition at line 323 of file bufferedsocketdevice.cpp.

◆ At() [1/2]

qlonglong BufferedSocketDevice::At ( )
static

Definition at line 332 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ At() [2/2]

bool BufferedSocketDevice::At ( qlonglong  index)

Definition at line 341 of file bufferedsocketdevice.cpp.

◆ AtEnd()

bool BufferedSocketDevice::AtEnd ( )

Definition at line 358 of file bufferedsocketdevice.cpp.

◆ BytesAvailable()

qulonglong BufferedSocketDevice::BytesAvailable ( )

Definition at line 373 of file bufferedsocketdevice.cpp.

Referenced by CanReadLine(), Size(), and WaitForMore().

◆ WaitForMore()

qulonglong BufferedSocketDevice::WaitForMore ( std::chrono::milliseconds  msecs,
bool timeout = nullptr 
)

Definition at line 385 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ BytesToWrite()

qulonglong BufferedSocketDevice::BytesToWrite ( ) const

Definition at line 437 of file bufferedsocketdevice.cpp.

◆ ClearPendingData()

void BufferedSocketDevice::ClearPendingData ( )

Definition at line 447 of file bufferedsocketdevice.cpp.

Referenced by Close().

◆ ClearReadBuffer()

void BufferedSocketDevice::ClearReadBuffer ( )

Definition at line 461 of file bufferedsocketdevice.cpp.

◆ ReadBlock()

qlonglong BufferedSocketDevice::ReadBlock ( char *  data,
qulonglong  maxlen 
)

Definition at line 470 of file bufferedsocketdevice.cpp.

◆ WriteBlock()

qlonglong BufferedSocketDevice::WriteBlock ( const char *  data,
qulonglong  len 
)

Definition at line 493 of file bufferedsocketdevice.cpp.

Referenced by Putch().

◆ WriteBlockDirect()

qlonglong BufferedSocketDevice::WriteBlockDirect ( const char *  data,
qulonglong  len 
)

Definition at line 528 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute().

◆ Getch()

int BufferedSocketDevice::Getch ( )

Definition at line 549 of file bufferedsocketdevice.cpp.

◆ Putch()

int BufferedSocketDevice::Putch ( int  ch)

Definition at line 572 of file bufferedsocketdevice.cpp.

◆ Ungetch()

int BufferedSocketDevice::Ungetch ( int  ch)

Definition at line 583 of file bufferedsocketdevice.cpp.

◆ CanReadLine()

bool BufferedSocketDevice::CanReadLine ( )

Definition at line 592 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ ReadLine() [1/3]

QString BufferedSocketDevice::ReadLine ( )

Definition at line 603 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute(), and ReadLine().

◆ ReadLine() [2/3]

QString BufferedSocketDevice::ReadLine ( std::chrono::milliseconds  msecs)

Definition at line 628 of file bufferedsocketdevice.cpp.

◆ ReadLine() [3/3]

qlonglong BufferedSocketDevice::ReadLine ( char *  data,
qulonglong  maxlen 
)

◆ Port()

quint16 BufferedSocketDevice::Port ( ) const

Definition at line 673 of file bufferedsocketdevice.cpp.

◆ PeerPort()

quint16 BufferedSocketDevice::PeerPort ( ) const

Definition at line 685 of file bufferedsocketdevice.cpp.

◆ Address()

QHostAddress BufferedSocketDevice::Address ( ) const

Definition at line 697 of file bufferedsocketdevice.cpp.

◆ PeerAddress()

QHostAddress BufferedSocketDevice::PeerAddress ( ) const

Definition at line 711 of file bufferedsocketdevice.cpp.

◆ SetReadBufferSize()

void BufferedSocketDevice::SetReadBufferSize ( qulonglong  bufSize)

Definition at line 147 of file bufferedsocketdevice.cpp.

◆ ReadBufferSize()

qulonglong BufferedSocketDevice::ReadBufferSize ( ) const

Definition at line 156 of file bufferedsocketdevice.cpp.

◆ IsValid()

bool BufferedSocketDevice::IsValid ( )
inline

Definition at line 115 of file bufferedsocketdevice.h.

◆ socket()

int BufferedSocketDevice::socket ( )
inline

Definition at line 116 of file bufferedsocketdevice.h.

Referenced by BufferedSocketDevice().

Member Data Documentation

◆ m_pSocket

MSocketDevice* BufferedSocketDevice::m_pSocket {nullptr}
protected

◆ m_nMaxReadBufferSize

qulonglong BufferedSocketDevice::m_nMaxReadBufferSize {0}
protected

◆ m_nWriteSize

qint64 BufferedSocketDevice::m_nWriteSize {0}
protected

write total buf size

Definition at line 45 of file bufferedsocketdevice.h.

Referenced by BufferedSocketDevice(), BytesToWrite(), ClearPendingData(), ConsumeWriteBuf(), Flush(), and WriteBlock().

◆ m_nWriteIndex

qint64 BufferedSocketDevice::m_nWriteIndex {0}
protected

write index

Definition at line 46 of file bufferedsocketdevice.h.

Referenced by BufferedSocketDevice(), ClearPendingData(), ConsumeWriteBuf(), and Flush().

◆ m_bHandleSocketDelete

bool BufferedSocketDevice::m_bHandleSocketDelete {true}
protected

Definition at line 48 of file bufferedsocketdevice.h.

Referenced by BufferedSocketDevice(), Close(), and SetSocketDevice().

◆ m_destHostAddress

QHostAddress BufferedSocketDevice::m_destHostAddress
protected

Definition at line 50 of file bufferedsocketdevice.h.

Referenced by Flush(), SetDestAddress(), and WriteBlockDirect().

◆ m_nDestPort

quint16 BufferedSocketDevice::m_nDestPort {0}
protected

◆ m_bufRead

MMembuf BufferedSocketDevice::m_bufRead
protected

◆ m_bufWrite

std::deque<QByteArray*> BufferedSocketDevice::m_bufWrite
protected

Definition at line 54 of file bufferedsocketdevice.h.

Referenced by ClearPendingData(), ConsumeWriteBuf(), Flush(), and WriteBlock().


The documentation for this class was generated from the following files: