vdr  2.0.4
svdrp.h
Go to the documentation of this file.
1 /*
2  * svdrp.h: Simple Video Disk Recorder Protocol
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: svdrp.h 2.3 2012/04/26 10:30:06 kls Exp $
8  */
9 
10 #ifndef __SVDRP_H
11 #define __SVDRP_H
12 
13 #include "recording.h"
14 #include "tools.h"
15 
16 class cSocket {
17 private:
18  int port;
19  int sock;
20  int queue;
21  void Close(void);
22 public:
23  cSocket(int Port, int Queue = 1);
24  ~cSocket();
25  bool Open(void);
26  int Accept(void);
27  };
28 
29 class cPUTEhandler {
30 private:
31  FILE *f;
32  int status;
33  const char *message;
34 public:
35  cPUTEhandler(void);
36  ~cPUTEhandler();
37  bool Process(const char *s);
38  int Status(void) { return status; }
39  const char *Message(void) { return message; }
40  };
41 
42 class cSVDRP {
43 private:
48  int numChars;
49  int length;
50  char *cmdLine;
51  time_t lastActivity;
52  static char *grabImageDir;
53  void Close(bool SendReply = false, bool Timeout = false);
54  bool Send(const char *s, int length = -1);
55  void Reply(int Code, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
56  void PrintHelpTopics(const char **hp);
57  void CmdCHAN(const char *Option);
58  void CmdCLRE(const char *Option);
59  void CmdCPYR(const char *Option);
60  void CmdDELC(const char *Option);
61  void CmdDELR(const char *Option);
62  void CmdDELT(const char *Option);
63  void CmdEDIT(const char *Option);
64  void CmdGRAB(const char *Option);
65  void CmdHELP(const char *Option);
66  void CmdHITK(const char *Option);
67  void CmdLSTC(const char *Option);
68  void CmdLSTE(const char *Option);
69  void CmdLSTR(const char *Option);
70  void CmdLSTT(const char *Option);
71  void CmdMESG(const char *Option);
72  void CmdMODC(const char *Option);
73  void CmdMODT(const char *Option);
74  void CmdMOVC(const char *Option);
75  void CmdMOVR(const char *Option);
76  void CmdNEWC(const char *Option);
77  void CmdNEWT(const char *Option);
78  void CmdNEXT(const char *Option);
79  void CmdPLAY(const char *Option);
80  void CmdPLUG(const char *Option);
81  void CmdPUTE(const char *Option);
82  void CmdREMO(const char *Option);
83  void CmdSCAN(const char *Option);
84  void CmdSTAT(const char *Option);
85  void CmdUPDT(const char *Option);
86  void CmdUPDR(const char *Option);
87  void CmdVOLU(const char *Option);
88  void Execute(char *Cmd);
89 public:
90  cSVDRP(int Port);
91  ~cSVDRP();
92  bool HasConnection(void) { return file.IsOpen(); }
93  bool Process(void);
94  static void SetGrabImageDir(const char *GrabImageDir);
95  };
96 
97 #endif //__SVDRP_H
98