wps_er.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Wi-Fi Protected Setup - External Registrar
  3. * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
  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. #ifndef WPS_ER_H
  15. #define WPS_ER_H
  16. #include "utils/list.h"
  17. struct wps_er_sta {
  18. struct dl_list list;
  19. struct wps_er_ap *ap;
  20. u8 addr[ETH_ALEN];
  21. u16 config_methods;
  22. u8 uuid[WPS_UUID_LEN];
  23. u8 pri_dev_type[8];
  24. u16 dev_passwd_id;
  25. int m1_received;
  26. char *manufacturer;
  27. char *model_name;
  28. char *model_number;
  29. char *serial_number;
  30. char *dev_name;
  31. struct wps_data *wps;
  32. struct http_client *http;
  33. };
  34. struct wps_er_ap {
  35. struct dl_list list;
  36. struct wps_er *er;
  37. struct dl_list sta; /* list of STAs/Enrollees using this AP */
  38. struct in_addr addr;
  39. char *location;
  40. struct http_client *http;
  41. struct wps_data *wps;
  42. u8 uuid[WPS_UUID_LEN];
  43. u8 pri_dev_type[8];
  44. u8 wps_state;
  45. u8 mac_addr[ETH_ALEN];
  46. char *friendly_name;
  47. char *manufacturer;
  48. char *manufacturer_url;
  49. char *model_description;
  50. char *model_name;
  51. char *model_number;
  52. char *model_url;
  53. char *serial_number;
  54. char *udn;
  55. char *upc;
  56. char *scpd_url;
  57. char *control_url;
  58. char *event_sub_url;
  59. int subscribed;
  60. u8 sid[WPS_UUID_LEN];
  61. unsigned int id;
  62. struct wps_credential *ap_settings;
  63. void (*m1_handler)(struct wps_er_ap *ap, struct wpabuf *m1);
  64. };
  65. struct wps_er {
  66. struct wps_context *wps;
  67. char ifname[17];
  68. char *mac_addr_text; /* mac addr of network i.f. we use */
  69. u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */
  70. char *ip_addr_text; /* IP address of network i.f. we use */
  71. unsigned ip_addr; /* IP address of network i.f. we use (host order) */
  72. int multicast_sd;
  73. int ssdp_sd;
  74. struct dl_list ap;
  75. struct dl_list ap_unsubscribing;
  76. struct http_server *http_srv;
  77. int http_port;
  78. unsigned int next_ap_id;
  79. unsigned int event_id;
  80. int deinitializing;
  81. void (*deinit_done_cb)(void *ctx);
  82. void *deinit_done_ctx;
  83. };
  84. /* wps_er.c */
  85. void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr,
  86. const char *location, int max_age);
  87. void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr);
  88. /* wps_er_ssdp.c */
  89. int wps_er_ssdp_init(struct wps_er *er);
  90. void wps_er_ssdp_deinit(struct wps_er *er);
  91. void wps_er_send_ssdp_msearch(struct wps_er *er);
  92. #endif /* WPS_ER_H */