blob: 23e9ecd9bb638bae99cbf7b5d32c1614982355a3 [file] [log] [blame]
Dmitry Shmidtd5dc24e2014-03-12 14:22:04 -07001/*
2 * HTTP wrapper
3 * Copyright (c) 2012-2013, 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
9#ifndef HTTP_UTILS_H
10#define HTTP_UTILS_H
11
12struct http_ctx;
13
14struct http_othername {
15 char *oid;
16 u8 *data;
17 size_t len;
18};
19
20#define HTTP_MAX_CERT_LOGO_HASH 32
21
22struct http_logo {
23 char *alg_oid;
24 u8 *hash;
25 size_t hash_len;
26 char *uri;
27};
28
29struct http_cert {
30 char **dnsname;
Hai Shalomfdcde762020-04-02 11:19:20 -070031 size_t num_dnsname;
Dmitry Shmidtd5dc24e2014-03-12 14:22:04 -070032 struct http_othername *othername;
Hai Shalomfdcde762020-04-02 11:19:20 -070033 size_t num_othername;
Dmitry Shmidtd5dc24e2014-03-12 14:22:04 -070034 struct http_logo *logo;
Hai Shalomfdcde762020-04-02 11:19:20 -070035 size_t num_logo;
Sunil Ravia04bd252022-05-02 22:54:18 -070036 const char *url;
Dmitry Shmidtd5dc24e2014-03-12 14:22:04 -070037};
38
39int soap_init_client(struct http_ctx *ctx, const char *address,
40 const char *ca_fname, const char *username,
41 const char *password, const char *client_cert,
42 const char *client_key);
43int soap_reinit_client(struct http_ctx *ctx);
44xml_node_t * soap_send_receive(struct http_ctx *ctx, xml_node_t *node);
45
46struct http_ctx * http_init_ctx(void *upper_ctx, struct xml_node_ctx *xml_ctx);
47void http_ocsp_set(struct http_ctx *ctx, int val);
48void http_deinit_ctx(struct http_ctx *ctx);
49
50int http_download_file(struct http_ctx *ctx, const char *url,
51 const char *fname, const char *ca_fname);
52char * http_post(struct http_ctx *ctx, const char *url, const char *data,
53 const char *content_type, const char *ext_hdr,
54 const char *ca_fname,
55 const char *username, const char *password,
56 const char *client_cert, const char *client_key,
57 size_t *resp_len);
58void http_set_cert_cb(struct http_ctx *ctx,
59 int (*cb)(void *ctx, struct http_cert *cert),
60 void *cb_ctx);
61const char * http_get_err(struct http_ctx *ctx);
62void http_parse_x509_certificate(struct http_ctx *ctx, const char *fname);
63
64#endif /* HTTP_UTILS_H */