diff options
Diffstat (limited to 'nexus/Supplicant.h')
-rw-r--r-- | nexus/Supplicant.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/nexus/Supplicant.h b/nexus/Supplicant.h new file mode 100644 index 0000000..46a9e86 --- /dev/null +++ b/nexus/Supplicant.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _SUPPLICANT_H +#define _SUPPLICANT_H + +struct wpa_ctrl; +class SupplicantListener; +class SupplicantEvent; + +#include <pthread.h> + +#include "ScanResult.h" + +class Supplicant { +private: + struct wpa_ctrl *mCtrl; + struct wpa_ctrl *mMonitor; + SupplicantListener *mListener; + int mState; + + ScanResultCollection *mLatestScanResults; + pthread_mutex_t mLatestScanResultsLock; + +public: + Supplicant(); + virtual ~Supplicant() {} + + virtual int start(); + virtual int stop(); + virtual bool isStarted(); + + virtual int triggerScan(bool active); + + int getState() { return mState; } + + const ScanResultCollection *getLatestScanResults(); + +// XXX: Extract these into an interface +public: + virtual int onConnectedEvent(SupplicantEvent *evt); + virtual int onDisconnectedEvent(SupplicantEvent *evt); + virtual int onTerminatingEvent(SupplicantEvent *evt); + virtual int onPasswordChangedEvent(SupplicantEvent *evt); + virtual int onEapNotificationEvent(SupplicantEvent *evt); + virtual int onEapStartedEvent(SupplicantEvent *evt); + virtual int onEapMethodEvent(SupplicantEvent *evt); + virtual int onEapSuccessEvent(SupplicantEvent *evt); + virtual int onEapFailureEvent(SupplicantEvent *evt); + virtual int onScanResultsEvent(SupplicantEvent *evt); + virtual int onStateChangeEvent(SupplicantEvent *evt); + virtual int onLinkSpeedEvent(SupplicantEvent *evt); + virtual int onDriverStateEvent(SupplicantEvent *evt); + +private: + int connectToSupplicant(); + int sendCommand(const char *cmd, char *reply, size_t *reply_len); +}; + +#endif |