SASC-NG
DVBSoftCAM

svdrp.h

Go to the documentation of this file.
00001 /*
00002  * svdrp.h: Simple Video Disk Recorder Protocol
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: svdrp.h 1.29 2007/04/30 12:28:28 kls Exp $
00008  */
00009 
00010 #ifndef __SVDRP_H
00011 #define __SVDRP_H
00012 
00013 #include "recording.h"
00014 #include "tools.h"
00015 
00016 class cSocket {
00017 private:
00018   int port;
00019   int sock;
00020   int queue;
00021   void Close(void);
00022 public:
00023   cSocket(int Port, int Queue = 1);
00024   ~cSocket();
00025   bool Open(void);
00026   int Accept(void);
00027   };
00028 
00029 class cPUTEhandler {
00030 private:
00031   FILE *f;
00032   int status;
00033   const char *message;
00034 public:
00035   cPUTEhandler(void);
00036   ~cPUTEhandler();
00037   bool Process(const char *s);
00038   int Status(void) { return status; }
00039   const char *Message(void) { return message; }
00040   };
00041 
00042 class cSVDRP {
00043 private:
00044   cSocket socket;
00045   cFile file;
00046   cRecordings Recordings;
00047   cPUTEhandler *PUTEhandler;
00048   int numChars;
00049   int length;
00050   char *cmdLine;
00051   time_t lastActivity;
00052   static char *grabImageDir;
00053   void Close(bool SendReply = false, bool Timeout = false);
00054   bool Send(const char *s, int length = -1);
00055   void Reply(int Code, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
00056   void PrintHelpTopics(const char **hp);
00057   void CmdCHAN(const char *Option);
00058   void CmdCLRE(const char *Option);
00059   void CmdDELC(const char *Option);
00060   void CmdDELR(const char *Option);
00061   void CmdDELT(const char *Option);
00062   void CmdEDIT(const char *Option);
00063   void CmdGRAB(const char *Option);
00064   void CmdHELP(const char *Option);
00065   void CmdHITK(const char *Option);
00066   void CmdLSTC(const char *Option);
00067   void CmdLSTE(const char *Option);
00068   void CmdLSTR(const char *Option);
00069   void CmdLSTT(const char *Option);
00070   void CmdMESG(const char *Option);
00071   void CmdMODC(const char *Option);
00072   void CmdMODT(const char *Option);
00073   void CmdMOVC(const char *Option);
00074   void CmdMOVT(const char *Option);
00075   void CmdNEWC(const char *Option);
00076   void CmdNEWT(const char *Option);
00077   void CmdNEXT(const char *Option);
00078   void CmdPLAY(const char *Option);
00079   void CmdPLUG(const char *Option);
00080   void CmdPUTE(const char *Option);
00081   void CmdREMO(const char *Option);
00082   void CmdSCAN(const char *Option);
00083   void CmdSTAT(const char *Option);
00084   void CmdUPDT(const char *Option);
00085   void CmdVOLU(const char *Option);
00086   void Execute(char *Cmd);
00087 public:
00088   cSVDRP(int Port);
00089   ~cSVDRP();
00090   bool HasConnection(void) { return file.IsOpen(); }
00091   bool Process(void);
00092   static void SetGrabImageDir(const char *GrabImageDir);
00093   };
00094 
00095 #endif //__SVDRP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines