driver_none.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Driver interface for RADIUS server or WPS ER only (no driver)
  3. * Copyright (c) 2008, Atheros Communications
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #include "includes.h"
  9. #include "common.h"
  10. #include "driver.h"
  11. struct none_driver_data {
  12. struct hostapd_data *hapd;
  13. void *ctx;
  14. };
  15. static void * none_driver_hapd_init(struct hostapd_data *hapd,
  16. struct wpa_init_params *params)
  17. {
  18. struct none_driver_data *drv;
  19. drv = os_zalloc(sizeof(struct none_driver_data));
  20. if (drv == NULL) {
  21. wpa_printf(MSG_ERROR, "Could not allocate memory for none "
  22. "driver data");
  23. return NULL;
  24. }
  25. drv->hapd = hapd;
  26. return drv;
  27. }
  28. static void none_driver_hapd_deinit(void *priv)
  29. {
  30. struct none_driver_data *drv = priv;
  31. os_free(drv);
  32. }
  33. static int none_driver_send_ether(void *priv, const u8 *dst, const u8 *src,
  34. u16 proto, const u8 *data, size_t data_len)
  35. {
  36. return 0;
  37. }
  38. static void * none_driver_init(void *ctx, const char *ifname)
  39. {
  40. struct none_driver_data *drv;
  41. drv = os_zalloc(sizeof(struct none_driver_data));
  42. if (drv == NULL) {
  43. wpa_printf(MSG_ERROR, "Could not allocate memory for none "
  44. "driver data");
  45. return NULL;
  46. }
  47. drv->ctx = ctx;
  48. return drv;
  49. }
  50. static void none_driver_deinit(void *priv)
  51. {
  52. struct none_driver_data *drv = priv;
  53. os_free(drv);
  54. }
  55. const struct wpa_driver_ops wpa_driver_none_ops = {
  56. .name = "none",
  57. .desc = "no driver (RADIUS server/WPS ER)",
  58. .hapd_init = none_driver_hapd_init,
  59. .hapd_deinit = none_driver_hapd_deinit,
  60. .send_ether = none_driver_send_ether,
  61. .init = none_driver_init,
  62. .deinit = none_driver_deinit,
  63. };