MythTV  0.26-pre
httpstatus.h
Go to the documentation of this file.
00001 
00002 // Program Name: httpstatus.h
00003 //                                                                            
00004 // Purpose - Html & XML status HttpServerExtension 
00005 //                                                                            
00006 // Created By  : David Blain                    Created On : Oct. 24, 2005
00007 // Modified By :                                Modified On:                  
00008 //                                                                            
00010 
00011 #ifndef HTTPSTATUS_H_
00012 #define HTTPSTATUS_H_
00013 
00014 #include <QDomDocument>
00015 #include <QMutex>
00016 #include <QMap>
00017 
00018 #include "httpserver.h"
00019 #include "programinfo.h"
00020 
00021 typedef enum 
00022 {
00023     HSM_Unknown         =  0,
00024     HSM_GetStatusHTML   =  1,
00025     HSM_GetStatusXML    =  2
00026 
00027 } HttpStatusMethod;
00028 
00031 //
00032 // 
00033 //
00036 
00037 class Scheduler;
00038 class AutoExpire;
00039 class EncoderLink;
00040 class MainServer;
00041 
00042 class HttpStatus : public HttpServerExtension
00043 {
00044     private:
00045 
00046         Scheduler                   *m_pSched;
00047         QMap<int, EncoderLink *>    *m_pEncoders;
00048         AutoExpire                  *m_pExpirer;
00049         MainServer                  *m_pMainServer;
00050         bool                         m_bIsMaster;
00051         int                          m_nPreRollSeconds;
00052         QMutex                       m_settingLock;
00053 
00054     private:
00055 
00056         HttpStatusMethod GetMethod( const QString &sURI );
00057 
00058         void    GetStatusXML      ( HTTPRequest *pRequest );
00059         void    GetStatusHTML     ( HTTPRequest *pRequest );
00060 
00061         void    FillStatusXML     ( QDomDocument *pDoc);
00062     
00063         void    PrintStatus       ( QTextStream &os, QDomDocument *pDoc );
00064         int     PrintEncoderStatus( QTextStream &os, QDomElement encoders );
00065         int     PrintScheduled    ( QTextStream &os, QDomElement scheduled );
00066         int     PrintFrontends    ( QTextStream &os, QDomElement frontends );
00067         int     PrintBackends     ( QTextStream &os, QDomElement backends );
00068         int     PrintJobQueue     ( QTextStream &os, QDomElement jobs );
00069         int     PrintMachineInfo  ( QTextStream &os, QDomElement info );
00070         int     PrintMiscellaneousInfo ( QTextStream &os, QDomElement info );
00071 
00072         void    FillProgramInfo   ( QDomDocument *pDoc,
00073                                     QDomNode     &node,
00074                                     ProgramInfo  *pInfo,
00075                                     bool          bIncChannel = true,
00076                                     bool          bDetails    = true );
00077 
00078         void    FillChannelInfo   ( QDomElement  &channel,
00079                                     ProgramInfo  *pInfo,
00080                                     bool          bDetails = true );
00081 
00082 
00083     public:
00084                  HttpStatus( QMap<int, EncoderLink *> *tvList, Scheduler *sched,
00085                              AutoExpire *expirer, bool bIsMaster );
00086         virtual ~HttpStatus();
00087 
00088         void     SetMainServer(MainServer *mainServer)
00089                     { m_pMainServer = mainServer; }
00090 
00091         virtual QStringList GetBasePaths();
00092         
00093         bool     ProcessRequest( HTTPRequest *pRequest );
00094 };
00095 
00096 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends