apple_client_platform_darwin.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <stdbool.h>
  2. #include <stddef.h>
  3. #include <stdint.h>
  4. #include <unistd.h>
  5. typedef struct box_apple_tls_client box_apple_tls_client_t;
  6. typedef struct box_apple_tls_state {
  7. uint16_t version;
  8. uint16_t cipher_suite;
  9. char *alpn;
  10. char *server_name;
  11. uint8_t *peer_cert_chain;
  12. size_t peer_cert_chain_len;
  13. } box_apple_tls_state_t;
  14. box_apple_tls_client_t *box_apple_tls_client_create(
  15. int connected_socket,
  16. const char *server_name,
  17. const char *alpn,
  18. size_t alpn_len,
  19. uint16_t min_version,
  20. uint16_t max_version,
  21. bool insecure,
  22. const char *anchor_pem,
  23. size_t anchor_pem_len,
  24. bool anchor_only,
  25. bool has_verify_time,
  26. int64_t verify_time_unix_millis,
  27. char **error_out
  28. );
  29. int box_apple_tls_client_wait_ready(box_apple_tls_client_t *client, int timeout_msec, char **error_out);
  30. void box_apple_tls_client_cancel(box_apple_tls_client_t *client);
  31. void box_apple_tls_client_free(box_apple_tls_client_t *client);
  32. ssize_t box_apple_tls_client_read(box_apple_tls_client_t *client, void *buffer, size_t buffer_len, int timeout_msec, bool *eof_out, char **error_out);
  33. ssize_t box_apple_tls_client_write(box_apple_tls_client_t *client, const void *buffer, size_t buffer_len, int timeout_msec, char **error_out);
  34. bool box_apple_tls_client_copy_state(box_apple_tls_client_t *client, box_apple_tls_state_t *state, char **error_out);
  35. void box_apple_tls_state_free(box_apple_tls_state_t *state);