haiku/src/servers/net/Settings.h
Michael Lotz 7d7b963225 * Remove the BNetworkDevice::AddPersistentNetwork() again and instead introduce
BNetworkRoster::{Count|GetNext|Add|Remove}PersistentNetwork() as it fits
  better (thanks Philippe for the heads up).
* Implement the backend for these functions in the net_server and also move
  conversion of the wireless_network based format into the settings based format
  there.
* Implement removal of a network from the settings and make adding a new network
  with the same name replace the old one instead of just adding multiple ones.
  Might need to change this in the future depending on how we want to handle
  multiple networks with the same name (i.e. distinguish based on BSSID or
  similar).
* Fix apparent oversight that caused configured networks _not_ to be used in the
  auto join attempt.
* Remove auto joining open networks. I've been bitten by that more than once now
  because we happen to have an open network in the neighbourhood that I now
  accidentally used to transfer quite a bit of (unencrypted) stuff before
  noticing... In the future, one will instead have to explicitly join an open
  network once and store that config. Note that the driver will actually still
  auto-associate with open networks due to how things are set up currently.
  Note also that the auto join will fire join requests whenever there's a
  disassociation event, so you might see spurious join dialogs when the
  wpa_supplicant actually just re-establishes the connection.
* Make join requests async again. Instead of waiting for a synchronous reply of
  the wpa_supplicant we instead return success when the request has been sent.
  While the API call might still be made synchronous again in the future, the
  net_server should really not block on an external application. In the case of
  the wpa_supplicant we would otherwise deadlock when using the new
  *PersistentNetwork() API after a successful join, and in other cases we might
  just unacceptably delay other calls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42816 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-10-09 19:56:19 +00:00

104 lines
3.0 KiB
C++

/*
* Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include <driver_settings.h>
#include <Message.h>
#include <Messenger.h>
class BPath;
struct settings_template;
class Settings {
public:
Settings();
~Settings();
status_t GetNextInterface(uint32& cookie,
BMessage& interface);
int32 CountNetworks() const;
status_t GetNextNetwork(uint32& cookie,
BMessage& network) const;
status_t AddNetwork(const BMessage& network);
status_t RemoveNetwork(const char* name);
status_t GetNextService(uint32& cookie,
BMessage& service);
const BMessage& Services() const;
status_t StartMonitoring(const BMessenger& target);
status_t StopMonitoring(const BMessenger& target);
status_t Update(BMessage* message);
private:
status_t _Load(const char* name = NULL,
uint32* _type = NULL);
status_t _Save(const char* name = NULL);
status_t _GetPath(const char* name, BPath& path);
status_t _StartWatching(const char* name,
const BMessenger& target);
const settings_template* _FindSettingsTemplate(
const settings_template* settingsTemplate,
const char* name);
const settings_template* _FindParentValueTemplate(
const settings_template* settingsTemplate);
status_t _AddParameter(const driver_parameter& parameter,
const char* name, uint32 type,
BMessage& message);
status_t _ConvertFromDriverParameter(
const driver_parameter& parameter,
const settings_template* settingsTemplate,
BMessage& message);
status_t _ConvertFromDriverSettings(
const driver_settings& settings,
const settings_template* settingsTemplate,
BMessage& message);
status_t _ConvertFromDriverSettings(const char* path,
const settings_template* settingsTemplate,
BMessage& message);
status_t _AppendSettings(
const settings_template* settingsTemplate,
BString& settings, const BMessage& message,
const char* name, type_code type,
int32 count,
const char* settingName = NULL);
status_t _ConvertToDriverSettings(
const settings_template* settingsTemplate,
BString& settings, const BMessage& message);
status_t _ConvertToDriverSettings(const char* path,
const settings_template* settingsTemplate,
const BMessage& message);
bool _IsWatching(const BMessenger& target) const
{ return fListener == target; }
bool _IsWatching() const
{ return fListener.IsValid(); }
private:
BMessenger fListener;
BMessage fInterfaces;
BMessage fNetworks;
BMessage fServices;
};
static const uint32 kMsgInterfaceSettingsUpdated = 'SUif';
static const uint32 kMsgServiceSettingsUpdated = 'SUsv';
#endif // SETTINGS_H