vdr 2.8.3
svdrp.c File Reference
#include "svdrp.h"
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <ifaddrs.h>
#include <netinet/in.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <unistd.h>
#include "channels.h"
#include "config.h"
#include "device.h"
#include "eitscan.h"
#include "keys.h"
#include "menu.h"
#include "plugin.h"
#include "recording.h"
#include "remote.h"
#include "skins.h"
#include "timers.h"
#include "videodir.h"

Go to the source code of this file.

Classes

class  cIpAddress
class  cSocket
class  cSVDRPClient
class  cSVDRPServerParams
class  cSVDRPClientHandler
class  cPUTEhandler
class  cSVDRPServer
class  cSVDRPServerHandler

Macros

#define dbgsvdrp(a...)
#define MAXUDPBUF   1024
#define SVDRPResonseTimeout   5000
#define SVDRPDiscoverDelta   60
#define MAXHELPTOPIC   10
#define EITDISABLETIME   10
#define CMD(c)

Enumerations

enum  eSvdrpFetchFlags { sffNone = 0b00000000 , sffConn = 0b00000001 , sffPing = 0b00000010 , sffTimers = 0b00000100 }

Functions

cStateKey StateKeySVDRPRemoteTimersPoll (true)
const char * GetHelpTopic (const char *HelpPage)
const char * GetHelpPage (const char *Cmd, const char **p)
static cString RecordingInUseMessage (int Reason, const char *RecordingId, cRecording *Recording)
void SetSVDRPPorts (int TcpPort, int UdpPort)
void SetSVDRPGrabImageDir (const char *GrabImageDir)
void StartSVDRPHandler (void)
void StopSVDRPHandler (void)
bool GetSVDRPServerNames (cStringList *ServerNames)
bool ExecSVDRPCommand (const char *ServerName, const char *Command, cStringList *Response)
void BroadcastSVDRPCommand (const char *Command)

Variables

static bool DumpSVDRPDataTransfer = false
static int SVDRPTcpPort = 0
static int SVDRPUdpPort = 0
static cPoller SVDRPClientPoller
static cSVDRPClientHandler * SVDRPClientHandler = NULL
const char * HelpPages []
static cString grabImageDir
static cPoller SVDRPServerPoller
static cSVDRPServerHandler * SVDRPServerHandler = NULL
static cMutex SVDRPHandlerMutex

Macro Definition Documentation

◆ CMD

#define CMD ( c)
Value:
(strcasecmp(Cmd, c) == 0)

Definition at line 2645 of file svdrp.c.

Referenced by cSVDRPServer::Execute().

◆ dbgsvdrp

#define dbgsvdrp ( a...)

◆ EITDISABLETIME

#define EITDISABLETIME   10

Definition at line 850 of file svdrp.c.

Referenced by cSVDRPServer::CmdCLRE(), and cSVDRPServer::Execute().

◆ MAXHELPTOPIC

#define MAXHELPTOPIC   10

Definition at line 849 of file svdrp.c.

Referenced by GetHelpTopic(), and cSVDRPServer::PrintHelpTopics().

◆ MAXUDPBUF

#define MAXUDPBUF   1024

Definition at line 100 of file svdrp.c.

Referenced by cSocket::Discover().

◆ SVDRPDiscoverDelta

#define SVDRPDiscoverDelta   60

◆ SVDRPResonseTimeout

#define SVDRPResonseTimeout   5000

Referenced by cSVDRPClient::Process().

Enumeration Type Documentation

◆ eSvdrpFetchFlags

Enumerator
sffNone 
sffConn 
sffPing 
sffTimers 

Definition at line 50 of file svdrp.c.

Function Documentation

◆ BroadcastSVDRPCommand()

void BroadcastSVDRPCommand ( const char * Command)

Sends the given SVDRP Command string to all remote VDRs.

Definition at line 2908 of file svdrp.c.

References BroadcastSVDRPCommand(), ExecSVDRPCommand(), cSVDRPClientHandler::GetServerNames(), cVector< T >::Size(), SVDRPClientHandler, and SVDRPHandlerMutex.

Referenced by BroadcastSVDRPCommand().

◆ ExecSVDRPCommand()

bool ExecSVDRPCommand ( const char * ServerName,
const char * Command,
cStringList * Response = NULL )

Sends the given SVDRP Command string to the remote VDR identified by ServerName and collects all of the response strings in Response.

If no Response parameter is given, the response from command execution is ignored. Returns true if the data exchange was successful. Whether or not the actual SVDRP command was successful depends on the resulting strings from the remote VDR, which can be accessed through Response. If Response is given, it will be cleared before the command is actually executed.

Definition at line 2899 of file svdrp.c.

References ExecSVDRPCommand(), cSVDRPClientHandler::Execute(), SVDRPClientHandler, and SVDRPHandlerMutex.

Referenced by BroadcastSVDRPCommand(), ExecSVDRPCommand(), HandleRemoteTimerModifications(), and cMenuTimers::OnOff().

◆ GetHelpPage()

const char * GetHelpPage ( const char * Cmd,
const char ** p )

Definition at line 1084 of file svdrp.c.

References GetHelpPage(), and GetHelpTopic().

Referenced by cSVDRPServer::CmdHELP(), cSVDRPServer::CmdPLUG(), and GetHelpPage().

◆ GetHelpTopic()

const char * GetHelpTopic ( const char * HelpPage)

Definition at line 1066 of file svdrp.c.

References GetHelpTopic(), and MAXHELPTOPIC.

Referenced by GetHelpPage(), GetHelpTopic(), and cSVDRPServer::PrintHelpTopics().

◆ GetSVDRPServerNames()

bool GetSVDRPServerNames ( cStringList * ServerNames)

Gets a list of all available VDRs this VDR is connected to via SVDRP, and stores it in the given ServerNames list.

The list is cleared before getting the server names. Returns true if the resulting list is not empty.

Definition at line 2890 of file svdrp.c.

References cSVDRPClientHandler::GetServerNames(), GetSVDRPServerNames(), SVDRPClientHandler, and SVDRPHandlerMutex.

Referenced by cMenuEditTimer::cMenuEditTimer(), GetSVDRPServerNames(), and cMenuSetupMisc::Set().

◆ RecordingInUseMessage()

cString RecordingInUseMessage ( int Reason,
const char * RecordingId,
cRecording * Recording )
static

◆ SetSVDRPGrabImageDir()

void SetSVDRPGrabImageDir ( const char * GrabImageDir)

Definition at line 2779 of file svdrp.c.

References grabImageDir, and SetSVDRPGrabImageDir().

Referenced by main(), and SetSVDRPGrabImageDir().

◆ SetSVDRPPorts()

void SetSVDRPPorts ( int TcpPort,
int UdpPort )

Definition at line 2773 of file svdrp.c.

References SetSVDRPPorts(), SVDRPTcpPort, and SVDRPUdpPort.

Referenced by main(), and SetSVDRPPorts().

◆ StartSVDRPHandler()

◆ StateKeySVDRPRemoteTimersPoll()

cStateKey StateKeySVDRPRemoteTimersPoll ( true )

◆ StopSVDRPHandler()

void StopSVDRPHandler ( void )

Variable Documentation

◆ DumpSVDRPDataTransfer

bool DumpSVDRPDataTransfer = false
static

Definition at line 43 of file svdrp.c.

◆ grabImageDir

cString grabImageDir
static

Definition at line 1097 of file svdrp.c.

Referenced by cSVDRPServer::CmdGRAB(), and SetSVDRPGrabImageDir().

◆ HelpPages

const char* HelpPages[]

Definition at line 853 of file svdrp.c.

Referenced by cSVDRPServer::CmdHELP(), and cPluginSvdrpdemo::SVDRPHelpPages().

◆ SVDRPClientHandler

◆ SVDRPClientPoller

cPoller SVDRPClientPoller
static

◆ SVDRPHandlerMutex

cMutex SVDRPHandlerMutex
static

◆ SVDRPServerHandler

cSVDRPServerHandler* SVDRPServerHandler = NULL
static

Definition at line 2801 of file svdrp.c.

Referenced by StartSVDRPHandler(), and StopSVDRPHandler().

◆ SVDRPServerPoller

cPoller SVDRPServerPoller
static

◆ SVDRPTcpPort

int SVDRPTcpPort = 0
static

◆ SVDRPUdpPort

int SVDRPUdpPort = 0
static

Definition at line 48 of file svdrp.c.

Referenced by SetSVDRPPorts(), and StartSVDRPHandler().