stub binding wifi engine

This commit is contained in:
vemax78
2013-05-01 21:33:54 +02:00
parent 930b0a6a3a
commit 05ab7a3787
9 changed files with 210 additions and 48 deletions

View File

View File

@ -0,0 +1,13 @@
init
deinit
getcapability
setcountry
setfrequency
setrts
setfragment
settxqueue
addap
deleteap
addstation
removestation
getstat

View 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);
}
}
}

View 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__ */

View 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
};