CPPMyth
Library to interoperate with MythTV server
Myth::ProtoBase Class Referenceabstract
Inheritance diagram for Myth::ProtoBase:
Collaboration diagram for Myth::ProtoBase:

Public Types

enum  ERROR_t { ERROR_NO_ERROR = 0, ERROR_SERVER_UNREACHABLE, ERROR_SOCKET_ERROR, ERROR_UNKNOWN_VERSION }
 

Public Member Functions

 ProtoBase (const std::string &server, unsigned port)
 
virtual bool Open ()=0
 
virtual void Close ()
 
virtual bool IsOpen ()
 
virtual unsigned GetProtoVersion () const
 
virtual std::string GetServer () const
 
virtual unsigned GetPort () const
 
virtual int GetSocketErrNo () const
 
virtual int GetSocket () const
 
virtual bool HasHanging () const
 
virtual void CleanHanging ()
 
virtual ERROR_t GetProtoError () const
 

Protected Member Functions

bool OpenConnection (int rcvbuf)
 
void HangException ()
 
bool SendCommand (const char *cmd, bool feedback=true)
 
size_t GetMessageLength () const
 
bool ReadField (std::string &field)
 
bool IsMessageOK (const std::string &field) const
 
size_t FlushMessage ()
 
bool RcvMessageLength ()
 
ProgramPtr RcvProgramInfo ()
 
void MakeProgramInfo (const Program &program, std::string &msg)
 

Protected Attributes

OS::CMutex * m_mutex
 
TcpSocket * m_socket
 
unsigned m_protoVersion
 
std::string m_server
 
unsigned m_port
 
bool m_hang
 Connection hang: while true allow retry.
 
bool m_tainted
 Connection has hung since last reset.
 
size_t m_msgLength
 
size_t m_msgConsumed
 

Private Member Functions

bool RcvVersion (unsigned *version)
 
ProgramPtr RcvProgramInfo75 ()
 
ProgramPtr RcvProgramInfo76 ()
 
ProgramPtr RcvProgramInfo79 ()
 
ProgramPtr RcvProgramInfo82 ()
 
ProgramPtr RcvProgramInfo86 ()
 
void MakeProgramInfo75 (const Program &program, std::string &msg)
 
void MakeProgramInfo76 (const Program &program, std::string &msg)
 
void MakeProgramInfo79 (const Program &program, std::string &msg)
 
void MakeProgramInfo82 (const Program &program, std::string &msg)
 
void MakeProgramInfo86 (const Program &program, std::string &msg)
 

Private Attributes

bool m_isOpen
 
ERROR_t m_protoError
 

Detailed Description

Definition at line 44 of file mythprotobase.h.

Member Function Documentation

◆ RcvVersion()

bool ProtoBase::RcvVersion ( unsigned *  version)
private

Parse feedback of command MYTH_PROTO_VERSION and return protocol version of backend

Parameters
version
Returns
true : false

Definition at line 252 of file mythprotobase.cpp.

References m_hang, m_tainted, and ReadField().

◆ ReadField()

bool ProtoBase::ReadField ( std::string &  field)
protected

Read one field from the backend response

Parameters
field
Returns
true : false

Definition at line 133 of file mythprotobase.cpp.

Referenced by Myth::ProtoTransfer::Flush(), Myth::ProtoEvent::RcvBackendMessage(), and RcvVersion().

Here is the caller graph for this function:

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