diff options
author | sam <sam@FreeBSD.org> | 2005-06-05 22:35:03 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2005-06-05 22:35:03 +0000 |
commit | 21e78f430e299464b3c902bec78f8daa1f0e2e71 (patch) | |
tree | a7d225a062cd128980707f3fa918dec2d015c46b /contrib/hostapd/driver_test.c | |
download | FreeBSD-src-21e78f430e299464b3c902bec78f8daa1f0e2e71.zip FreeBSD-src-21e78f430e299464b3c902bec78f8daa1f0e2e71.tar.gz |
Stripped down import of hostapd v0.3.7
Diffstat (limited to 'contrib/hostapd/driver_test.c')
-rw-r--r-- | contrib/hostapd/driver_test.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/contrib/hostapd/driver_test.c b/contrib/hostapd/driver_test.c new file mode 100644 index 0000000..612d1dc --- /dev/null +++ b/contrib/hostapd/driver_test.c @@ -0,0 +1,78 @@ +/* + * Host AP (software wireless LAN access point) user space daemon for + * Host AP kernel driver / Driver interface for development testing + * Copyright (c) 2004, Jouni Malinen <jkmaline@cc.hut.fi> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <sys/ioctl.h> +#include <netinet/in.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/socket.h> + +#include "hostapd.h" +#include "driver.h" + + +struct test_driver_data { + struct driver_ops ops; + struct hostapd_data *hapd; +}; + +static const struct driver_ops test_driver_ops; + + +static int test_driver_init(struct hostapd_data *hapd) +{ + struct test_driver_data *drv; + + drv = malloc(sizeof(struct test_driver_data)); + if (drv == NULL) { + printf("Could not allocate memory for test driver data\n"); + return -1; + } + + memset(drv, 0, sizeof(*drv)); + drv->ops = test_driver_ops; + drv->hapd = hapd; + + hapd->driver = &drv->ops; + return 0; +} + + +static void test_driver_deinit(void *priv) +{ + struct test_driver_data *drv = priv; + + drv->hapd->driver = NULL; + + free(drv); +} + + +static const struct driver_ops test_driver_ops = { + .name = "test", + .init = test_driver_init, + .deinit = test_driver_deinit, +}; + + +void test_driver_register(void) +{ + driver_register(test_driver_ops.name, &test_driver_ops); +} |