From af20635a2bb11eefabb627a2419644d3ac78831d Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 4 Sep 2010 17:53:12 +0000 Subject: Added networkstatus service from pim to core for use in other network enabled applications git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171617 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- networkstatus/network.h | 73 +++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 33 deletions(-) (limited to 'networkstatus/network.h') diff --git a/networkstatus/network.h b/networkstatus/network.h index dd6a75561..dcd2cd339 100644 --- a/networkstatus/network.h +++ b/networkstatus/network.h @@ -1,9 +1,12 @@ -/* This file is part of kdepim. - Copyright (C) 2005,2007 Will Stephenson +/* + This file is part of kdepim. + + Copyright (c) 2005 Will Stephenson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,50 +14,54 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License - along with this library. If not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - As a special exception, permission is given to link this library - with any edition of TQt, and distribute the resulting executable, - without including the source code for TQt in the source distribution. */ #ifndef NETWORKSTATUS_NETWORK_H #define NETWORKSTATUS_NETWORK_H +#include +#include #include "networkstatuscommon.h" +struct NetworkUsageStruct +{ + TQCString appId; + TQString host; +}; + +typedef TQValueList< NetworkUsageStruct > NetworkUsageList; + class Network { public: - Network( const TQString name ); - Network( NetworkStatus::Properties properties ); - /** - * Update the status of this network - */ - void setStatus( NetworkStatus::Status status ); - /** - * The connection status of this network - */ - NetworkStatus::Status status(); - /** - * The name of this network - */ - TQString name(); - void setName( const TQString& name ); - /** - * Returns the service owning this network - */ - TQString service(); - void setService( const TQString& service ); + Network( const TQString name, NetworkStatus::Properties properties ); + Network( const Network & other ); + NetworkStatus::EnumStatus reachabilityFor( const TQString & host ); + void registerUsage( const TQCString appId, const TQString host ); + void unregisterUsage( const TQCString appId, const TQString host ); + void setStatus( NetworkStatus::EnumStatus status ); + + void removeAllUsage(); + NetworkStatus::EnumStatus status() { return m_status; } + TQString name() { return m_name; } + bool internet() { return m_internet; } + TQStringList netmasks() { return m_netmasks; } + TQCString service() { return m_service; } + NetworkStatus::EnumOnDemandPolicy onDemandPolicy() { return m_onDemandPolicy; } + NetworkUsageList usage() { return m_usage; } + private: - Network( const Network & ); + NetworkStatus::EnumStatus m_status; TQString m_name; - NetworkStatus::Status m_status; - TQString m_service; + bool m_internet; + TQStringList m_netmasks; + TQCString m_service; + NetworkStatus::EnumOnDemandPolicy m_onDemandPolicy; + NetworkUsageList m_usage; }; #endif -// vim: sw=4 ts=4 -- cgit v1.2.1