stub binding wifi engine
This commit is contained in:
13
src/binding/wifi/drivers/startap.txt
Normal file
13
src/binding/wifi/drivers/startap.txt
Normal file
@ -0,0 +1,13 @@
|
||||
init
|
||||
deinit
|
||||
getcapability
|
||||
setcountry
|
||||
setfrequency
|
||||
setrts
|
||||
setfragment
|
||||
settxqueue
|
||||
addap
|
||||
deleteap
|
||||
addstation
|
||||
removestation
|
||||
getstat
|
48
src/binding/wifi/drivers/wifi_drivers.c
Normal file
48
src/binding/wifi/drivers/wifi_drivers.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include "wifi_drivers.h"
|
||||
|
||||
/* */
|
||||
struct wifi_driver_instance {
|
||||
struct wifi_driver_ops* ops; /* Driver functions */
|
||||
|
||||
wifi_global_handle handle; /* Global instance handle */
|
||||
};
|
||||
|
||||
/* Declare enable wifi driver */
|
||||
#ifdef ENABLE_WIFI_DRIVERS_NL80211
|
||||
extern struct wifi_driver_ops wifi_driver_nl80211_ops;
|
||||
#endif
|
||||
|
||||
static struct wifi_driver_instance wifi_driver[] = {
|
||||
#ifdef ENABLE_WIFI_DRIVERS_NL80211
|
||||
{ &wifi_driver_nl80211_ops },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/* */
|
||||
int wifi_init_driver(void) {
|
||||
int i;
|
||||
|
||||
for (i = 0; wifi_driver[i].ops != NULL; i++) {
|
||||
if (!wifi_driver[i].ops->global_init) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Initialize driver */
|
||||
wifi_driver[i].handle = wifi_driver[i].ops->global_init();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* */
|
||||
void wifi_free_driver(void) {
|
||||
int i;
|
||||
|
||||
for (i = 0; wifi_driver[i].ops != NULL; i++) {
|
||||
/* Free driver */
|
||||
if (wifi_driver[i].ops->global_deinit) {
|
||||
wifi_driver[i].ops->global_deinit(wifi_driver[i].handle);
|
||||
}
|
||||
}
|
||||
}
|
33
src/binding/wifi/drivers/wifi_drivers.h
Normal file
33
src/binding/wifi/drivers/wifi_drivers.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef __WIFI_DRIVERS_HEADER__
|
||||
#define __WIFI_DRIVERS_HEADER__
|
||||
|
||||
/* config */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "capwap_debug.h"
|
||||
#include "capwap_logging.h"
|
||||
|
||||
/* */
|
||||
typedef void* wifi_global_handle;
|
||||
|
||||
/* */
|
||||
struct wifi_driver_ops {
|
||||
const char* name; /* Name of wifi driver */
|
||||
const char* description; /* Description of wifi driver */
|
||||
|
||||
/* Global initialize driver */
|
||||
wifi_global_handle (*global_init)(void);
|
||||
void (*global_deinit)(wifi_global_handle handle);
|
||||
};
|
||||
|
||||
/* Initialize wifi driver engine */
|
||||
int wifi_init_driver(void);
|
||||
void wifi_free_driver(void);
|
||||
|
||||
#endif /* __WIFI_DRIVERS_HEADER__ */
|
28
src/binding/wifi/drivers/wifi_nl80211.c
Normal file
28
src/binding/wifi/drivers/wifi_nl80211.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include "wifi_drivers.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* */
|
||||
static wifi_global_handle nl80211_global_init(void) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
void nl80211_global_deinit(wifi_global_handle handle) {
|
||||
}
|
||||
|
||||
/* Driver function */
|
||||
const struct wifi_driver_ops wifi_driver_nl80211_ops = {
|
||||
.name = "nl80211",
|
||||
.description = "Linux nl80211/cfg80211",
|
||||
.global_init = nl80211_global_init,
|
||||
.global_deinit = nl80211_global_deinit
|
||||
};
|
Reference in New Issue
Block a user