netinterface.h

00001 /*
00002  * Copyright (C) 2006  Justin Karneges
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
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  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301  USA
00018  *
00019  */
00020 
00021 #ifndef NETINTERFACE_H
00022 #define NETINTERFACE_H
00023 
00024 #include "irisnetglobal.h"
00025 
00026 namespace XMPP {
00027 
00028 class NetInterfaceManager;
00029 class NetInterfacePrivate;
00030 class NetInterfaceManagerPrivate;
00031 
00054 class IRISNET_EXPORT NetInterface : public QObject
00055 {
00056         Q_OBJECT
00057 public:
00065         NetInterface(const QString &id, NetInterfaceManager *manager);
00066 
00070         ~NetInterface();
00071 
00077         bool isValid() const;
00078 
00084         QString id() const;
00085 
00093         QString name() const;
00094 
00100         QList<QHostAddress> addresses() const;
00101 
00107         QHostAddress gateway() const; // optional
00108 
00109 signals:
00119         void unavailable();
00120 
00121 private:
00122         friend class NetInterfacePrivate;
00123         NetInterfacePrivate *d;
00124 
00125         friend class NetInterfaceManagerPrivate;
00126 };
00127 
00153 class IRISNET_EXPORT NetInterfaceManager : public QObject
00154 {
00155         Q_OBJECT
00156 public:
00160         NetInterfaceManager(QObject *parent = 0);
00161 
00165         ~NetInterfaceManager();
00166 
00173         QStringList interfaces() const;
00174 
00188         static QString interfaceForAddress(const QHostAddress &a);
00189 
00190 signals:
00196         void interfaceAvailable(const QString &id);
00197 
00198 private:
00199         friend class NetInterfaceManagerPrivate;
00200         NetInterfaceManagerPrivate *d;
00201 
00202         friend class NetInterface;
00203         friend class NetInterfacePrivate;
00204 
00205         void *reg(const QString &id, NetInterface *i);
00206         void unreg(NetInterface *i);
00207 };
00208 
00209 }
00210 
00211 #endif

Generated on Sun Mar 18 17:58:50 2007 for IrisNet by  doxygen 1.4.6