http-utils.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  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. #ifndef HTTP_UTILS_H
  9. #define HTTP_UTILS_H
  10. struct http_ctx;
  11. struct http_othername {
  12. char *oid;
  13. u8 *data;
  14. size_t len;
  15. };
  16. #define HTTP_MAX_CERT_LOGO_HASH 32
  17. struct http_logo {
  18. char *alg_oid;
  19. u8 *hash;
  20. size_t hash_len;
  21. char *uri;
  22. };
  23. struct http_cert {
  24. char **dnsname;
  25. unsigned int num_dnsname;
  26. struct http_othername *othername;
  27. unsigned int num_othername;
  28. struct http_logo *logo;
  29. unsigned int num_logo;
  30. };
  31. int soap_init_client(struct http_ctx *ctx, const char *address,
  32. const char *ca_fname, const char *username,
  33. const char *password, const char *client_cert,
  34. const char *client_key);
  35. int soap_reinit_client(struct http_ctx *ctx);
  36. xml_node_t * soap_send_receive(struct http_ctx *ctx, xml_node_t *node);
  37. struct http_ctx * http_init_ctx(void *upper_ctx, struct xml_node_ctx *xml_ctx);
  38. void http_ocsp_set(struct http_ctx *ctx, int val);
  39. void http_deinit_ctx(struct http_ctx *ctx);
  40. int http_download_file(struct http_ctx *ctx, const char *url,
  41. const char *fname, const char *ca_fname);
  42. char * http_post(struct http_ctx *ctx, const char *url, const char *data,
  43. const char *content_type, const char *ext_hdr,
  44. const char *ca_fname,
  45. const char *username, const char *password,
  46. const char *client_cert, const char *client_key,
  47. size_t *resp_len);
  48. void http_set_cert_cb(struct http_ctx *ctx,
  49. int (*cb)(void *ctx, struct http_cert *cert),
  50. void *cb_ctx);
  51. const char * http_get_err(struct http_ctx *ctx);
  52. void http_parse_x509_certificate(struct http_ctx *ctx, const char *fname);
  53. #endif /* HTTP_UTILS_H */