/*
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Peter Hofer <ph@desktopbsd.net>
 *         (C) 2004, 2005
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */

#ifndef __NETWORKS_H
#define __NETWORKS_H

#include <lan.h>
#include <wlan.h>

#include <qmap.h>

class QString;
class QSettings;

#define  SETTINGS_WIRELESS  "/wireless"
#define  SETTINGS_NETWORKS  "/networks"

#define	WLAN_TEMPLATE	"/wlan_template"
#define	LAN_TEMPLATE	"/lan_template"

/** @brief Manages stored LAN and WLAN connection profiles. */
class Networks {
public:
   static void  load();
   static void  save();

   static LAN   *getLAN(const QString &);
   static WLAN  *getWLAN(const QString &);

   static QMap<QString, LAN *>  allLANs();
   static QMap<QString,  WLAN *>  allWLANs();

   static LAN   *getLANTemplate();
   static WLAN  *getWLANTemplate();


   static bool  addLAN(const QString & name, LAN *lan);
   static bool  addWLAN(const QString & name, WLAN *wlan);

   static void  removeLAN(const QString & name);
   static void  removeWLAN(const QString & name);

private:
   static void  removeEntries(QSettings &,  QString);

   static QMap<QString, LAN *>   networks;
   static QMap<QString, WLAN *>  wirelessNetworks;

   static LAN   *lanTemplate;
   static WLAN  *wlanTemplate;
};

#endif /* __NETWORKS_H */
