//
//     Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2007 Jim Bublitz also apply

//                 Generated by twine

// This file is part of PyKDE4.

// PyKDE4 is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.

// PyKDE4 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, see <http://www.gnu.org/licenses/>.


class KLocalSocket : QTcpSocket
{
%TypeHeaderCode
#include <klocalsocket.h>
%End


public:

    enum LocalSocketType
    {
        UnixSocket,
        AbstractUnixSocket,
        UnknownLocalSocketType
    };

    explicit                KLocalSocket (QObject* parent /TransferThis/ = 0);
    void                    connectToPath (const QString& path, QIODevice::OpenMode mode = QIODevice::ReadWrite);
    void                    connectToPath (const QString& path, KLocalSocket::LocalSocketType type, QIODevice::OpenMode mode = QIODevice::ReadWrite);
    void                    disconnectFromPath ();
    KLocalSocket::LocalSocketType  localSocketType () const;
    QString                 localPath () const;
    QString                 peerPath () const;

protected:
    void                    connectToHostImplementation (const QString& hostName, quint16 port, QIODevice::OpenMode mode);
    void                    disconnectFromHostImplementation ();

private:
                            KLocalSocket (const KLocalSocket&);
};   // KLocalSocket


class KLocalSocketServer : QObject
{
%TypeHeaderCode
#include <klocalsocket.h>
%End


public:
    explicit                KLocalSocketServer (QObject* parent /TransferThis/ = 0);
    bool                    listen (const QString& path, KLocalSocket::LocalSocketType type = KLocalSocket::UnixSocket);
    void                    close ();
    bool                    isListening () const;
    void                    setMaxPendingConnections (int numConnections);
    int                     maxPendingConnections () const;
    KLocalSocket::LocalSocketType  localSocketType () const;
    QString                 localPath () const;
    bool                    waitForNewConnection (int msec = 0, bool* timedOut /Out/ = 0);
    virtual bool            hasPendingConnections () const;
    virtual KLocalSocket*   nextPendingConnection ();
    QAbstractSocket::SocketError  serverError () const;
    QString                 errorString () const;

protected:
    virtual void            incomingConnection (int handle);

signals:
    void                    newConnection ();

private:
                            KLocalSocketServer (const KLocalSocketServer&);
};   // KLocalSocketServer


