SoftapController.h revision a165913421c5bed00a1f0b8e79e35e55b82aebbe
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#include <utils/List.h> 235af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 2484c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt#define SOFTAP_MAX_BUFFER_SIZE 4096 25a165913421c5bed00a1f0b8e79e35e55b82aebbeDmitry Shmidt#define AP_BSS_START_DELAY 200000 263df450af1c2e35d854768a508b6905c6794f7a74Dmitry Shmidt#define AP_BSS_STOP_DELAY 500000 273df450af1c2e35d854768a508b6905c6794f7a74Dmitry Shmidt#define AP_SET_CFG_DELAY 500000 28a165913421c5bed00a1f0b8e79e35e55b82aebbeDmitry Shmidt#define AP_DRIVER_START_DELAY 400000 2984c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt 305af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidtclass SoftapController { 3184c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt char mBuf[SOFTAP_MAX_BUFFER_SIZE]; 3284c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt char mIface[IFNAMSIZ]; 335af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt pid_t mPid; 3484c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt int mSock; 355af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 3684c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt int getPrivFuncNum(char *iface, const char *fname); 377977d67059ef94eefa9b14038df156b416fef877Dmitry Shmidt int addParam(int pos, const char *cmd, const char *arg); 385af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidtpublic: 395af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt SoftapController(); 405af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt virtual ~SoftapController(); 415af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 42c3539e22bd7a59a12542b9ad961f7d7f0db9a8dfDmitry Shmidt int startDriver(char *iface); 43c3539e22bd7a59a12542b9ad961f7d7f0db9a8dfDmitry Shmidt int stopDriver(char *iface); 445af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int startSoftap(); 455af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int stopSoftap(); 465af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt bool isSoftapStarted(); 475af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int setSoftap(int argc, char *argv[]); 4831fd6c5f3e9c39a13b028718dba5921a4300988cDmitry Shmidt int fwReloadSoftap(int argc, char *argv[]); 495af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt}; 505af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 515af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt#endif 52