driver_none.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Driver interface for RADIUS server or WPS ER only (no driver)
  3. * Copyright (c) 2008, Atheros Communications
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #include "includes.h"
  15. #include "../hostapd/hostapd.h"
  16. #include "driver.h"
  17. struct none_driver_data {
  18. struct hostapd_data *hapd;
  19. void *ctx;
  20. };
  21. static void * none_driver_hapd_init(struct hostapd_data *hapd,
  22. struct wpa_init_params *params)
  23. {
  24. struct none_driver_data *drv;
  25. drv = os_zalloc(sizeof(struct none_driver_data));
  26. if (drv == NULL) {
  27. wpa_printf(MSG_ERROR, "Could not allocate memory for none "
  28. "driver data");
  29. return NULL;
  30. }
  31. drv->hapd = hapd;
  32. return drv;
  33. }
  34. static void none_driver_hapd_deinit(void *priv)
  35. {
  36. struct none_driver_data *drv = priv;
  37. os_free(drv);
  38. }
  39. static int none_driver_send_ether(void *priv, const u8 *dst, const u8 *src,
  40. u16 proto, const u8 *data, size_t data_len)
  41. {
  42. return 0;
  43. }
  44. static void * none_driver_init(void *ctx, const char *ifname)
  45. {
  46. struct none_driver_data *drv;
  47. drv = os_zalloc(sizeof(struct none_driver_data));
  48. if (drv == NULL) {
  49. wpa_printf(MSG_ERROR, "Could not allocate memory for none "
  50. "driver data");
  51. return NULL;
  52. }
  53. drv->ctx = ctx;
  54. return drv;
  55. }
  56. static void none_driver_deinit(void *priv)
  57. {
  58. struct none_driver_data *drv = priv;
  59. os_free(drv);
  60. }
  61. static int none_driver_send_eapol(void *priv, const u8 *dest, u16 proto,
  62. const u8 *data, size_t data_len)
  63. {
  64. return -1;
  65. }
  66. const struct wpa_driver_ops wpa_driver_none_ops = {
  67. .name = "none",
  68. .desc = "no driver (RADIUS server/WPS ER)",
  69. .hapd_init = none_driver_hapd_init,
  70. .hapd_deinit = none_driver_hapd_deinit,
  71. .send_ether = none_driver_send_ether,
  72. .init = none_driver_init,
  73. .deinit = none_driver_deinit,
  74. .send_eapol = none_driver_send_eapol,
  75. };