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 (int 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 (int 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 37 of file bufferedsocketdevice.h.

Constructor & Destructor Documentation

◆ BufferedSocketDevice() [1/2]

BufferedSocketDevice::BufferedSocketDevice ( int  nSocket)
explicit

Definition at line 27 of file bufferedsocketdevice.cpp.

◆ BufferedSocketDevice() [2/2]

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

Definition at line 47 of file bufferedsocketdevice.cpp.

◆ ~BufferedSocketDevice()

BufferedSocketDevice::~BufferedSocketDevice ( )
virtual

Definition at line 65 of file bufferedsocketdevice.cpp.

Member Function Documentation

◆ ReadBytes()

int BufferedSocketDevice::ReadBytes ( )
protected

◆ ConsumeWriteBuf()

bool BufferedSocketDevice::ConsumeWriteBuf ( qulonglong  nbytes)
protected

Definition at line 216 of file bufferedsocketdevice.cpp.

Referenced by Flush().

◆ SocketDevice()

MSocketDevice * BufferedSocketDevice::SocketDevice ( )

Definition at line 111 of file bufferedsocketdevice.cpp.

◆ SetSocketDevice()

void BufferedSocketDevice::SetSocketDevice ( MSocketDevice *  pSocket)

Definition at line 120 of file bufferedsocketdevice.cpp.

◆ SetDestAddress()

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

Definition at line 134 of file bufferedsocketdevice.cpp.

◆ Connect()

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

Definition at line 99 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute().

◆ Close()

void BufferedSocketDevice::Close ( void  )

Definition at line 74 of file bufferedsocketdevice.cpp.

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

◆ Flush()

void BufferedSocketDevice::Flush ( void  )

Definition at line 252 of file bufferedsocketdevice.cpp.

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

◆ Size()

qlonglong BufferedSocketDevice::Size ( void  )

Definition at line 321 of file bufferedsocketdevice.cpp.

◆ At() [1/2]

qlonglong BufferedSocketDevice::At ( )
static

Definition at line 330 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ At() [2/2]

bool BufferedSocketDevice::At ( qlonglong  index)

Definition at line 339 of file bufferedsocketdevice.cpp.

◆ AtEnd()

bool BufferedSocketDevice::AtEnd ( )

Definition at line 356 of file bufferedsocketdevice.cpp.

◆ BytesAvailable()

qulonglong BufferedSocketDevice::BytesAvailable ( void  )

Definition at line 371 of file bufferedsocketdevice.cpp.

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

◆ WaitForMore()

qulonglong BufferedSocketDevice::WaitForMore ( int  msecs,
bool timeout = nullptr 
)

Definition at line 383 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ BytesToWrite()

qulonglong BufferedSocketDevice::BytesToWrite ( void  ) const

Definition at line 435 of file bufferedsocketdevice.cpp.

◆ ClearPendingData()

void BufferedSocketDevice::ClearPendingData ( )

Definition at line 445 of file bufferedsocketdevice.cpp.

Referenced by Close().

◆ ClearReadBuffer()

void BufferedSocketDevice::ClearReadBuffer ( )

Definition at line 459 of file bufferedsocketdevice.cpp.

◆ ReadBlock()

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

Definition at line 468 of file bufferedsocketdevice.cpp.

◆ WriteBlock()

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

Definition at line 491 of file bufferedsocketdevice.cpp.

Referenced by Putch().

◆ WriteBlockDirect()

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

Definition at line 526 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute().

◆ Getch()

int BufferedSocketDevice::Getch ( )

Definition at line 547 of file bufferedsocketdevice.cpp.

◆ Putch()

int BufferedSocketDevice::Putch ( int  ch)

Definition at line 570 of file bufferedsocketdevice.cpp.

◆ Ungetch()

int BufferedSocketDevice::Ungetch ( int  ch)

Definition at line 581 of file bufferedsocketdevice.cpp.

◆ CanReadLine()

bool BufferedSocketDevice::CanReadLine ( )

Definition at line 590 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ ReadLine() [1/3]

QString BufferedSocketDevice::ReadLine ( )

Definition at line 601 of file bufferedsocketdevice.cpp.

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

◆ ReadLine() [2/3]

QString BufferedSocketDevice::ReadLine ( int  msecs)

Definition at line 626 of file bufferedsocketdevice.cpp.

◆ ReadLine() [3/3]

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

◆ Port()

quint16 BufferedSocketDevice::Port ( void  ) const

Definition at line 671 of file bufferedsocketdevice.cpp.

◆ PeerPort()

quint16 BufferedSocketDevice::PeerPort ( void  ) const

Definition at line 683 of file bufferedsocketdevice.cpp.

◆ Address()

QHostAddress BufferedSocketDevice::Address ( ) const

Definition at line 695 of file bufferedsocketdevice.cpp.

◆ PeerAddress()

QHostAddress BufferedSocketDevice::PeerAddress ( ) const

Definition at line 709 of file bufferedsocketdevice.cpp.

◆ SetReadBufferSize()

void BufferedSocketDevice::SetReadBufferSize ( qulonglong  bufSize)

Definition at line 145 of file bufferedsocketdevice.cpp.

◆ ReadBufferSize()

qulonglong BufferedSocketDevice::ReadBufferSize ( void  ) const

Definition at line 154 of file bufferedsocketdevice.cpp.

◆ IsValid()

bool BufferedSocketDevice::IsValid ( void  )
inline

Definition at line 114 of file bufferedsocketdevice.h.

◆ socket()

int BufferedSocketDevice::socket ( )
inline

Definition at line 115 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 44 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 45 of file bufferedsocketdevice.h.

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

◆ m_bHandleSocketDelete

bool BufferedSocketDevice::m_bHandleSocketDelete {true}
protected

Definition at line 47 of file bufferedsocketdevice.h.

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

◆ m_destHostAddress

QHostAddress BufferedSocketDevice::m_destHostAddress
protected

Definition at line 49 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 53 of file bufferedsocketdevice.h.

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


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