nexus: Rollup update for nexus
nexus: Change field separator from : to ' '
Signed-off-by: San Mehat <san@google.com>
nexus: Add some prototypes for stuff to come
Signed-off-by: San Mehat <san@google.com>
nexus: Add some TODOs
Signed-off-by: San Mehat <san@google.com>
libsysutils: Put a proper token parser into the FrameworkListener which
supports minimal \ escapes and quotes
Signed-off-by: San Mehat <san@google.com>
nexus: Fix a lot of bugs
Signed-off-by: San Mehat <san@google.com>
libsysutils: Remove some debugging
Signed-off-by: San Mehat <san@google.com>
nexus: Send broadcasts for supplicant state changes
Signed-off-by: San Mehat <san@google.com>
nexus: Plumb DHCP listener state changes to NetworkManager
Signed-off-by: San Mehat <san@google.com>
nexus: Make the SupplicantState strings more parsable
Signed-off-by: San Mehat <san@google.com>
nexus: Broadcast a message when dhcp state changes.
Signed-off-by: San Mehat <san@google.com>
nexus: Add a few new response codes
Signed-off-by: San Mehat <san@google.com>
nexus: Rename ErrorCode -> ResponseCode
Signed-off-by: San Mehat <san@google.com>
nexus: Add DHCP event broadcasting. Also adds the framework for
tracking supplicant 'searching-for-AP' state
Signed-off-by: San Mehat <san@google.com>
nexus: REmove WifiScanner
Signed-off-by: San Mehat <san@google.com>
nexus: Change the way scanning works. scanmode can now be selected
independantly of triggering a scan. Also adds rxfilter support
Signed-off-by: San Mehat <san@google.com>
nexus: Add support for configuring bluetooth coexistence scanning and modes
Signed-off-by: San Mehat <san@google.com>
nexus: use case insensitive match for property names
Signed-off-by: San Mehat <san@google.com>
nexus: Rollup of a bunch of stuff:
- 'list' command now takes an argument to match against
- InterfaceConfig has been moved into the Controller base (for now)
- DhcpClient now has some rudimentry locking
- process 'ADDRINFO' messages from dhcpcd
- Drop tertiary dns
Signed-off-by: San Mehat <san@google.com>
nexus: Clean up some of the supplicant variable parsing and add 'wifi.current'
Signed-off-by: San Mehat <san@google.com>
nexus: Add driver-stop/start, initial suspend support
Signed-off-by: San Mehat <san@google.com>
nexus: Add Controller suspend/resume callbacks, as well as locking
Signed-off-by: San Mehat <san@google.com>
nexus: Make ARP probing configurable for DhcpClient
Signed-off-by: San Mehat <san@google.com>
nexus: Add linkspeed / rssi retrieval
Signed-off-by: San Mehat <san@google.com>
nexus: Add WifiStatusPoller to track RSSI/linkspeed when associated
Signed-off-by: San Mehat <san@google.com>
nexus: Disable some debugging and add 'wifi.netcount' property
Signed-off-by: San Mehat <san@google.com>
nexus: Replace the hackish property system with something more flexible with namespaces
Signed-off-by: San Mehat <san@google.com>
libsysutils: Fix a few bugs in SocketListener
Signed-off-by: San Mehat <san@google.com>
nexus: PropertyManager: Add array support
Signed-off-by: San Mehat <san@google.com>
nexus: Clean up properties
Signed-off-by: San Mehat <san@google.com>
nexus: WifiController: Change name of 'CurrentNetwork' property
Signed-off-by: San Mehat <san@google.com>
diff --git a/nexus/WifiNetwork.h b/nexus/WifiNetwork.h
index c2f5d23..15ec647 100644
--- a/nexus/WifiNetwork.h
+++ b/nexus/WifiNetwork.h
@@ -21,6 +21,10 @@
#include <utils/List.h>
+#include "Property.h"
+
+class PropertyManager;
+
class KeyManagementMask {
public:
static const uint32_t UNKNOWN = 0;
@@ -60,19 +64,140 @@
};
class Supplicant;
-class InterfaceConfig;
class Controller;
class WifiController;
-#include "IPropertyProvider.h"
+class WifiNetwork {
+ class WifiNetworkIntegerProperty : public IntegerProperty {
+ protected:
+ WifiNetwork *mWn;
+ public:
+ WifiNetworkIntegerProperty(WifiNetwork *wn, const char *name, bool ro,
+ int elements);
+ virtual ~WifiNetworkIntegerProperty() {}
+ virtual int set(int idx, int value) = 0;
+ virtual int get(int idx, int *buffer) = 0;
+ };
+ friend class WifiNetwork::WifiNetworkIntegerProperty;
-class WifiNetwork : public IPropertyProvider{
-public:
- static const char *PropertyNames[];
+ class WifiNetworkStringProperty : public StringProperty {
+ protected:
+ WifiNetwork *mWn;
+ public:
+ WifiNetworkStringProperty(WifiNetwork *wn, const char *name, bool ro,
+ int elements);
+ virtual ~WifiNetworkStringProperty() {}
+ virtual int set(int idx, const char *value) = 0;
+ virtual int get(int idx, char *buffer, size_t max) = 0;
+ };
+ friend class WifiNetwork::WifiNetworkStringProperty;
+
+ class WifiNetworkEnabledProperty : public WifiNetworkIntegerProperty {
+ public:
+ WifiNetworkEnabledProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkEnabledProperty() {};
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiNetworkPriorityProperty : public WifiNetworkIntegerProperty {
+ public:
+ WifiNetworkPriorityProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkPriorityProperty() {};
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiNetworkDefaultKeyIndexProperty : public WifiNetworkIntegerProperty {
+ public:
+ WifiNetworkDefaultKeyIndexProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkDefaultKeyIndexProperty() {};
+ int set(int idx, int value);
+ int get(int idx, int *buffer);
+ };
+
+ class WifiNetworkSsidProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkSsidProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkSsidProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkBssidProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkBssidProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkBssidProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkPskProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkPskProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkPskProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkKeyManagementProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkKeyManagementProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkKeyManagementProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkAuthAlgorithmsProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkAuthAlgorithmsProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkAuthAlgorithmsProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkProtocolsProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkProtocolsProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkProtocolsProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkWepKeyProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkWepKeyProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkWepKeyProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkPairwiseCiphersProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkPairwiseCiphersProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkPairwiseCiphersProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkGroupCiphersProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkGroupCiphersProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkGroupCiphersProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
+
+ class WifiNetworkHiddenSsidProperty : public WifiNetworkStringProperty {
+ public:
+ WifiNetworkHiddenSsidProperty(WifiNetwork *wn);
+ virtual ~WifiNetworkHiddenSsidProperty() {};
+ int set(int idx, const char *value);
+ int get(int idx, char *buffer, size_t max);
+ };
private:
Supplicant *mSuppl;
- InterfaceConfig *mIfaceCfg;
WifiController *mController;
/*
@@ -128,33 +253,49 @@
/*
* The set of key management protocols supported by this configuration.
*/
- uint32_t mAllowedKeyManagement;
+ uint32_t mKeyManagement;
/*
* The set of security protocols supported by this configuration.
*/
- uint32_t mAllowedProtocols;
+ uint32_t mProtocols;
/*
* The set of authentication protocols supported by this configuration.
*/
- uint32_t mAllowedAuthAlgorithms;
+ uint32_t mAuthAlgorithms;
/*
* The set of pairwise ciphers for WPA supported by this configuration.
*/
- uint32_t mAllowedPairwiseCiphers;
+ uint32_t mPairwiseCiphers;
/*
* The set of group ciphers for WPA supported by this configuration.
*/
- uint32_t mAllowedGroupCiphers;
+ uint32_t mGroupCiphers;
/*
* Set if this Network is enabled
*/
bool mEnabled;
+ char *mPropNamespace;
+ struct {
+ WifiNetworkEnabledProperty *propEnabled;
+ WifiNetworkSsidProperty *propSsid;
+ WifiNetworkBssidProperty *propBssid;
+ WifiNetworkPskProperty *propPsk;
+ WifiNetworkWepKeyProperty *propWepKey;
+ WifiNetworkDefaultKeyIndexProperty *propDefKeyIdx;
+ WifiNetworkPriorityProperty *propPriority;
+ WifiNetworkKeyManagementProperty *propKeyManagement;
+ WifiNetworkProtocolsProperty *propProtocols;
+ WifiNetworkAuthAlgorithmsProperty *propAuthAlgorithms;
+ WifiNetworkPairwiseCiphersProperty *propPairwiseCiphers;
+ WifiNetworkGroupCiphersProperty *propGroupCiphers;
+ WifiNetworkHiddenSsidProperty *propHiddenSsid;
+ } mStaticProperties;
private:
WifiNetwork();
@@ -165,8 +306,8 @@
virtual ~WifiNetwork();
WifiNetwork *clone();
- int registerProperties();
- int unregisterProperties();
+ int attachProperties(PropertyManager *pm, const char *nsName);
+ int detachProperties(PropertyManager *pm, const char *nsName);
int getNetworkId() { return mNetid; }
const char *getSsid() { return mSsid; }
@@ -176,19 +317,14 @@
int getDefaultKeyIndex() { return mDefaultKeyIndex; }
int getPriority() { return mPriority; }
const char *getHiddenSsid() { return mHiddenSsid; }
- uint32_t getAllowedKeyManagement() { return mAllowedKeyManagement; }
- uint32_t getAllowedProtocols() { return mAllowedProtocols; }
- uint32_t getAllowedAuthAlgorithms() { return mAllowedAuthAlgorithms; }
- uint32_t getAllowedPairwiseCiphers() { return mAllowedPairwiseCiphers; }
- uint32_t getAllowedGroupCiphers() { return mAllowedGroupCiphers; }
+ uint32_t getKeyManagement() { return mKeyManagement; }
+ uint32_t getProtocols() { return mProtocols; }
+ uint32_t getAuthAlgorithms() { return mAuthAlgorithms; }
+ uint32_t getPairwiseCiphers() { return mPairwiseCiphers; }
+ uint32_t getGroupCiphers() { return mGroupCiphers; }
bool getEnabled() { return mEnabled; }
Controller *getController() { return (Controller *) mController; }
- int set(const char *name, const char *value);
- const char *get(const char *name, char *buffer, size_t maxsize);
-
- InterfaceConfig *getIfaceCfg() { return mIfaceCfg; }
-
int setEnabled(bool enabled);
int setSsid(const char *ssid);
int setBssid(const char *bssid);
@@ -197,14 +333,22 @@
int setDefaultKeyIndex(int idx);
int setPriority(int pri);
int setHiddenSsid(const char *ssid);
- int setAllowedKeyManagement(uint32_t mask);
- int setAllowedProtocols(uint32_t mask);
- int setAllowedAuthAlgorithms(uint32_t mask);
- int setAllowedPairwiseCiphers(uint32_t mask);
- int setAllowedGroupCiphers(uint32_t mask);
+ int setKeyManagement(uint32_t mask);
+ int setProtocols(uint32_t mask);
+ int setAuthAlgorithms(uint32_t mask);
+ int setPairwiseCiphers(uint32_t mask);
+ int setGroupCiphers(uint32_t mask);
// XXX:Should this really be exposed?.. meh
int refresh();
+
+private:
+ int parseKeyManagementMask(const char *buffer, uint32_t *mask);
+ int parseProtocolsMask(const char *buffer, uint32_t *mask);
+ int parseAuthAlgorithmsMask(const char *buffer, uint32_t *mask);
+ int parsePairwiseCiphersMask(const char *buffer, uint32_t *mask);
+ int parseGroupCiphersMask(const char *buffer, uint32_t *mask);
+ void createProperties();
};
typedef android::List<WifiNetwork *> WifiNetworkCollection;