vdr 2.7.7
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 cSVDRPClientHandlerSVDRPClientHandler = NULL
const char * HelpPages []
static cString grabImageDir
static cPoller SVDRPServerPoller
static cSVDRPServerHandlerSVDRPServerHandler = NULL
static cMutex SVDRPHandlerMutex

Macro Definition Documentation

◆ CMD

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

Definition at line 2673 of file svdrp.c.

Referenced by cSVDRPServer::Execute().

◆ dbgsvdrp

#define dbgsvdrp ( a...)

◆ EITDISABLETIME

#define EITDISABLETIME   10

Definition at line 839 of file svdrp.c.

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

◆ MAXHELPTOPIC

#define MAXHELPTOPIC   10

Definition at line 838 of file svdrp.c.

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

◆ MAXUDPBUF

#define MAXUDPBUF   1024

Definition at line 99 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 2934 of file svdrp.c.

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

◆ 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 2925 of file svdrp.c.

References SVDRPClientHandler, and SVDRPHandlerMutex.

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

◆ GetHelpPage()

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

Definition at line 1073 of file svdrp.c.

References GetHelpTopic().

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

◆ GetHelpTopic()

const char * GetHelpTopic ( const char * HelpPage)

Definition at line 1055 of file svdrp.c.

References MAXHELPTOPIC.

Referenced by GetHelpPage(), 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 2916 of file svdrp.c.

References SVDRPClientHandler, and SVDRPHandlerMutex.

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

◆ RecordingInUseMessage()

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

◆ SetSVDRPGrabImageDir()

void SetSVDRPGrabImageDir ( const char * GrabImageDir)

Definition at line 2807 of file svdrp.c.

References grabImageDir.

Referenced by main().

◆ SetSVDRPPorts()

void SetSVDRPPorts ( int TcpPort,
int UdpPort )

Definition at line 2801 of file svdrp.c.

References SVDRPTcpPort, and SVDRPUdpPort.

Referenced by main().

◆ StartSVDRPHandler()

void StartSVDRPHandler ( void )

◆ StateKeySVDRPRemoteTimersPoll()

cStateKey StateKeySVDRPRemoteTimersPoll ( true )

◆ StopSVDRPHandler()

void StopSVDRPHandler ( void )

Definition at line 2907 of file svdrp.c.

References SVDRPClientHandler, SVDRPHandlerMutex, and SVDRPServerHandler.

Referenced by main(), and cMenuSetupMisc::ProcessKey().

Variable Documentation

◆ DumpSVDRPDataTransfer

bool DumpSVDRPDataTransfer = false
static

Definition at line 43 of file svdrp.c.

◆ grabImageDir

cString grabImageDir
static

Definition at line 1086 of file svdrp.c.

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

◆ HelpPages

const char* HelpPages[]

Definition at line 842 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 2829 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().