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.
|
|
|
|
*
|
2002-02-24 11:13:21 +01:00
|
|
|
* $Id: svdrp.h 1.14 2002/02/24 10:48:21 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;
|
2001-10-27 11:47:46 +02:00
|
|
|
cRecordings Recordings;
|
2002-02-24 11:13:21 +01:00
|
|
|
cPUTEhandler *PUTEhandler;
|
2001-04-01 14:13:42 +02:00
|
|
|
uint numChars;
|
2001-09-14 14:35:40 +02:00
|
|
|
char cmdLine[MAXPARSEBUFFER];
|
2001-02-18 14:18:13 +01:00
|
|
|
char *message;
|
|
|
|
time_t lastActivity;
|
|
|
|
void Close(bool Timeout = false);
|
2000-07-23 15:01:31 +02:00
|
|
|
bool Send(const char *s, int length = -1);
|
|
|
|
void Reply(int Code, const char *fmt, ...);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdCHAN(const char *Option);
|
|
|
|
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);
|
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 CmdMOVT(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);
|
2002-02-24 11:13:21 +01:00
|
|
|
void CmdPUTE(const char *Option);
|
2000-09-17 09:36:50 +02:00
|
|
|
void CmdUPDT(const char *Option);
|
2000-07-23 15:01:31 +02:00
|
|
|
void Execute(char *Cmd);
|
|
|
|
public:
|
|
|
|
cSVDRP(int Port);
|
|
|
|
~cSVDRP();
|
|
|
|
void Process(void);
|
2001-02-18 14:18:13 +01:00
|
|
|
char *GetMessage(void);
|
2000-07-23 15:01:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__SVDRP_H
|