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

#include <libmythupnp/bufferedsocketdevice.h>

Collaboration diagram for BufferedSocketDevice:
[legend]

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 39 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 46 of file bufferedsocketdevice.cpp.

◆ ~BufferedSocketDevice()

BufferedSocketDevice::~BufferedSocketDevice ( )
virtual

Definition at line 56 of file bufferedsocketdevice.cpp.

Member Function Documentation

◆ Address()

QHostAddress BufferedSocketDevice::Address ( ) const

Definition at line 686 of file bufferedsocketdevice.cpp.

◆ At() [1/2]

qlonglong BufferedSocketDevice::At ( )
static

Definition at line 321 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ At() [2/2]

bool BufferedSocketDevice::At ( qlonglong  index)

Definition at line 330 of file bufferedsocketdevice.cpp.

◆ AtEnd()

bool BufferedSocketDevice::AtEnd ( )

Definition at line 347 of file bufferedsocketdevice.cpp.

◆ BytesAvailable()

qulonglong BufferedSocketDevice::BytesAvailable ( void  )

Definition at line 362 of file bufferedsocketdevice.cpp.

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

◆ BytesToWrite()

qulonglong BufferedSocketDevice::BytesToWrite ( void  ) const

Definition at line 426 of file bufferedsocketdevice.cpp.

◆ CanReadLine()

bool BufferedSocketDevice::CanReadLine ( )

Definition at line 581 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ ClearPendingData()

void BufferedSocketDevice::ClearPendingData ( )

Definition at line 436 of file bufferedsocketdevice.cpp.

Referenced by Close().

◆ ClearReadBuffer()

void BufferedSocketDevice::ClearReadBuffer ( )

Definition at line 450 of file bufferedsocketdevice.cpp.

◆ Close()

void BufferedSocketDevice::Close ( void  )

Definition at line 65 of file bufferedsocketdevice.cpp.

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

◆ Connect()

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

Definition at line 90 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute().

◆ ConsumeWriteBuf()

bool BufferedSocketDevice::ConsumeWriteBuf ( qulonglong  nbytes)
protected

Definition at line 207 of file bufferedsocketdevice.cpp.

Referenced by Flush().

◆ Flush()

void BufferedSocketDevice::Flush ( void  )

Definition at line 243 of file bufferedsocketdevice.cpp.

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

◆ Getch()

int BufferedSocketDevice::Getch ( )

Definition at line 538 of file bufferedsocketdevice.cpp.

◆ IsValid()

bool BufferedSocketDevice::IsValid ( void  )
inline

Definition at line 116 of file bufferedsocketdevice.h.

◆ PeerAddress()

QHostAddress BufferedSocketDevice::PeerAddress ( ) const

Definition at line 700 of file bufferedsocketdevice.cpp.

◆ PeerPort()

quint16 BufferedSocketDevice::PeerPort ( void  ) const

Definition at line 674 of file bufferedsocketdevice.cpp.

◆ Port()

quint16 BufferedSocketDevice::Port ( void  ) const

Definition at line 662 of file bufferedsocketdevice.cpp.

◆ Putch()

int BufferedSocketDevice::Putch ( int  ch)

Definition at line 561 of file bufferedsocketdevice.cpp.

◆ ReadBlock()

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

Definition at line 459 of file bufferedsocketdevice.cpp.

◆ ReadBufferSize()

qulonglong BufferedSocketDevice::ReadBufferSize ( void  ) const

Definition at line 145 of file bufferedsocketdevice.cpp.

◆ ReadBytes()

int BufferedSocketDevice::ReadBytes ( )
protected

◆ ReadLine() [1/3]

QString BufferedSocketDevice::ReadLine ( )

Definition at line 592 of file bufferedsocketdevice.cpp.

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

◆ ReadLine() [2/3]

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

◆ ReadLine() [3/3]

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

Definition at line 617 of file bufferedsocketdevice.cpp.

◆ SetDestAddress()

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

Definition at line 125 of file bufferedsocketdevice.cpp.

◆ SetReadBufferSize()

void BufferedSocketDevice::SetReadBufferSize ( qulonglong  bufSize)

Definition at line 136 of file bufferedsocketdevice.cpp.

◆ SetSocketDevice()

void BufferedSocketDevice::SetSocketDevice ( MSocketDevice *  pSocket)

Definition at line 111 of file bufferedsocketdevice.cpp.

◆ Size()

qlonglong BufferedSocketDevice::Size ( void  )

Definition at line 312 of file bufferedsocketdevice.cpp.

◆ socket()

int BufferedSocketDevice::socket ( )
inline

Definition at line 117 of file bufferedsocketdevice.h.

Referenced by BufferedSocketDevice().

◆ SocketDevice()

MSocketDevice * BufferedSocketDevice::SocketDevice ( )

Definition at line 102 of file bufferedsocketdevice.cpp.

◆ Ungetch()

int BufferedSocketDevice::Ungetch ( int  ch)

Definition at line 572 of file bufferedsocketdevice.cpp.

◆ WaitForMore()

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

Definition at line 374 of file bufferedsocketdevice.cpp.

Referenced by ReadLine().

◆ WriteBlock()

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

Definition at line 482 of file bufferedsocketdevice.cpp.

Referenced by Putch().

◆ WriteBlockDirect()

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

Definition at line 517 of file bufferedsocketdevice.cpp.

Referenced by UPnpEventTask::Execute().

Member Data Documentation

◆ m_bHandleSocketDelete

bool BufferedSocketDevice::m_bHandleSocketDelete {true}
protected

Definition at line 49 of file bufferedsocketdevice.h.

Referenced by Close(), and SetSocketDevice().

◆ m_bufRead

MMembuf BufferedSocketDevice::m_bufRead
protected

◆ m_bufWrite

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

Definition at line 55 of file bufferedsocketdevice.h.

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

◆ m_destHostAddress

QHostAddress BufferedSocketDevice::m_destHostAddress
protected

Definition at line 51 of file bufferedsocketdevice.h.

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

◆ m_nDestPort

quint16 BufferedSocketDevice::m_nDestPort {0}
protected

Definition at line 52 of file bufferedsocketdevice.h.

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

◆ m_nMaxReadBufferSize

qulonglong BufferedSocketDevice::m_nMaxReadBufferSize {0}
protected

Definition at line 45 of file bufferedsocketdevice.h.

Referenced by ReadBufferSize(), ReadBytes(), and SetReadBufferSize().

◆ m_nWriteIndex

qint64 BufferedSocketDevice::m_nWriteIndex {0}
protected

write index

Definition at line 47 of file bufferedsocketdevice.h.

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

◆ m_nWriteSize

qint64 BufferedSocketDevice::m_nWriteSize {0}
protected

write total buf size

Definition at line 46 of file bufferedsocketdevice.h.

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

◆ m_pSocket

MSocketDevice* BufferedSocketDevice::m_pSocket {nullptr}
protected

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