mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
Added SVDRP commands to list and disconnect clients (closes #1860)
This commit is contained in:
parent
7df7185e1a
commit
99b223c55f
@ -229,3 +229,6 @@ hummel99
|
|||||||
|
|
||||||
Henrik Niehaus
|
Henrik Niehaus
|
||||||
for fixing replay of large TS files on 32-bit systems
|
for fixing replay of large TS files on 32-bit systems
|
||||||
|
|
||||||
|
Guy Martin
|
||||||
|
for adding SVDRP commands to list and disconnect clients
|
||||||
|
1
HISTORY
1
HISTORY
@ -1,6 +1,7 @@
|
|||||||
VDR Plugin 'streamdev' Revision History
|
VDR Plugin 'streamdev' Revision History
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
|
- added SVDRP commands to list and disconnect clients (thanks to Guy Martin)
|
||||||
- fixed recplayer issues with large TS files (>4GB)
|
- fixed recplayer issues with large TS files (>4GB)
|
||||||
- Don't abort externremux when internal read buffer is empty
|
- Don't abort externremux when internal read buffer is empty
|
||||||
- Implemented remuxing of recordings
|
- Implemented remuxing of recordings
|
||||||
|
@ -197,5 +197,7 @@ bool cServerConnection::Close()
|
|||||||
return cTBSocket::Close();
|
return cTBSocket::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cServerConnection::ToText() const
|
cString cServerConnection::ToText(char Delimiter) const
|
||||||
{ return cString::sprintf("%s\t%s:%d", Protocol(), RemoteIp().c_str(), RemotePort()); }
|
{
|
||||||
|
return cString::sprintf("%s%c%s:%d", Protocol(), Delimiter, RemoteIp().c_str(), RemotePort());
|
||||||
|
}
|
||||||
|
@ -108,8 +108,8 @@ public:
|
|||||||
/* This connections protocol name */
|
/* This connections protocol name */
|
||||||
virtual const char* Protocol(void) const { return m_Protocol; }
|
virtual const char* Protocol(void) const { return m_Protocol; }
|
||||||
|
|
||||||
/* Representation in menu */
|
/* Text description of stream */
|
||||||
virtual cString ToText(void) const;
|
virtual cString ToText(char Delimiter = ' ') const;
|
||||||
|
|
||||||
/* std::map with additional information */
|
/* std::map with additional information */
|
||||||
const tStrStrMap& Headers(void) const { return m_Headers; }
|
const tStrStrMap& Headers(void) const { return m_Headers; }
|
||||||
|
@ -649,8 +649,8 @@ bool cConnectionHTTP::ProcessURI(const std::string& PathInfo)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cConnectionHTTP::ToText() const
|
cString cConnectionHTTP::ToText(char Delimiter) const
|
||||||
{
|
{
|
||||||
cString str = cServerConnection::ToText();
|
cString str = cServerConnection::ToText(Delimiter);
|
||||||
return Streamer() ? cString::sprintf("%s\t%s", *str, *Streamer()->ToText()) : str;
|
return Streamer() ? cString::sprintf("%s%c%s", *str, Delimiter, *Streamer()->ToText()) : str;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
cConnectionHTTP(void);
|
cConnectionHTTP(void);
|
||||||
virtual ~cConnectionHTTP();
|
virtual ~cConnectionHTTP();
|
||||||
|
|
||||||
virtual cString ToText() const;
|
virtual cString ToText(char Delimiter = ' ') const;
|
||||||
|
|
||||||
virtual bool CanAuthenticate(void);
|
virtual bool CanAuthenticate(void);
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ bool cConnectionIGMP::Close()
|
|||||||
return cServerConnection::Close();
|
return cServerConnection::Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cConnectionIGMP::ToText() const
|
cString cConnectionIGMP::ToText(char Delimiter) const
|
||||||
{
|
{
|
||||||
cString str = cServerConnection::ToText();
|
cString str = cServerConnection::ToText(Delimiter);
|
||||||
return Streamer() ? cString::sprintf("%s\t%s", *str, *Streamer()->ToText()) : str;
|
return Streamer() ? cString::sprintf("%s%c%s", *str, Delimiter, *Streamer()->ToText()) : str;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
bool SetChannel(cChannel *Channel, in_addr_t Dst);
|
bool SetChannel(cChannel *Channel, in_addr_t Dst);
|
||||||
virtual void Welcome(void);
|
virtual void Welcome(void);
|
||||||
virtual cString ToText() const;
|
virtual cString ToText(char Delimiter = ' ') const;
|
||||||
|
|
||||||
/* Not used here */
|
/* Not used here */
|
||||||
virtual bool Command(char *Cmd) { return false; }
|
virtual bool Command(char *Cmd) { return false; }
|
||||||
|
@ -1836,13 +1836,13 @@ bool cConnectionVTP::Respond(int Code, const char *Message, ...)
|
|||||||
Code < 0 ? '-' : ' ', *str);
|
Code < 0 ? '-' : ' ', *str);
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cConnectionVTP::ToText() const
|
cString cConnectionVTP::ToText(char Delimiter) const
|
||||||
{
|
{
|
||||||
cString str = cServerConnection::ToText();
|
cString str = cServerConnection::ToText(Delimiter);
|
||||||
if (Streamer())
|
if (Streamer())
|
||||||
return cString::sprintf("%s\t%s", *str, *Streamer()->ToText());
|
return cString::sprintf("%s%c%s", *str, Delimiter, *Streamer()->ToText());
|
||||||
else if (m_RecPlayer)
|
else if (m_RecPlayer)
|
||||||
return cString::sprintf("%s\t%s", *str, m_RecPlayer->getCurrentRecording()->Name());
|
return cString::sprintf("%s%c%s", *str, Delimiter, m_RecPlayer->getCurrentRecording()->Name());
|
||||||
else
|
else
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
virtual void Welcome(void);
|
virtual void Welcome(void);
|
||||||
virtual void Reject(void);
|
virtual void Reject(void);
|
||||||
|
|
||||||
virtual cString ToText() const;
|
virtual cString ToText(char Delimiter = ' ') const;
|
||||||
|
|
||||||
virtual bool Abort(void) const;
|
virtual bool Abort(void) const;
|
||||||
virtual void Detach(void);
|
virtual void Detach(void);
|
||||||
|
@ -15,7 +15,7 @@ cStreamdevServerMenu::cStreamdevServerMenu(): cOsdMenu(tr("Streamdev Connections
|
|||||||
cThreadLock lock;
|
cThreadLock lock;
|
||||||
const cList<cServerConnection>& clients = cStreamdevServer::Clients(lock);
|
const cList<cServerConnection>& clients = cStreamdevServer::Clients(lock);
|
||||||
for (cServerConnection *s = clients.First(); s; s = clients.Next(s))
|
for (cServerConnection *s = clients.First(); s; s = clients.Next(s))
|
||||||
Add(new cOsdItem(s->ToText()));
|
Add(new cOsdItem(s->ToText('\t')));
|
||||||
SetHelpKeys();
|
SetHelpKeys();
|
||||||
Display();
|
Display();
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ eOSState cStreamdevServerMenu::Disconnect() {
|
|||||||
const cList<cServerConnection>& clients = cStreamdevServer::Clients(lock);
|
const cList<cServerConnection>& clients = cStreamdevServer::Clients(lock);
|
||||||
const char *text = item->Text();
|
const char *text = item->Text();
|
||||||
for (cServerConnection *s = clients.First(); s; s = clients.Next(s)) {
|
for (cServerConnection *s = clients.First(); s; s = clients.Next(s)) {
|
||||||
if (!strcmp(text, s->ToText())) {
|
if (!strcmp(text, s->ToText('\t'))) {
|
||||||
s->Close();
|
s->Close();
|
||||||
Del(Current());
|
Del(Current());
|
||||||
SetHelpKeys();
|
SetHelpKeys();
|
||||||
|
@ -178,4 +178,69 @@ bool cPluginStreamdevServer::SetupParse(const char *Name, const char *Value)
|
|||||||
return StreamdevServerSetup.SetupParse(Name, Value);
|
return StreamdevServerSetup.SetupParse(Name, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char **cPluginStreamdevServer::SVDRPHelpPages(void)
|
||||||
|
{
|
||||||
|
static const char *HelpPages[]=
|
||||||
|
{
|
||||||
|
"LSTC\n"
|
||||||
|
" List connected clients\n",
|
||||||
|
"DISC client_id\n"
|
||||||
|
" Disconnect a client\n",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
return HelpPages;
|
||||||
|
}
|
||||||
|
|
||||||
|
cString cPluginStreamdevServer::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
|
||||||
|
{
|
||||||
|
|
||||||
|
cString reply = NULL;
|
||||||
|
if (!strcasecmp(Command, "LSTC"))
|
||||||
|
{
|
||||||
|
reply = "";
|
||||||
|
cThreadLock lock;
|
||||||
|
const cList<cServerConnection>& clients = cStreamdevServer::Clients(lock);
|
||||||
|
cServerConnection *s = clients.First();
|
||||||
|
if (!s)
|
||||||
|
{
|
||||||
|
reply = "no client connected";
|
||||||
|
ReplyCode = 550;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
for (; s; s = clients.Next(s))
|
||||||
|
{
|
||||||
|
reply = cString::sprintf("%s%p: %s\n", (const char*) reply, s, (const char *) s->ToText());
|
||||||
|
}
|
||||||
|
ReplyCode = 250;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(Command, "DISC"))
|
||||||
|
{
|
||||||
|
void *client = NULL;
|
||||||
|
if (sscanf(Option, "%p", &client) != 1 || !client)
|
||||||
|
{
|
||||||
|
reply = "invalid client handle";
|
||||||
|
ReplyCode = 501;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
cThreadLock lock;
|
||||||
|
const cList<cServerConnection>& clients = cStreamdevServer::Clients(lock);
|
||||||
|
cServerConnection *s = clients.First();
|
||||||
|
for (; s && s != client; s = clients.Next(s));
|
||||||
|
|
||||||
|
if (!s)
|
||||||
|
{
|
||||||
|
reply = "client not found";
|
||||||
|
ReplyCode = 501;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
s->Close();
|
||||||
|
reply = "client disconnected";
|
||||||
|
ReplyCode = 250;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
VDRPLUGINCREATOR(cPluginStreamdevServer); // Don't touch this!
|
VDRPLUGINCREATOR(cPluginStreamdevServer); // Don't touch this!
|
||||||
|
@ -44,6 +44,8 @@ public:
|
|||||||
virtual void MainThreadHook(void);
|
virtual void MainThreadHook(void);
|
||||||
virtual cMenuSetupPage *SetupMenu(void);
|
virtual cMenuSetupPage *SetupMenu(void);
|
||||||
virtual bool SetupParse(const char *Name, const char *Value);
|
virtual bool SetupParse(const char *Name, const char *Value);
|
||||||
|
virtual const char **SVDRPHelpPages(void);
|
||||||
|
virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VDR_STREAMDEVSERVER_H
|
#endif // VDR_STREAMDEVSERVER_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user