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