15af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt/* 25af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * Copyright (C) 2008 The Android Open Source Project 35af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * 45af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * Licensed under the Apache License, Version 2.0 (the "License"); 55af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * you may not use this file except in compliance with the License. 65af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * You may obtain a copy of the License at 75af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * 85af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * http://www.apache.org/licenses/LICENSE-2.0 95af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * 105af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * Unless required by applicable law or agreed to in writing, software 115af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * distributed under the License is distributed on an "AS IS" BASIS, 125af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * See the License for the specific language governing permissions and 145af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt * limitations under the License. 155af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt */ 165af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 175af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt#ifndef _SOFTAP_CONTROLLER_H 185af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt#define _SOFTAP_CONTROLLER_H 195af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 205af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt#include <linux/in.h> 2184c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt#include <net/if.h> 225af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 2384c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt#define SOFTAP_MAX_BUFFER_SIZE 4096 24a165913421c5bed00a1f0b8e79e35e55b82aebbeDmitry Shmidt#define AP_BSS_START_DELAY 200000 253df450af1c2e35d854768a508b6905c6794f7a74Dmitry Shmidt#define AP_BSS_STOP_DELAY 500000 263df450af1c2e35d854768a508b6905c6794f7a74Dmitry Shmidt#define AP_SET_CFG_DELAY 500000 27587d6232b604ee383d893362f37f9843f5ac2162Dmitry Shmidt#define AP_DRIVER_START_DELAY 800000 2884c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt 295af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidtclass SoftapController { 305af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt pid_t mPid; 3184c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt int mSock; 325af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 337977d67059ef94eefa9b14038df156b416fef877Dmitry Shmidt int addParam(int pos, const char *cmd, const char *arg); 34666fe255fa581965d2835bd581cd5a8959411067Dmitry Shmidt int setCommand(char *iface, const char *fname, unsigned buflen=0); 355af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidtpublic: 365af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt SoftapController(); 375af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt virtual ~SoftapController(); 385af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 395af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int startSoftap(); 405af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int stopSoftap(); 415af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt bool isSoftapStarted(); 425af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int setSoftap(int argc, char *argv[]); 4378dcb76aff7d3b9458374832a79688d36901127fIrfan Sheriff void generatePsk(char *ssid, char *passphrase, char *psk); 4431fd6c5f3e9c39a13b028718dba5921a4300988cDmitry Shmidt int fwReloadSoftap(int argc, char *argv[]); 45666fe255fa581965d2835bd581cd5a8959411067Dmitry Shmidt int clientsSoftap(char **retbuf); 465af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt}; 475af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 485af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt#endif 49