mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-29 15:12:34 +02:00
2018-08-07 Fred Gleason <fredg@paravelsystems.com>
* Removed Qt3 support classes from ripcd(8).
This commit is contained in:
parent
796e1bebc3
commit
3a7306de13
@ -17325,3 +17325,5 @@
|
||||
* Removed the 'pam_rd' plug-in.
|
||||
* Removed rdchunk(1).
|
||||
* Upgraded Qt3 to Qt4.
|
||||
2018-08-07 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Removed Qt3 support classes from ripcd(8).
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Connection to the Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002-2003,2016-2017 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2003,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -24,12 +24,12 @@
|
||||
#include <qapplication.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include "rdapplication.h"
|
||||
#include "rddatedecode.h"
|
||||
#include "rddb.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdripc.h"
|
||||
|
||||
//RDRipc::RDRipc(QString stationname,QObject *parent)
|
||||
RDRipc::RDRipc(RDStation *station,RDConfig *config,QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
@ -39,17 +39,16 @@ RDRipc::RDRipc(RDStation *station,RDConfig *config,QObject *parent)
|
||||
ripc_ignore_mask=false;
|
||||
ripc_accum="";
|
||||
debug=false;
|
||||
// argnum=0;
|
||||
// argptr=0;
|
||||
|
||||
ripc_connected=false;
|
||||
|
||||
//
|
||||
// TCP Connection
|
||||
//
|
||||
ripc_socket=new Q3Socket(this);
|
||||
ripc_socket=new QTcpSocket(this);
|
||||
connect(ripc_socket,SIGNAL(connected()),this,SLOT(connectedData()));
|
||||
connect(ripc_socket,SIGNAL(error(int)),this,SLOT(errorData(int)));
|
||||
connect(ripc_socket,SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
this,SLOT(errorData(QAbstractSocket::SocketError)));
|
||||
connect(ripc_socket,SIGNAL(readyRead()),this,SLOT(readyData()));
|
||||
}
|
||||
|
||||
@ -153,7 +152,6 @@ void RDRipc::sendOnairFlag()
|
||||
|
||||
void RDRipc::sendRml(RDMacro *macro)
|
||||
{
|
||||
// char buffer[RD_RML_MAX_LENGTH];
|
||||
QString cmd;
|
||||
Q_UINT16 port=RD_RML_NOECHO_PORT;
|
||||
QDateTime now=QDateTime::currentDateTime();
|
||||
@ -197,8 +195,10 @@ void RDRipc::reloadHeartbeat()
|
||||
}
|
||||
|
||||
|
||||
void RDRipc::errorData(int errorcode)
|
||||
void RDRipc::errorData(QAbstractSocket::SocketError err)
|
||||
{
|
||||
rda->log(RDConfig::LogWarning,
|
||||
QString().sprintf("received socket error %d",err));
|
||||
}
|
||||
|
||||
|
||||
@ -207,11 +207,11 @@ void RDRipc::readyData()
|
||||
char data[1501];
|
||||
int n;
|
||||
|
||||
while((n=ripc_socket->readBlock(data,1500))>0) {
|
||||
while((n=ripc_socket->read(data,1500))>0) {
|
||||
data[n]=0;
|
||||
QString line=QString::fromUtf8(data);
|
||||
for(int i=0;i<line.length();i++) {
|
||||
QChar c=line.ref(i);
|
||||
QChar c=line.at(i);
|
||||
if(c.ascii()=='!') {
|
||||
DispatchCommand();
|
||||
ripc_accum="";
|
||||
@ -228,8 +228,8 @@ void RDRipc::readyData()
|
||||
|
||||
void RDRipc::SendCommand(const QString &cmd)
|
||||
{
|
||||
// printf("RDRipc::SendCommand(%s)\n",(const char *)cmd.utf8());
|
||||
ripc_socket->writeBlock((const char *)cmd.utf8(),cmd.utf8().length());
|
||||
// printf("RDRipc::SendCommand(%s)\n",(const char *)cmd.toUtf8());
|
||||
ripc_socket->write(cmd.toUtf8());
|
||||
}
|
||||
|
||||
|
||||
@ -237,8 +237,8 @@ void RDRipc::DispatchCommand()
|
||||
{
|
||||
RDMacro macro;
|
||||
QString str;
|
||||
// char str[RD_RML_MAX_LENGTH];
|
||||
|
||||
// printf("RDRipc::DispatchCommand: %s\n",(const char *)ripc_accum.toUtf8());
|
||||
QStringList cmds=cmds.split(" ",ripc_accum);
|
||||
|
||||
if(cmds[0]=="PW") { // Password Response
|
||||
|
14
lib/rdripc.h
14
lib/rdripc.h
@ -21,9 +21,9 @@
|
||||
#include <qsqldatabase.h>
|
||||
#include <qstring.h>
|
||||
#include <qobject.h>
|
||||
#include <q3socket.h>
|
||||
#include <qlabel.h>
|
||||
#include <qtimer.h>
|
||||
#include <qtcpsocket.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdmacro.h>
|
||||
@ -75,29 +75,23 @@ class RDRipc : public QObject
|
||||
|
||||
private slots:
|
||||
void connectedData();
|
||||
void errorData(int errorcode);
|
||||
void errorData(QAbstractSocket::SocketError err);
|
||||
void readyData();
|
||||
|
||||
private:
|
||||
void SendCommand(const QString &cmd);
|
||||
void DispatchCommand();
|
||||
Q3Socket *ripc_socket;
|
||||
QTcpSocket *ripc_socket;
|
||||
QString ripc_user;
|
||||
QString ripc_password;
|
||||
// QString ripc_stationname;
|
||||
RDStation *ripc_station;
|
||||
RDConfig *ripc_config;
|
||||
bool ripc_onair_flag;
|
||||
bool ripc_ignore_mask;
|
||||
bool debug;
|
||||
QString ripc_accum;
|
||||
/*
|
||||
char args[RIPC_MAX_ARGS][RIPC_MAX_LENGTH];
|
||||
int argnum;
|
||||
int argptr;
|
||||
*/
|
||||
bool ripc_connected;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif // RDRIPC_H
|
||||
|
@ -20,7 +20,7 @@
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ -I/usr/include/Qt3Support
|
||||
LIBS = -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
@ -64,7 +64,6 @@ dist_ripcd_SOURCES = acu1p.cpp acu1p.h\
|
||||
quartz1.cpp quartz1.h\
|
||||
ripcd.cpp ripcd.h globals.h\
|
||||
ripcd_connection.cpp ripcd_connection.h\
|
||||
ripcd_socket.cpp ripcd_socket.h\
|
||||
rossnkscp.cpp rossnkscp.h\
|
||||
sas32000.cpp sas32000.h\
|
||||
sas64000.cpp sas64000.h\
|
||||
@ -111,7 +110,6 @@ nodist_ripcd_SOURCES = moc_am16.cpp\
|
||||
moc_modemlines.cpp\
|
||||
moc_quartz1.cpp\
|
||||
moc_ripcd.cpp\
|
||||
moc_ripcd_socket.cpp\
|
||||
moc_rossnkscp.cpp\
|
||||
moc_sas32000.cpp\
|
||||
moc_sas64000.cpp\
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002-2007,2010,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -45,7 +45,6 @@
|
||||
#include <rdnotification.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include "ripcd_socket.h"
|
||||
#include "ripcd.h"
|
||||
|
||||
bool global_exiting=false;
|
||||
@ -114,11 +113,12 @@ MainObject::MainObject(QObject *parent)
|
||||
|
||||
ripcd_kill_mapper=new QSignalMapper(this);
|
||||
connect(ripcd_kill_mapper,SIGNAL(mapped(int)),this,SLOT(killData(int)));
|
||||
server=new RipcdSocket(RIPCD_TCP_PORT,0,this);
|
||||
if(!server->ok()) {
|
||||
server=new QTcpServer(this);
|
||||
if(!server->listen(QHostAddress::Any,RIPCD_TCP_PORT)) {
|
||||
rda->log(RDConfig::LogErr,"unable to bind ripc port");
|
||||
exit(1);
|
||||
}
|
||||
connect(server,SIGNAL(connection(int)),this,SLOT(newConnection(int)));
|
||||
connect(server,SIGNAL(newConnection()),this,SLOT(newConnectionData()));
|
||||
|
||||
//
|
||||
// Macro Timers
|
||||
@ -149,26 +149,26 @@ MainObject::MainObject(QObject *parent)
|
||||
::signal(SIGTERM,SigHandler);
|
||||
::signal(SIGINT,SigHandler);
|
||||
if(!RDWritePid(RD_PID_DIR,"ripcd.pid",rda->config()->uid())) {
|
||||
printf("ripcd: can't write pid file\n");
|
||||
fprintf(stderr,"ripcd: can't write pid file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// The RML Sockets
|
||||
//
|
||||
ripcd_rml_send=new Q3SocketDevice(Q3SocketDevice::Datagram);
|
||||
ripcd_rml_send=new QUdpSocket(this);
|
||||
|
||||
ripcd_rml_echo=new Q3SocketDevice(Q3SocketDevice::Datagram);
|
||||
ripcd_rml_echo->bind(QHostAddress(),RD_RML_ECHO_PORT);
|
||||
ripcd_rml_echo->setBlocking(false);
|
||||
ripcd_rml_echo=new QUdpSocket(this);
|
||||
ripcd_rml_echo->bind(QHostAddress::Any,RD_RML_ECHO_PORT);
|
||||
connect(ripcd_rml_echo,SIGNAL(readyRead()),this,SLOT(rmlEchoData()));
|
||||
|
||||
ripcd_rml_noecho=new Q3SocketDevice(Q3SocketDevice::Datagram);
|
||||
ripcd_rml_noecho->bind(QHostAddress(),RD_RML_NOECHO_PORT);
|
||||
ripcd_rml_noecho->setBlocking(false);
|
||||
ripcd_rml_noecho=new QUdpSocket(this);
|
||||
ripcd_rml_noecho->bind(QHostAddress::Any,RD_RML_NOECHO_PORT);
|
||||
connect(ripcd_rml_noecho,SIGNAL(readyRead()),this,SLOT(rmlNoechoData()));
|
||||
|
||||
ripcd_rml_reply=new Q3SocketDevice(Q3SocketDevice::Datagram);
|
||||
ripcd_rml_reply->bind(QHostAddress(),RD_RML_REPLY_PORT);
|
||||
ripcd_rml_reply->setBlocking(false);
|
||||
ripcd_rml_reply=new QUdpSocket(this);
|
||||
ripcd_rml_reply->bind(QHostAddress::Any,RD_RML_REPLY_PORT);
|
||||
connect(ripcd_rml_reply,SIGNAL(readyRead()),this,SLOT(rmlReplyData()));
|
||||
|
||||
LoadGpiTable();
|
||||
|
||||
@ -189,14 +189,6 @@ MainObject::MainObject(QObject *parent)
|
||||
ripcd_notification_mcaster->bind(RD_NOTIFICATION_PORT);
|
||||
ripcd_notification_mcaster->subscribe(rda->system()->notificationAddress());
|
||||
|
||||
//
|
||||
// Start RML Polling
|
||||
//
|
||||
QTimer *timer=new QTimer(this);
|
||||
timer->changeInterval(RIPCD_RML_READ_INTERVAL);
|
||||
connect(timer,SIGNAL(timeout()),this,SLOT(readRml()));
|
||||
timer->start(true);
|
||||
|
||||
//
|
||||
// Database Backup Timer
|
||||
//
|
||||
@ -222,7 +214,7 @@ MainObject::MainObject(QObject *parent)
|
||||
//
|
||||
// Exit Timer
|
||||
//
|
||||
timer=new QTimer(this);
|
||||
QTimer *timer=new QTimer(this);
|
||||
connect(timer,SIGNAL(timeout()),this,SLOT(exitTimerData()));
|
||||
timer->start(200);
|
||||
|
||||
@ -248,18 +240,19 @@ void MainObject::log(RDConfig::LogPriority prio,const QString &msg)
|
||||
}
|
||||
|
||||
|
||||
void MainObject::newConnection(int fd)
|
||||
void MainObject::newConnectionData()
|
||||
{
|
||||
unsigned i=0;
|
||||
|
||||
QTcpSocket *sock=server->nextPendingConnection();
|
||||
while((i<ripcd_conns.size())&&(ripcd_conns[i]!=NULL)) {
|
||||
i++;
|
||||
}
|
||||
if(i==ripcd_conns.size()) { // Table full, create a new slot
|
||||
ripcd_conns.push_back(new RipcdConnection(i,fd));
|
||||
ripcd_conns.push_back(new RipcdConnection(i,sock));
|
||||
}
|
||||
else {
|
||||
ripcd_conns[i]=new RipcdConnection(i,fd);
|
||||
ripcd_conns[i]=new RipcdConnection(i,sock);
|
||||
}
|
||||
ripcd_ready_mapper->setMapping(ripcd_conns[i]->socket(),i);
|
||||
connect(ripcd_conns[i]->socket(),SIGNAL(readyRead()),
|
||||
@ -267,6 +260,7 @@ void MainObject::newConnection(int fd)
|
||||
ripcd_kill_mapper->setMapping(ripcd_conns[i]->socket(),i);
|
||||
connect(ripcd_conns[i]->socket(),SIGNAL(connectionClosed()),
|
||||
ripcd_kill_mapper,SLOT(map()));
|
||||
rda->log(RDConfig::LogDebug,QString().sprintf("added new connection %d",i));
|
||||
}
|
||||
|
||||
|
||||
@ -295,14 +289,14 @@ void MainObject::sendRml(RDMacro *rml)
|
||||
str=rml->toString();
|
||||
switch(rml->role()) {
|
||||
case RDMacro::Cmd:
|
||||
ripcd_rml_send->writeBlock(str.utf8(),str.utf8().length(),
|
||||
rml->address(),rml->port());
|
||||
ripcd_rml_send->writeDatagram(str.utf8(),str.utf8().length(),
|
||||
rml->address(),rml->port());
|
||||
break;
|
||||
|
||||
case RDMacro::Reply:
|
||||
if(!(ripcd_host_addr==rml->address())) {
|
||||
ripcd_rml_send->writeBlock(str.utf8(),str.utf8().length(),
|
||||
rml->address(),RD_RML_REPLY_PORT);
|
||||
ripcd_rml_send->writeDatagram(str.utf8(),str.utf8().length(),
|
||||
rml->address(),RD_RML_REPLY_PORT);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -312,10 +306,20 @@ void MainObject::sendRml(RDMacro *rml)
|
||||
}
|
||||
|
||||
|
||||
void MainObject::readRml()
|
||||
void MainObject::rmlEchoData()
|
||||
{
|
||||
ReadRmlSocket(ripcd_rml_echo,RDMacro::Cmd,true);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::rmlNoechoData()
|
||||
{
|
||||
ReadRmlSocket(ripcd_rml_noecho,RDMacro::Cmd,false);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::rmlReplyData()
|
||||
{
|
||||
ReadRmlSocket(ripcd_rml_reply,RDMacro::Reply,false);
|
||||
}
|
||||
|
||||
@ -358,7 +362,7 @@ void MainObject::readyReadData(int conn_id)
|
||||
data[n]=0;
|
||||
QString line=QString::fromUtf8(data);
|
||||
for(int i=0;i<line.length();i++) {
|
||||
QChar c=line.ref(i);
|
||||
QChar c=line.at(i);
|
||||
if(c.toAscii()=='!') {
|
||||
if(!DispatchCommand(conn)) {
|
||||
return;
|
||||
@ -377,8 +381,10 @@ void MainObject::readyReadData(int conn_id)
|
||||
|
||||
void MainObject::killData(int conn_id)
|
||||
{
|
||||
ripcd_conns[conn_id]->socket()->close();
|
||||
ripcd_conns[conn_id]->close();
|
||||
ripcd_garbage_timer->start(1,true);
|
||||
rda->log(RDConfig::LogDebug,QString().sprintf("closed connection %d",
|
||||
conn_id));
|
||||
}
|
||||
|
||||
|
||||
@ -451,9 +457,11 @@ void MainObject::garbageData()
|
||||
{
|
||||
for(unsigned i=0;i<ripcd_conns.size();i++) {
|
||||
if(ripcd_conns[i]!=NULL) {
|
||||
if(ripcd_conns[i]->socket()->state()==Q3Socket::Idle) {
|
||||
if(ripcd_conns[i]->isClosing()) {
|
||||
delete ripcd_conns[i];
|
||||
ripcd_conns[i]=NULL;
|
||||
rda->log(RDConfig::LogDebug,
|
||||
QString().sprintf("cleaned up connection %d",i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -474,6 +482,7 @@ bool MainObject::DispatchCommand(RipcdConnection *conn)
|
||||
int echo=0;
|
||||
QHostAddress addr;
|
||||
|
||||
//printf("DispatchCommand(%s)\n",(const char *)conn->accum.toUtf8());
|
||||
QStringList cmds=cmds.split(" ",conn->accum);
|
||||
|
||||
//
|
||||
@ -481,7 +490,6 @@ bool MainObject::DispatchCommand(RipcdConnection *conn)
|
||||
// Authentication not required to execute these!
|
||||
//
|
||||
if(cmds[0]=="DC") { // Drop Connection
|
||||
conn->socket()->close();
|
||||
killData(conn->id());
|
||||
return false;
|
||||
}
|
||||
@ -631,7 +639,7 @@ bool MainObject::DispatchCommand(RipcdConnection *conn)
|
||||
void MainObject::EchoCommand(int ch,const QString &cmd)
|
||||
{
|
||||
// printf("EchoCommand(%d,%s)\n",ch,(const char *)cmd.utf8());
|
||||
if(ripcd_conns[ch]->socket()->state()==Q3Socket::Connected) {
|
||||
if(ripcd_conns[ch]->socket()->state()==QAbstractSocket::ConnectedState) {
|
||||
ripcd_conns[ch]->socket()->writeBlock(cmd.utf8(),cmd.utf8().length());
|
||||
}
|
||||
}
|
||||
@ -649,7 +657,7 @@ void MainObject::BroadcastCommand(const QString &cmd,int except_ch)
|
||||
}
|
||||
|
||||
|
||||
void MainObject::ReadRmlSocket(Q3SocketDevice *dev,RDMacro::Role role,
|
||||
void MainObject::ReadRmlSocket(QUdpSocket *sock,RDMacro::Role role,
|
||||
bool echo)
|
||||
{
|
||||
char buffer[1501];
|
||||
@ -658,7 +666,7 @@ void MainObject::ReadRmlSocket(Q3SocketDevice *dev,RDMacro::Role role,
|
||||
QHostAddress peer_addr;
|
||||
RDMacro macro;
|
||||
|
||||
while((n=dev->readBlock(buffer,1501))>0) {
|
||||
while((n=sock->readDatagram(buffer,1501,&peer_addr))>0) {
|
||||
buffer[n]=0;
|
||||
macro=RDMacro::fromString(QString::fromUtf8(buffer));
|
||||
if(!macro.isNull()) {
|
||||
@ -680,7 +688,7 @@ void MainObject::ReadRmlSocket(Q3SocketDevice *dev,RDMacro::Role role,
|
||||
}
|
||||
}
|
||||
macro.setRole(role);
|
||||
macro.setAddress(dev->peerAddress());
|
||||
macro.setAddress(peer_addr);
|
||||
macro.setEchoRequested(echo);
|
||||
switch(role) {
|
||||
case RDMacro::Cmd:
|
||||
@ -698,13 +706,13 @@ void MainObject::ReadRmlSocket(Q3SocketDevice *dev,RDMacro::Role role,
|
||||
LogLine(RDConfig::LogWarning,
|
||||
QString().sprintf("received malformed rml: \"%s\" from %s:%u",
|
||||
buffer,
|
||||
(const char *)dev->peerAddress().toString(),
|
||||
dev->peerPort()));
|
||||
(const char *)sock->peerAddress().toString(),
|
||||
sock->peerPort()));
|
||||
if(echo) {
|
||||
macro.setRole(RDMacro::Reply);
|
||||
macro.setCommand(RDMacro::NN);
|
||||
macro.addArg("-");
|
||||
macro.setAddress(dev->peerAddress());
|
||||
macro.setAddress(peer_addr);
|
||||
sendRml(¯o);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -27,10 +27,10 @@
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
#include <q3serversocket.h>
|
||||
#include <qsignalmapper.h>
|
||||
#include <q3socketdevice.h>
|
||||
#include <qtcpserver.h>
|
||||
#include <qtimer.h>
|
||||
#include <qudpsocket.h>
|
||||
|
||||
#include <rdsocket.h>
|
||||
#include <rdttydevice.h>
|
||||
@ -60,14 +60,14 @@ class MainObject : public QObject
|
||||
MainObject(QObject *parent=0);
|
||||
~MainObject();
|
||||
|
||||
public slots:
|
||||
void newConnection(int fd);
|
||||
|
||||
private slots:
|
||||
void newConnectionData();
|
||||
void notificationReceivedData(const QString &msg,const QHostAddress &addr);
|
||||
void log(RDConfig::LogPriority prio,const QString &msg);
|
||||
void sendRml(RDMacro *rml);
|
||||
void readRml();
|
||||
void rmlEchoData();
|
||||
void rmlNoechoData();
|
||||
void rmlReplyData();
|
||||
void gpiChangedData(int matrix,int line,bool state);
|
||||
void gpoChangedData(int matrix,int line,bool state);
|
||||
void gpiStateData(int matrix,unsigned line,bool state);
|
||||
@ -89,7 +89,7 @@ class MainObject : public QObject
|
||||
bool DispatchCommand(RipcdConnection *conn);
|
||||
void EchoCommand(int,const QString &cmd);
|
||||
void BroadcastCommand(const QString &cmd,int except_ch=-1);
|
||||
void ReadRmlSocket(Q3SocketDevice *dev,RDMacro::Role role,bool echo);
|
||||
void ReadRmlSocket(QUdpSocket *sock,RDMacro::Role role,bool echo);
|
||||
QString StripPoint(QString);
|
||||
void LoadLocalMacros();
|
||||
void RunLocalMacros(RDMacro *rml);
|
||||
@ -108,14 +108,14 @@ class MainObject : public QObject
|
||||
QSqlDatabase *ripcd_db;
|
||||
QString ripcd_host;
|
||||
bool debug;
|
||||
Q3ServerSocket *server;
|
||||
QTcpServer *server;
|
||||
std::vector<RipcdConnection *> ripcd_conns;
|
||||
QSignalMapper *ripcd_ready_mapper;
|
||||
QSignalMapper *ripcd_kill_mapper;
|
||||
Q3SocketDevice *ripcd_rml_send;
|
||||
Q3SocketDevice *ripcd_rml_echo;
|
||||
Q3SocketDevice *ripcd_rml_noecho;
|
||||
Q3SocketDevice *ripcd_rml_reply;
|
||||
QUdpSocket *ripcd_rml_send;
|
||||
QUdpSocket *ripcd_rml_echo;
|
||||
QUdpSocket *ripcd_rml_noecho;
|
||||
QUdpSocket *ripcd_rml_reply;
|
||||
QHostAddress ripcd_host_addr;
|
||||
Switcher *ripcd_switcher[MAX_MATRICES];
|
||||
bool ripcd_gpi_state[MAX_MATRICES][MAX_GPIO_PINS];
|
||||
|
@ -20,13 +20,13 @@
|
||||
|
||||
#include <ripcd_connection.h>
|
||||
|
||||
RipcdConnection::RipcdConnection(int id,int fd)
|
||||
RipcdConnection::RipcdConnection(int id,QTcpSocket *sock)
|
||||
{
|
||||
ripcd_id=id;
|
||||
ripcd_authenticated=false;
|
||||
accum="";
|
||||
ripcd_socket=new Q3Socket();
|
||||
ripcd_socket->setSocket(fd);
|
||||
ripcd_socket=sock;
|
||||
ripcd_closing=false;
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ int RipcdConnection::id() const
|
||||
}
|
||||
|
||||
|
||||
Q3Socket *RipcdConnection::socket() const
|
||||
QTcpSocket *RipcdConnection::socket() const
|
||||
{
|
||||
return ripcd_socket;
|
||||
}
|
||||
@ -58,3 +58,15 @@ void RipcdConnection::setAuthenticated(bool state)
|
||||
{
|
||||
ripcd_authenticated=state;
|
||||
}
|
||||
|
||||
|
||||
bool RipcdConnection::isClosing() const
|
||||
{
|
||||
return ripcd_closing;
|
||||
}
|
||||
|
||||
|
||||
void RipcdConnection::close()
|
||||
{
|
||||
ripcd_closing=true;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define RIPCD_CONNECTION_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <q3socket.h>
|
||||
#include <qtcpsocket.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include <rd.h>
|
||||
@ -30,31 +30,22 @@
|
||||
class RipcdConnection
|
||||
{
|
||||
public:
|
||||
RipcdConnection(int id,int fd);
|
||||
RipcdConnection(int id,QTcpSocket *sock);
|
||||
~RipcdConnection();
|
||||
int id() const;
|
||||
Q3Socket *socket() const;
|
||||
QTcpSocket *socket() const;
|
||||
bool isAuthenticated() const;
|
||||
void setAuthenticated(bool state);
|
||||
bool isClosing() const;
|
||||
void close();
|
||||
QString accum;
|
||||
|
||||
private:
|
||||
int ripcd_id;
|
||||
bool ripcd_authenticated;
|
||||
Q3Socket *ripcd_socket;
|
||||
QTcpSocket *ripcd_socket;
|
||||
bool ripcd_closing;
|
||||
};
|
||||
|
||||
/*
|
||||
class RipcdConnection
|
||||
{
|
||||
public:
|
||||
RipcdConnection(int id,int fd);
|
||||
~RipcdConnection();
|
||||
RDSocket *socket;
|
||||
char args[RD_RML_MAX_ARGS][RD_RML_MAX_LENGTH];
|
||||
int istate;
|
||||
int argnum;
|
||||
int argptr;
|
||||
bool auth;
|
||||
};
|
||||
*/
|
||||
|
||||
#endif // RIPCD_CONNECTION_H
|
||||
|
@ -1,51 +0,0 @@
|
||||
// ripcd_socket.cpp
|
||||
//
|
||||
// Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002-2003,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qobject.h>
|
||||
#include <q3serversocket.h>
|
||||
#include <qhostaddress.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ripcd.h>
|
||||
|
||||
#include <ripcd_socket.h>
|
||||
|
||||
RipcdSocket::RipcdSocket(Q_UINT16 port,int backlog,QObject *parent)
|
||||
: Q3ServerSocket(port,0,parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
RipcdSocket::RipcdSocket(const QHostAddress &address,Q_UINT16 port,int backlog,
|
||||
QObject *parent)
|
||||
: Q3ServerSocket(address,port,0,parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RipcdSocket::newConnection(int fd)
|
||||
{
|
||||
emit connection(fd);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
// ripcd_socket.h
|
||||
//
|
||||
// Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef RIPCD_SOCKET_H
|
||||
#define RIPCD_SOCKET_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
#include <q3serversocket.h>
|
||||
#include <qhostaddress.h>
|
||||
|
||||
class RipcdSocket : public Q3ServerSocket
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RipcdSocket(Q_UINT16 port,int backlog=0,QObject *parent=0);
|
||||
RipcdSocket(const QHostAddress &address,Q_UINT16 port,int backlog=0,
|
||||
QObject *parent=0);
|
||||
void newConnection(int socket);
|
||||
|
||||
signals:
|
||||
void connection(int);
|
||||
|
||||
private:
|
||||
Q3ServerSocket *socket;
|
||||
};
|
||||
|
||||
|
||||
#endif // RIPCD_SOCKET_H
|
Loading…
x
Reference in New Issue
Block a user