blob: c982ace7be86afc5191adece2a2cb713725692af [file] [log] [blame]
Dmitry Shmidt5af38c32010-02-10 11:10:39 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _SOFTAP_CONTROLLER_H
18#define _SOFTAP_CONTROLLER_H
19
20#include <linux/in.h>
Dmitry Shmidt84c65a62010-03-03 13:14:30 -080021#include <net/if.h>
Dmitry Shmidt5af38c32010-02-10 11:10:39 -080022
Nalla Kartheekcad2dc82016-08-31 12:26:14 +053023#include <sysutils/SocketListener.h>
24#include <sys/socket.h>
25
Dmitry Shmidt84c65a62010-03-03 13:14:30 -080026#define SOFTAP_MAX_BUFFER_SIZE 4096
Dmitry Shmidta1659132010-04-23 12:43:32 -070027#define AP_BSS_START_DELAY 200000
Dmitry Shmidt3df450a2010-03-18 13:06:47 -070028#define AP_BSS_STOP_DELAY 500000
29#define AP_SET_CFG_DELAY 500000
Dmitry Shmidt587d6232011-08-01 15:33:18 -070030#define AP_DRIVER_START_DELAY 800000
Dmitry Shmidt85e6c5f2013-06-10 14:35:43 -070031#define AP_CHANNEL_DEFAULT 6
Dmitry Shmidt5af38c32010-02-10 11:10:39 -080032
Dmitry Shmidt84c65a62010-03-03 13:14:30 -080033class SoftapController {
Dmitry Shmidt5af38c32010-02-10 11:10:39 -080034public:
35 SoftapController();
36 virtual ~SoftapController();
37
Nalla Kartheekb9210a72016-11-17 09:56:14 +053038 int startSoftap(bool global_ctrl_iface, SocketClient *socketClient, const char *iface);
Dmitry Shmidt5af38c32010-02-10 11:10:39 -080039 int stopSoftap();
40 bool isSoftapStarted();
41 int setSoftap(int argc, char *argv[]);
Dmitry Shmidt31fd6c52010-03-12 10:01:58 -080042 int fwReloadSoftap(int argc, char *argv[]);
Sasha Levitskiy25753d52013-01-10 12:48:39 -080043private:
Nalla Kartheeka4c1b662016-09-14 15:48:34 +053044 SocketClient *mSocketClient;
Nalla Kartheekcad2dc82016-08-31 12:26:14 +053045#ifdef LIBWPA_CLIENT_EXISTS
46 pthread_t mThread;
47 int mThreadErr;
48 bool mHostapdFlag;
Nalla Kartheekcad2dc82016-08-31 12:26:14 +053049#endif
Sasha Levitskiy25753d52013-01-10 12:48:39 -080050 pid_t mPid;
Adam Langley986d0972015-11-04 14:35:25 -080051 bool generatePsk(char *ssid, char *passphrase, char *psk);
Nalla Kartheekcad2dc82016-08-31 12:26:14 +053052#ifdef LIBWPA_CLIENT_EXISTS
53 static void *threadStart(void *obj);
54#endif
Dmitry Shmidt5af38c32010-02-10 11:10:39 -080055};
56
57#endif