CPPMyth
Library to interoperate with MythTV server
Loading...
Searching...
No Matches
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::Latch * m_latch
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 Enumeration Documentation

◆ ERROR_t

enum Myth::ProtoBase::ERROR_t

Definition at line 50 of file mythprotobase.h.

Constructor & Destructor Documentation

◆ ProtoBase()

ProtoBase::ProtoBase ( const std::string & server,
unsigned port )

Definition at line 60 of file mythprotobase.cpp.

◆ ~ProtoBase()

ProtoBase::~ProtoBase ( )
virtual

Definition at line 76 of file mythprotobase.cpp.

Member Function Documentation

◆ CleanHanging()

void ProtoBase::CleanHanging ( )
virtual

Definition at line 409 of file mythprotobase.cpp.

◆ Close()

void ProtoBase::Close ( )
virtual

Definition at line 356 of file mythprotobase.cpp.

◆ FlushMessage()

size_t ProtoBase::FlushMessage ( )
protected

Definition at line 202 of file mythprotobase.cpp.

◆ GetMessageLength()

size_t ProtoBase::GetMessageLength ( ) const
protected

Definition at line 123 of file mythprotobase.cpp.

◆ GetPort()

unsigned ProtoBase::GetPort ( ) const
virtual

Definition at line 389 of file mythprotobase.cpp.

◆ GetProtoError()

ProtoBase::ERROR_t ProtoBase::GetProtoError ( ) const
virtual

Definition at line 414 of file mythprotobase.cpp.

◆ GetProtoVersion()

unsigned ProtoBase::GetProtoVersion ( ) const
virtual

Definition at line 377 of file mythprotobase.cpp.

◆ GetServer()

std::string ProtoBase::GetServer ( ) const
virtual

Definition at line 384 of file mythprotobase.cpp.

◆ GetSocket()

int ProtoBase::GetSocket ( ) const
virtual

Definition at line 399 of file mythprotobase.cpp.

◆ GetSocketErrNo()

int ProtoBase::GetSocketErrNo ( ) const
virtual

Definition at line 394 of file mythprotobase.cpp.

◆ HangException()

void ProtoBase::HangException ( )
protected

Definition at line 83 of file mythprotobase.cpp.

◆ HasHanging()

bool ProtoBase::HasHanging ( ) const
virtual

Definition at line 404 of file mythprotobase.cpp.

◆ IsMessageOK()

bool ProtoBase::IsMessageOK ( const std::string & field) const
protected

Definition at line 192 of file mythprotobase.cpp.

◆ IsOpen()

virtual bool Myth::ProtoBase::IsOpen ( )
inlinevirtual

Definition at line 60 of file mythprotobase.h.

◆ MakeProgramInfo()

void Myth::ProtoBase::MakeProgramInfo ( const Program & program,
std::string & msg )
inlineprotected

Definition at line 99 of file mythprotobase.h.

◆ MakeProgramInfo75()

void ProtoBase::MakeProgramInfo75 ( const Program & program,
std::string & msg )
private

Definition at line 1237 of file mythprotobase.cpp.

◆ MakeProgramInfo76()

void ProtoBase::MakeProgramInfo76 ( const Program & program,
std::string & msg )
private

Definition at line 1310 of file mythprotobase.cpp.

◆ MakeProgramInfo79()

void ProtoBase::MakeProgramInfo79 ( const Program & program,
std::string & msg )
private

Definition at line 1386 of file mythprotobase.cpp.

◆ MakeProgramInfo82()

void ProtoBase::MakeProgramInfo82 ( const Program & program,
std::string & msg )
private

Definition at line 1465 of file mythprotobase.cpp.

◆ MakeProgramInfo86()

void ProtoBase::MakeProgramInfo86 ( const Program & program,
std::string & msg )
private

Definition at line 1546 of file mythprotobase.cpp.

◆ OpenConnection()

bool ProtoBase::OpenConnection ( int rcvbuf)
protected

Definition at line 282 of file mythprotobase.cpp.

◆ RcvMessageLength()

bool ProtoBase::RcvMessageLength ( )
protected

Definition at line 222 of file mythprotobase.cpp.

◆ RcvProgramInfo()

ProgramPtr Myth::ProtoBase::RcvProgramInfo ( )
inlineprotected

Definition at line 90 of file mythprotobase.h.

◆ RcvProgramInfo75()

ProgramPtr ProtoBase::RcvProgramInfo75 ( )
private

Definition at line 419 of file mythprotobase.cpp.

◆ RcvProgramInfo76()

ProgramPtr ProtoBase::RcvProgramInfo76 ( )
private

Definition at line 564 of file mythprotobase.cpp.

◆ RcvProgramInfo79()

ProgramPtr ProtoBase::RcvProgramInfo79 ( )
private

Definition at line 724 of file mythprotobase.cpp.

◆ RcvProgramInfo82()

ProgramPtr ProtoBase::RcvProgramInfo82 ( )
private

Definition at line 891 of file mythprotobase.cpp.

◆ RcvProgramInfo86()

ProgramPtr ProtoBase::RcvProgramInfo86 ( )
private

Definition at line 1061 of file mythprotobase.cpp.

◆ 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 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::ProtoEvent::RcvBackendMessage(), and RcvVersion().

Here is the caller graph for this function:

◆ SendCommand()

bool ProtoBase::SendCommand ( const char * cmd,
bool feedback = true )
protected

Definition at line 91 of file mythprotobase.cpp.

Field Documentation

◆ m_hang

bool Myth::ProtoBase::m_hang
protected

Connection hang: while true allow retry.

Definition at line 76 of file mythprotobase.h.

Referenced by Myth::ProtoEvent::RcvBackendMessage().

◆ m_isOpen

bool Myth::ProtoBase::m_isOpen
private

Definition at line 109 of file mythprotobase.h.

◆ m_latch

OS::Latch* Myth::ProtoBase::m_latch
protected

Definition at line 71 of file mythprotobase.h.

◆ m_msgConsumed

size_t Myth::ProtoBase::m_msgConsumed
protected

Definition at line 79 of file mythprotobase.h.

◆ m_msgLength

size_t Myth::ProtoBase::m_msgLength
protected

Definition at line 78 of file mythprotobase.h.

◆ m_port

unsigned Myth::ProtoBase::m_port
protected

Definition at line 75 of file mythprotobase.h.

◆ m_protoError

ERROR_t Myth::ProtoBase::m_protoError
private

Definition at line 110 of file mythprotobase.h.

◆ m_protoVersion

unsigned Myth::ProtoBase::m_protoVersion
protected

Definition at line 73 of file mythprotobase.h.

◆ m_server

std::string Myth::ProtoBase::m_server
protected

Definition at line 74 of file mythprotobase.h.

◆ m_socket

TcpSocket* Myth::ProtoBase::m_socket
protected

Definition at line 72 of file mythprotobase.h.

◆ m_tainted

bool Myth::ProtoBase::m_tainted
protected

Connection has hung since last reset.

Definition at line 77 of file mythprotobase.h.


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