kio Library: httpfilter.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# httpfilter.h

    00001 /*
    00002    This file is part of the KDE libraries
    00003    Copyright (c) 2002 Waldo Bastian <bastian@kde.org>
    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 version 2 as published by the Free Software Foundation.
    00008
    00009    This library is distributed in the hope that it will be useful,
    00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012    Library General Public License for more details.
    00013
    00014    You should have received a copy of the GNU Library General Public License
    00015    along with this library; see the file COPYING.LIB.  If not, write to
    00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #ifndef _HTTPFILTER_H_
    00021 #define _HTTPFILTER_H_
    00022
    00023 #include <config.h>
    00024
    00025 #ifdef HAVE_LIBZ
    00026 #define DO_GZIP
    00027 #endif
    00028
    00029 #ifdef DO_GZIP
    00030 #include <zlib.h>
    00031 #endif
    00032
    00033 #include <qobject.h>
    00034 #include <kmdcodec.h>
    00035
    00036 class HTTPFilterBase : public QObject
    00037 {
    00038     Q_OBJECT
    00039 public:
    00040     HTTPFilterBase();
    00041     ~HTTPFilterBase();
    00042
    00043     void chain(HTTPFilterBase *previous);
    00044
    00045 public slots:
    00046     virtual void slotInput(const QByteArray &d) = 0;
    00047
    00048 signals:
    00049     void output(const QByteArray &d);
    00050     void error(int, const QString &);
    00051
    00052 protected:
    00053     HTTPFilterBase *last;
    00054 };
    00055
    00056 class HTTPFilterChain : public HTTPFilterBase
    00057 {
    00058     Q_OBJECT
    00059 public:
    00060     HTTPFilterChain();
    00061
    00062     void addFilter(HTTPFilterBase *filter);
    00063
    00064 public slots:
    00065     void slotInput(const QByteArray &d);
    00066
    00067 private:
    00068     HTTPFilterBase *first;
    00069 };
    00070
    00071 class HTTPFilterMD5 : public HTTPFilterBase
    00072 {
    00073     Q_OBJECT
    00074 public:
    00075     HTTPFilterMD5();
    00076
    00077     QString md5();
    00078
    00079 public slots:
    00080     void slotInput(const QByteArray &d);
    00081
    00082 private:
    00083     KMD5 context;
    00084 };
    00085
    00086
    00087 class HTTPFilterGZip : public HTTPFilterBase
    00088 {
    00089     Q_OBJECT
    00090 public:
    00091     HTTPFilterGZip();
    00092     ~HTTPFilterGZip();
    00093
    00094 public slots:
    00095     void slotInput(const QByteArray &d);
    00096
    00097 protected:
    00098     int get_byte();
    00099     int checkHeader();
    00100 #ifdef DO_GZIP
    00101     z_stream zstr;
    00102     bool bEof : 1;
    00103     bool bHasHeader : 1;
    00104     bool bHasFinished : 1;
    00105     bool bPlainText : 1;
    00106     bool bEatTrailer : 1;
    00107     QByteArray headerData;
    00108     int iTrailer;
    00109 #endif
    00110 };
    00111
    00112 class HTTPFilterDeflate : public HTTPFilterGZip
    00113 {
    00114     Q_OBJECT
    00115 public:
    00116     HTTPFilterDeflate();
    00117 };
    00118
    00119 #endif

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:53 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003