Home | History | Annotate | Line # | Download | only in client
osu_client.h revision 1.1
      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  christos #define WORKAROUND_OCSP_OPTIONAL 0x00000001
     51  1.1  christos 	unsigned long int workarounds;
     52  1.1  christos };
     53  1.1  christos 
     54  1.1  christos 
     55  1.1  christos /* osu_client.c */
     56  1.1  christos 
     57  1.1  christos void write_result(struct hs20_osu_client *ctx, const char *fmt, ...)
     58  1.1  christos 	__attribute__ ((format (printf, 2, 3)));
     59  1.1  christos void write_summary(struct hs20_osu_client *ctx, const char *fmt, ...)
     60  1.1  christos 	__attribute__ ((format (printf, 2, 3)));
     61  1.1  christos 
     62  1.1  christos void debug_dump_node(struct hs20_osu_client *ctx, const char *title,
     63  1.1  christos 		     xml_node_t *node);
     64  1.1  christos int osu_get_certificate(struct hs20_osu_client *ctx, xml_node_t *getcert);
     65  1.1  christos int hs20_add_pps_mo(struct hs20_osu_client *ctx, const char *uri,
     66  1.1  christos 		    xml_node_t *add_mo, char *fname, size_t fname_len);
     67  1.1  christos void get_user_pw(struct hs20_osu_client *ctx, xml_node_t *pps,
     68  1.1  christos 		 const char *alt_loc, char **user, char **pw);
     69  1.1  christos int update_pps_file(struct hs20_osu_client *ctx, const char *pps_fname,
     70  1.1  christos 		    xml_node_t *pps);
     71  1.1  christos void cmd_set_pps(struct hs20_osu_client *ctx, const char *pps_fname);
     72  1.1  christos 
     73  1.1  christos 
     74  1.1  christos /* spp_client.c */
     75  1.1  christos 
     76  1.1  christos void spp_sub_rem(struct hs20_osu_client *ctx, const char *address,
     77  1.1  christos 		 const char *pps_fname,
     78  1.1  christos 		 const char *client_cert, const char *client_key,
     79  1.1  christos 		 const char *cred_username, const char *cred_password,
     80  1.1  christos 		 xml_node_t *pps);
     81  1.1  christos void spp_pol_upd(struct hs20_osu_client *ctx, const char *address,
     82  1.1  christos 		 const char *pps_fname,
     83  1.1  christos 		 const char *client_cert, const char *client_key,
     84  1.1  christos 		 const char *cred_username, const char *cred_password,
     85  1.1  christos 		 xml_node_t *pps);
     86  1.1  christos int cmd_prov(struct hs20_osu_client *ctx, const char *url);
     87  1.1  christos int cmd_sim_prov(struct hs20_osu_client *ctx, const char *url);
     88  1.1  christos 
     89  1.1  christos 
     90  1.1  christos /* oma_dm_client.c */
     91  1.1  christos 
     92  1.1  christos int cmd_oma_dm_prov(struct hs20_osu_client *ctx, const char *url);
     93  1.1  christos int cmd_oma_dm_sim_prov(struct hs20_osu_client *ctx, const char *url);
     94  1.1  christos void oma_dm_sub_rem(struct hs20_osu_client *ctx, const char *address,
     95  1.1  christos 		    const char *pps_fname,
     96  1.1  christos 		    const char *client_cert, const char *client_key,
     97  1.1  christos 		    const char *cred_username, const char *cred_password,
     98  1.1  christos 		    xml_node_t *pps);
     99  1.1  christos void oma_dm_pol_upd(struct hs20_osu_client *ctx, const char *address,
    100  1.1  christos 		    const char *pps_fname,
    101  1.1  christos 		    const char *client_cert, const char *client_key,
    102  1.1  christos 		    const char *cred_username, const char *cred_password,
    103  1.1  christos 		    xml_node_t *pps);
    104  1.1  christos void cmd_oma_dm_sub_rem(struct hs20_osu_client *ctx, const char *address,
    105  1.1  christos 			const char *pps_fname);
    106  1.1  christos void cmd_oma_dm_add(struct hs20_osu_client *ctx, const char *pps_fname,
    107  1.1  christos 		    const char *add_fname);
    108  1.1  christos void cmd_oma_dm_replace(struct hs20_osu_client *ctx, const char *pps_fname,
    109  1.1  christos 			const char *replace_fname);
    110  1.1  christos 
    111  1.1  christos /* est.c */
    112  1.1  christos 
    113  1.1  christos int est_load_cacerts(struct hs20_osu_client *ctx, const char *url);
    114  1.1  christos int est_build_csr(struct hs20_osu_client *ctx, const char *url);
    115  1.1  christos int est_simple_enroll(struct hs20_osu_client *ctx, const char *url,
    116  1.1  christos 		      const char *user, const char *pw);
    117  1.1  christos 
    118  1.1  christos #endif /* OSU_CLIENT_H */
    119