KDECore
klocalsocket_p.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (C) 2007 Thiago Macieira <thiago@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 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., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef KLOCALSOCKET_P_H 00021 #define KLOCALSOCKET_P_H 00022 00023 #include <QtCore/QString> 00024 #include <QtCore/QQueue> 00025 #include "klocalsocket.h" 00026 #define MIN_SOCKADDR_UN_LEN (sizeof(quint16) + sizeof(char)) 00027 00028 class QSocketNotifier; 00029 00030 class KLocalSocketPrivate 00031 { 00032 public: 00033 KLocalSocket * const q; 00034 KLocalSocketPrivate(KLocalSocket *qq) 00035 : q(qq), type(KLocalSocket::UnknownLocalSocketType) 00036 { } 00037 00038 QString localPath; 00039 QString peerPath; 00040 KLocalSocket::LocalSocketType type; 00041 00042 void connectToPath(const QString &path, KLocalSocket::LocalSocketType type, 00043 QAbstractSocket::OpenMode openMode); 00044 00045 void emitError(QAbstractSocket::SocketError, const QString &errorString); 00046 00047 static inline KLocalSocketPrivate *d(KLocalSocket *aq) 00048 { return aq->d; } 00049 }; 00050 00051 class KLocalSocketServerPrivate 00052 { 00053 public: 00054 KLocalSocketServer * const q; 00055 KLocalSocketServerPrivate(KLocalSocketServer *qq); 00056 00057 int descriptor; 00058 int maxPendingConnections; 00059 QAbstractSocket::SocketState state; 00060 QAbstractSocket::SocketError error; 00061 KLocalSocket::LocalSocketType type; 00062 QString localPath; 00063 QString errorString; 00064 00065 QSocketNotifier *readNotifier; 00066 QQueue<KLocalSocket *> pendingConnections; 00067 00068 bool listen(const QString &path, KLocalSocket::LocalSocketType type); 00069 void close(); 00070 bool waitForNewConnection(int msec, bool *timedOut); 00071 bool processSocketActivity(); 00072 void _k_newConnectionActivity(); 00073 void emitError(QAbstractSocket::SocketError, const QString &errorString); 00074 }; 00075 00076 #endif
KDE 4.6 API Reference