Main Page   Class Hierarchy   Compound List   File List   Compound Members  

rfcregistryimpl.h

00001 /*
00002  *  Interface to register SLP services - OpenSLP Implementation
00003  *  Copyright (C) 2002-2003 Tim Jansen <tim@tjansen.de>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  *  Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef KDE_SLP_RFCREGISTRYIMPL_H
00022 #define KDE_SLP_RFCREGISTRYIMPL_H
00023 
00024 #include <kde/slp/registryimpl.h>
00025 #include <qvaluevector.h>
00026 #include <slp.h>
00027 
00028 class QCustomEvent;
00029 
00030 namespace KDE {
00031 namespace SLP {
00032 
00033 
00040 class RFCRegistryImpl : public RegistryImpl {
00041         Q_OBJECT
00042 
00043 private:
00044         QString m_language;
00045         bool m_allowAnyLanguage;
00046 
00047         bool m_syncOpSuccess; // state for synchronous callbacks ([un]register)
00048 
00049         QValueList<SLPHandle> m_freeHandles;
00050         QValueList<SLPHandle> m_usedHandles;
00051         QStringList m_autoDeregisterServices;
00052 
00053         SLPHandle getHandle();
00054         void returnHandle(SLPHandle h);
00055         bool callbackError(const QString &reason, SLPError e);
00056         static void callbackSLPRegReport(SLPHandle,
00057                                          SLPError errcode,
00058                                          void *cookie);
00059 protected:
00060         virtual void customEvent(QCustomEvent *ce);
00061 
00062         bool findServiceTypesInternal(const QString &token,
00063                               const QString &namingAuthority,
00064                               const QStringList &scopeList,
00065                               bool async);
00066         bool findServicesInternal(const QString &token,
00067                                const QString &srvtype,
00068                                bool fetchAttributes,
00069                                const KDE::SLP::Filter::List &filters,
00070                                const QString &scopelist,
00071                                bool async);
00072         bool findAttributesInternal(const QString &token,
00073                                  const QString &serviceUrl,
00074                                  const QStringList &attributeIds,
00075                                  bool async);
00076         bool findScopesInternal(const QString &token,
00077                                 bool async);
00078 
00079 public:
00080         RFCRegistryImpl(const QString &language,
00081                         bool allowAnyLanguage);
00082         ~RFCRegistryImpl();
00083 
00084         // translates error code
00085         QString getError(SLPError e);
00086         bool error(const QString &msg, SLPError e);
00087         virtual bool available() const;
00088         virtual bool supportsAutoAddress() const;
00089         virtual bool registerService(const KDE::SLP::Service &service,
00090                       bool autoAddress,
00091                       bool autoDeregister,
00092                       const QStringList &scopes,
00093                       unsigned short lifetime,
00094                       bool autoLifetimeExtension,
00095                       const QString &language);
00096         virtual bool deregister(const QString &serviceURL);
00097         virtual bool deregister(const KDE::SLP::Service &service);
00098         virtual bool findServiceTypes(const QString &token,
00099                               const QString &namingAuthority,
00100                               const QStringList &scopeList,
00101                               const QString &language,
00102                               bool allowAnyLanguage);
00103         virtual bool findServiceTypesAsync(const QString &token,
00104                               const QString &namingAuthority,
00105                               const QStringList &scopeList,
00106                               const QString &language,
00107                               bool allowAnyLanguage);
00108         virtual bool findServices(const QString &token,
00109                           const QString &srvtype,
00110                           bool fetchAttributes,
00111                           const KDE::SLP::Filter::List &filters,
00112                           const QString &scopelist,
00113                           const QString &language,
00114                           bool allowAnyLanguage);
00115         virtual bool findServicesAsync(const QString &token,
00116                                const QString &srvtype,
00117                                bool fetchAttributes,
00118                                const KDE::SLP::Filter::List &filters,
00119                                const QString &scopelist,
00120                                const QString &language,
00121                                bool allowAnyLanguage);
00122         virtual bool findAttributes(const QString &token,
00123                             const QString &serviceUrl,
00124                             const QStringList &attributeIds,
00125                             const QString &language,
00126                             bool allowAnyLanguage);
00127         virtual bool findAttributesAsync(const QString &token,
00128                                  const QString &serviceUrl,
00129                                  const QStringList &attributeIds,
00130                                  const QString &language,
00131                                  bool allowAnyLanguage);
00132         virtual bool findScopes(const QString &token,
00133                         const QString &language,
00134                         bool allowAnyLanguage);
00135         virtual bool findScopesAsync(const QString &token,
00136                             const QString &language,
00137                             bool allowAnyLanguage);
00138 
00139  signals:
00140         void foundServiceTypes(QString token, QStringList serviceTypes);
00141         void foundService(QString token,
00142                           KDE::SLP::Service service,
00143                           int lifetime);
00144         void foundAttributes(QString token,
00145                              KDE::SLP::Service service);
00146         void foundScopes(QString token,
00147                          QStringList scopeList);
00148         void operationFinished(QString token, bool success, QString msg);
00149 };
00150 
00151 }
00152 }
00153 
00154 #endif

Generated on Tue Jun 24 20:14:35 2003 for KDE::SLP by doxygen1.2.18