SoftapController.h revision 3df450af1c2e35d854768a508b6905c6794f7a74
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
253df450af1c2e35d854768a508b6905c6794f7a74Dmitry Shmidt#define AP_BSS_START_DELAY	500000
263df450af1c2e35d854768a508b6905c6794f7a74Dmitry Shmidt#define AP_BSS_STOP_DELAY	500000
273df450af1c2e35d854768a508b6905c6794f7a74Dmitry Shmidt#define AP_SET_CFG_DELAY	500000
2884c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt
295af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidtclass SoftapController {
3084c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt    char mBuf[SOFTAP_MAX_BUFFER_SIZE];
3184c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt    char mIface[IFNAMSIZ];
325af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt    pid_t mPid;
3384c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt    int mSock;
345af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt
3584c65a62fe7b053fed7f20274ca7379627a87b79Dmitry Shmidt    int getPrivFuncNum(char *iface, const char *fname);
367977d67059ef94eefa9b14038df156b416fef877Dmitry Shmidt    int addParam(int pos, const char *cmd, const char *arg);
375af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidtpublic:
385af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt    SoftapController();
395af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt    virtual ~SoftapController();
405af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt
41c3539e22bd7a59a12542b9ad961f7d7f0db9a8dfDmitry Shmidt    int startDriver(char *iface);
42c3539e22bd7a59a12542b9ad961f7d7f0db9a8dfDmitry Shmidt    int stopDriver(char *iface);
435af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt    int startSoftap();
445af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt    int stopSoftap();
455af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt    bool isSoftapStarted();
465af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt    int setSoftap(int argc, char *argv[]);
4731fd6c5f3e9c39a13b028718dba5921a4300988cDmitry Shmidt    int fwReloadSoftap(int argc, char *argv[]);
485af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt};
495af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt
505af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt#endif
51