xmlrpc/server.h

    00001 // vim:tabstop=4:shiftwidth=4:expandtab:cinoptions=(s,U1,m1
    00002 // Copyright (C) 2005 Dmitry Poplavsky <dima@thekompany.com>
    00003
    00004 #ifndef XMLRPC_SERVER_H
    00005 #define XMLRPC_SERVER_H
    00006
    00007 #include <QTcpServer>
    00008 #include <QPointer>
    00009
    00010 #include "variant.h"
    00011
    00012 namespace  xmlrpc {
    00013 class IncomingConnection;
    00018 class Server : public QObject {
    00019 friend class IncomingConnection;
    00020 Q_OBJECT
    00021 public:
    00022     Server( QObject * parent = 0 );
    00023     virtual ~Server();
    00024
    00025     bool listen ( quint16 port, const QHostAddress & address = QHostAddress::Any );
    00026     bool isListening() const;
    00027
    00028     void registerMethod( QString methodName, QVariant::Type returnType,
    00029                          QList<QVariant::Type> parameterTypes );
    00030
    00031     void registerMethod( QString methodName, QVariant::Type returnType );
    00032     void registerMethod( QString methodName, QVariant::Type returnType,
    00033                          QVariant::Type parameter1Type );
    00034     void registerMethod( QString methodName, QVariant::Type returnType,
    00035                          QVariant::Type parameter1Type, QVariant::Type parameter2Type );
    00036     void registerMethod( QString methodName, QVariant::Type returnType,
    00037                          QVariant::Type parameter1Type, QVariant::Type parameter2Type, QVariant::Type parameter3Type );
    00038     void registerMethod( QString methodName, QVariant::Type returnType,
    00039                          QVariant::Type parameter1Type, QVariant::Type parameter2Type, QVariant::Type parameter3Type, QVariant::Type parameter4Type );
    00040
    00041 signals:
    00042     void incomingRequest( int requestId, QString methodName, QList<xmlrpc::Variant> parameters );
    00043
    00044 public slots:
    00045     void sendReturnValue( int requestId, const xmlrpc::Variant& value );
    00046     void sendFault( int requestId, int faultCode, QString faultMessage );
    00047
    00048
    00049 protected slots:
    00050     void newConnection();
    00051     void processRequest( QByteArray data, QTcpSocket *socket );
    00052
    00053 private:
    00054     class Private;
    00055     Private *d;
    00056 };
    00057
    00058 } // namespace
    00059
    00060 #endif // XMLRPC_SERVER_H
    00061
    00062