| 1 | /* |
| 2 | * libMaia - maiaXmlRpcServer.cpp |
| 3 | * Copyright (c) 2007 Sebastian Wiedenroth <[email protected]> |
| 4 | * and Karl Glatz |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #include "maiaXmlRpcServer.h"cxx . . $ `<file>/deps/libmaia/maiaXmlRpcServer.h`/ |
| 29 | #include "maiaFault.h"cxx . . $ `<file>/deps/libmaia/maiaFault.h`/ |
| 30 | |
| 31 | MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#MaiaXmlRpcServer(b5d054e701f57759).(const QHostAddresscxx . . $ QHostAddress# &address, quint16cxx . . $ quint16# port, QObjectcxx . . $ QObject#* parent) : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent) { |
| 32 | allowedAddressescxx . . $ MaiaXmlRpcServer#allowedAddresses. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 33 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(&servercxx . . $ MaiaXmlRpcServer#server., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(newConnection()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(newConnection())); |
| 34 | servercxx . . $ MaiaXmlRpcServer#server..listencxx . . $ QTcpServer#listen(6fdb1d868b5163ab).(address, port); |
| 35 | } |
| 36 | |
| 37 | MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#MaiaXmlRpcServer(f330ac19beae49fb).(quint16cxx . . $ quint16# port, QObjectcxx . . $ QObject#* parent) : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent) { |
| 38 | allowedAddressescxx . . $ MaiaXmlRpcServer#allowedAddresses. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 39 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(&servercxx . . $ MaiaXmlRpcServer#server., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(newConnection()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(newConnection())); |
| 40 | servercxx . . $ MaiaXmlRpcServer#server..listencxx . . $ QTcpServer#listen(6fdb1d868b5163ab).(QHostAddresscxx . . $ QHostAddress#QHostAddress(87181e547927ba53).::Anycxx . . $ QHostAddress#Any., port); |
| 41 | } |
| 42 | |
| 43 | MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#MaiaXmlRpcServer(9f469670a510c480).(const QHostAddresscxx . . $ QHostAddress# &address, quint16cxx . . $ quint16# port, QListcxx . . $ QList#<QHostAddresscxx . . $ QHostAddress#> *allowedAddresses, QObjectcxx . . $ QObject# *parent) : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent) { |
| 44 | this->allowedAddressescxx . . $ MaiaXmlRpcServer#allowedAddresses. = allowedAddresses; |
| 45 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(&servercxx . . $ MaiaXmlRpcServer#server., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(newConnection()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(newConnection())); |
| 46 | servercxx . . $ MaiaXmlRpcServer#server..listencxx . . $ QTcpServer#listen(6fdb1d868b5163ab).(address, port); |
| 47 | } |
| 48 | |
| 49 | void MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::addMethodcxx . . $ MaiaXmlRpcServer#addMethod(d53457602283a09c).(QStringcxx . . $ QString# method, |
| 50 | QObjectcxx . . $ QObject#* responseObject, const char* responseSlot) { |
| 51 | objectMapcxx . . $ MaiaXmlRpcServer#objectMap.[cxx . . $ QHash#`operator[]`(bbd415b616967878).method] = responseObject; |
| 52 | slotMapcxx . . $ MaiaXmlRpcServer#slotMap.[cxx . . $ QHash#`operator[]`(bbd415b616967878).method] = responseSlot; |
| 53 | } |
| 54 | |
| 55 | void MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::removeMethodcxx . . $ MaiaXmlRpcServer#removeMethod(7df51288a9ebd664).(QStringcxx . . $ QString# method) { |
| 56 | objectMapcxx . . $ MaiaXmlRpcServer#objectMap..removecxx . . $ QHash#remove(dd8e59d271e40448).(method); |
| 57 | slotMapcxx . . $ MaiaXmlRpcServer#slotMap..removecxx . . $ QHash#remove(dd8e59d271e40448).(method); |
| 58 | } |
| 59 | |
| 60 | void MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::getMethodcxx . . $ MaiaXmlRpcServer#getMethod(b7f9a9e3ddd801c2).(QStringcxx . . $ QString# method, QObjectcxx . . $ QObject# **responseObject, const char **responseSlot) { |
| 61 | if(!objectMapcxx . . $ MaiaXmlRpcServer#objectMap..containscxx . . $ QHash#contains(8877ebe272b9620d).(method)) { |
| 62 | *responseObject = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 63 | *responseSlot = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 64 | return; |
| 65 | } |
| 66 | *responseObject = objectMapcxx . . $ MaiaXmlRpcServer#objectMap.[cxx . . $ QHash#`operator[]`(bbd415b616967878).method]; |
| 67 | *responseSlot = slotMapcxx . . $ MaiaXmlRpcServer#slotMap.[cxx . . $ QHash#`operator[]`(bbd415b616967878).method]; |
| 68 | } |
| 69 | |
| 70 | void MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::newConnectioncxx . . $ MaiaXmlRpcServer#newConnection(49f6e7a06ebc5aa8).() { |
| 71 | QTcpSocketcxx . . $ QTcpSocket# *connection = servercxx . . $ MaiaXmlRpcServer#server..nextPendingConnectioncxx . . $ QTcpServer#nextPendingConnection(3b0f0a12ef6ae0dd).(); |
| 72 | if (!this->allowedAddressescxx . . $ MaiaXmlRpcServer#allowedAddresses. || this->allowedAddressescxx . . $ MaiaXmlRpcServer#allowedAddresses.->isEmptycxx . . $ QList#isEmpty(50ce9a9e25b4a850).() || this->allowedAddressescxx . . $ MaiaXmlRpcServer#allowedAddresses.->containscxx . . $ QList#contains(8877ebe272b9620d).(connection->peerAddresscxx . . $ QAbstractSocket#peerAddress(324da51e91434ec8).())) { |
| 73 | MaiaXmlRpcServerConnectioncxx . . $ MaiaXmlRpcServerConnection# *client = new MaiaXmlRpcServerConnectioncxx . . $ MaiaXmlRpcServerConnection#(connection, this); |
| 74 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(client, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(getMethod(QString, QObject **, const char**)), |
| 75 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(getMethod(QString, QObject **, const char**))); |
| 76 | } else { |
| 77 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Rejected connection attempt from" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). connection->peerAddresscxx . . $ QAbstractSocket#peerAddress(324da51e91434ec8).().toStringcxx . . $ QHostAddress#toString(6ef7b6c27b00b43d).(); |
| 78 | connection->disconnectFromHostcxx . . $ QAbstractSocket#disconnectFromHost(49f6e7a06ebc5aa8).(); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | QHostAddresscxx . . $ QHostAddress# MaiaXmlRpcServercxx . . $ MaiaXmlRpcServer#::getServerAddresscxx . . $ MaiaXmlRpcServer#getServerAddress(f93233c433fde5e3).() { |
| 83 | return servercxx . . $ QHostAddress#QHostAddress(b05438ebbfcf3274)..serverAddresscxx . . $ QTcpServer#serverAddress(324da51e91434ec8).(); |
| 84 | } |
| 85 |