2000-07-23 15:01:31 +02:00
|
|
|
/*
|
|
|
|
* svdrp.h: Simple Video Disk Recorder Protocol
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2013-10-10 13:13:30 +02:00
|
|
|
* $Id: svdrp.h 3.1 2013/09/14 13:24:50 kls Exp $
|
2000-07-23 15:01:31 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SVDRP_H
|
|
|
|
#define __SVDRP_H
|
|
|
|
|
2001-10-27 11:47:46 +02:00
|
|
|
#include "recording.h"
|
2000-09-17 08:23:46 +02:00
|
|
|
#include "tools.h"
|
|
|
|
|
2000-07-23 15:01:31 +02:00
|
|
|
class cSocket {
|
|
|
|
private:
|
|
|
|
int port;
|
|
|
|
int sock;
|
|
|
|
int queue;
|
|
|
|
void Close(void);
|
|
|
|
public:
|
|
|
|
cSocket(int Port, int Queue = 1);
|
|
|
|
~cSocket();
|
|
|
|
bool Open(void);
|
|
|
|
int Accept(void);
|
|
|
|
};
|
|
|
|
|
2002-02-24 11:13:21 +01:00
|
|
|
class cPUTEhandler {
|
|
|
|
private:
|
|
|
|
FILE *f;
|
|
|
|
int status;
|
|
|
|
const char *message;
|
|
|
|
public:
|
|
|
|
cPUTEhandler(void);
|
|
|
|
~cPUTEhandler();
|
|
|
|
bool Process(const char *s);
|
|
|
|
int Status(void) { return status; }
|
|
|
|
const char *Message(void) { return message; }
|
|
|
|
};
|
|
|
|
|
2000-07-23 15:01:31 +02:00
|
|
|
class cSVDRP {
|
|
|
|
private:
|
|
|
|
cSocket socket;
|
2000-09-17 08:23:46 +02:00
|
|
|
cFile file;
|
2012-04-26 10:48:18 +02:00
|
|
|
cRecordings recordings;
|
2002-02-24 11:13:21 +01:00
|
|
|
cPUTEhandler *PUTEhandler;
|
2005-11-05 11:21:38 +01:00
|
|
|
int numChars;
|
|
|
|
int length;
|
|
|
|
char *cmdLine;
|
2001-02-18 14:18:13 +01:00
|
|
|
time_t lastActivity;
|
2005-12-30 15:11:16 +01:00
|
|
|
static char *grabImageDir;
|
2006-08-06 09:20:04 +02:00
|
|
|
void Close(bool SendReply = false, bool Timeout = false);
|
2000-07-23 15:01:31 +02:00
|
|
|
bool Send(const char *s, int length = -1);
|
2005-10-09 11:14:14 +02:00
|
|
|
void Reply(int Code, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
|
2005-08-27 16:42:28 +02:00
|
|
|
void PrintHelpTopics(const char **hp);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdCHAN(const char *Option);
|
2002-08-25 10:49:02 +02:00
|
|
|
void CmdCLRE(const char *Option);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdDELC(const char *Option);
|
2001-10-27 11:47:46 +02:00
|
|
|
void CmdDELR(const char *Option);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdDELT(const char *Option);
|
2005-08-28 14:18:24 +02:00
|
|
|
void CmdEDIT(const char *Option);
|
2000-09-17 11:53:35 +02:00
|
|
|
void CmdGRAB(const char *Option);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdHELP(const char *Option);
|
|
|
|
void CmdHITK(const char *Option);
|
|
|
|
void CmdLSTC(const char *Option);
|
2001-04-01 15:40:43 +02:00
|
|
|
void CmdLSTE(const char *Option);
|
2001-10-27 11:47:46 +02:00
|
|
|
void CmdLSTR(const char *Option);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdLSTT(const char *Option);
|
2001-02-18 14:18:13 +01:00
|
|
|
void CmdMESG(const char *Option);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdMODC(const char *Option);
|
|
|
|
void CmdMODT(const char *Option);
|
|
|
|
void CmdMOVC(const char *Option);
|
|
|
|
void CmdNEWC(const char *Option);
|
|
|
|
void CmdNEWT(const char *Option);
|
2001-09-01 09:53:01 +02:00
|
|
|
void CmdNEXT(const char *Option);
|
2005-08-28 10:45:19 +02:00
|
|
|
void CmdPLAY(const char *Option);
|
2005-08-27 16:42:28 +02:00
|
|
|
void CmdPLUG(const char *Option);
|
2002-02-24 11:13:21 +01:00
|
|
|
void CmdPUTE(const char *Option);
|
2007-04-30 12:53:35 +02:00
|
|
|
void CmdREMO(const char *Option);
|
2013-10-10 13:13:30 +02:00
|
|
|
void CmdRENR(const char *Option);
|
2004-01-17 15:41:52 +01:00
|
|
|
void CmdSCAN(const char *Option);
|
2003-04-27 14:23:30 +02:00
|
|
|
void CmdSTAT(const char *Option);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdUPDT(const char *Option);
|
2011-12-04 13:58:33 +01:00
|
|
|
void CmdUPDR(const char *Option);
|
2002-03-09 10:07:40 +01:00
|
|
|
void CmdVOLU(const char *Option);
|
2000-07-23 15:01:31 +02:00
|
|
|
void Execute(char *Cmd);
|
|
|
|
public:
|
|
|
|
cSVDRP(int Port);
|
|
|
|
~cSVDRP();
|
2002-11-30 14:40:10 +01:00
|
|
|
bool HasConnection(void) { return file.IsOpen(); }
|
2002-10-20 12:49:16 +02:00
|
|
|
bool Process(void);
|
2005-12-30 15:11:16 +01:00
|
|
|
static void SetGrabImageDir(const char *GrabImageDir);
|
2000-07-23 15:01:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__SVDRP_H
|