osu_client.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Hotspot 2.0 - OSU client
  3. * Copyright (c) 2013-2014, Qualcomm Atheros, Inc.
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef OSU_CLIENT_H
  9. #define OSU_CLIENT_H
  10. #define SPP_NS_URI "http://www.wi-fi.org/specifications/hotspot2dot0/v1.0/spp"
  11. #define URN_OMA_DM_DEVINFO "urn:oma:mo:oma-dm-devinfo:1.0"
  12. #define URN_OMA_DM_DEVDETAIL "urn:oma:mo:oma-dm-devdetail:1.0"
  13. #define URN_HS20_DEVDETAIL_EXT "urn:wfa:mo-ext:hotspot2dot0-devdetail-ext:1.0"
  14. #define URN_HS20_PPS "urn:wfa:mo:hotspot2dot0-perprovidersubscription:1.0"
  15. #define MAX_OSU_VALS 10
  16. struct osu_lang_text {
  17. char lang[4];
  18. char text[253];
  19. };
  20. struct hs20_osu_client {
  21. struct xml_node_ctx *xml;
  22. struct http_ctx *http;
  23. int no_reconnect;
  24. char pps_fname[300];
  25. char *devid;
  26. const char *result_file;
  27. const char *summary_file;
  28. const char *ifname;
  29. const char *ca_fname;
  30. int no_osu_cert_validation; /* for EST operations */
  31. char *fqdn;
  32. char *server_url;
  33. struct osu_lang_text friendly_name[MAX_OSU_VALS];
  34. size_t friendly_name_count;
  35. size_t icon_count;
  36. char icon_filename[MAX_OSU_VALS][256];
  37. u8 icon_hash[MAX_OSU_VALS][32];
  38. int pps_cred_set;
  39. int pps_updated;
  40. int client_cert_present;
  41. char **server_dnsname;
  42. size_t server_dnsname_count;
  43. #define WORKAROUND_OCSP_OPTIONAL 0x00000001
  44. unsigned long int workarounds;
  45. };
  46. /* osu_client.c */
  47. void write_result(struct hs20_osu_client *ctx, const char *fmt, ...)
  48. __attribute__ ((format (printf, 2, 3)));
  49. void write_summary(struct hs20_osu_client *ctx, const char *fmt, ...)
  50. __attribute__ ((format (printf, 2, 3)));
  51. void debug_dump_node(struct hs20_osu_client *ctx, const char *title,
  52. xml_node_t *node);
  53. int osu_get_certificate(struct hs20_osu_client *ctx, xml_node_t *getcert);
  54. int hs20_add_pps_mo(struct hs20_osu_client *ctx, const char *uri,
  55. xml_node_t *add_mo, char *fname, size_t fname_len);
  56. void get_user_pw(struct hs20_osu_client *ctx, xml_node_t *pps,
  57. const char *alt_loc, char **user, char **pw);
  58. int update_pps_file(struct hs20_osu_client *ctx, const char *pps_fname,
  59. xml_node_t *pps);
  60. void cmd_set_pps(struct hs20_osu_client *ctx, const char *pps_fname);
  61. /* spp_client.c */
  62. void spp_sub_rem(struct hs20_osu_client *ctx, const char *address,
  63. const char *pps_fname,
  64. const char *client_cert, const char *client_key,
  65. const char *cred_username, const char *cred_password,
  66. xml_node_t *pps);
  67. void spp_pol_upd(struct hs20_osu_client *ctx, const char *address,
  68. const char *pps_fname,
  69. const char *client_cert, const char *client_key,
  70. const char *cred_username, const char *cred_password,
  71. xml_node_t *pps);
  72. int cmd_prov(struct hs20_osu_client *ctx, const char *url);
  73. int cmd_sim_prov(struct hs20_osu_client *ctx, const char *url);
  74. /* oma_dm_client.c */
  75. int cmd_oma_dm_prov(struct hs20_osu_client *ctx, const char *url);
  76. int cmd_oma_dm_sim_prov(struct hs20_osu_client *ctx, const char *url);
  77. void oma_dm_sub_rem(struct hs20_osu_client *ctx, const char *address,
  78. const char *pps_fname,
  79. const char *client_cert, const char *client_key,
  80. const char *cred_username, const char *cred_password,
  81. xml_node_t *pps);
  82. void oma_dm_pol_upd(struct hs20_osu_client *ctx, const char *address,
  83. const char *pps_fname,
  84. const char *client_cert, const char *client_key,
  85. const char *cred_username, const char *cred_password,
  86. xml_node_t *pps);
  87. void cmd_oma_dm_sub_rem(struct hs20_osu_client *ctx, const char *address,
  88. const char *pps_fname);
  89. void cmd_oma_dm_add(struct hs20_osu_client *ctx, const char *pps_fname,
  90. const char *add_fname);
  91. void cmd_oma_dm_replace(struct hs20_osu_client *ctx, const char *pps_fname,
  92. const char *replace_fname);
  93. /* est.c */
  94. int est_load_cacerts(struct hs20_osu_client *ctx, const char *url);
  95. int est_build_csr(struct hs20_osu_client *ctx, const char *url);
  96. int est_simple_enroll(struct hs20_osu_client *ctx, const char *url,
  97. const char *user, const char *pw);
  98. #endif /* OSU_CLIENT_H */