]>
Commit | Line | Data |
---|---|---|
a3667c31 | 1 | /* |
21dcbebc | 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. |
a3667c31 | 3 | * |
21dcbebc RS |
4 | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
a3667c31 MC |
8 | */ |
9 | ||
316fae2a MC |
10 | #include <stdlib.h> |
11 | ||
a3667c31 MC |
12 | #ifndef HEADER_ASYNC_H |
13 | # define HEADER_ASYNC_H | |
14 | ||
8d35ceb9 | 15 | #if defined(_WIN32) |
f1f5ee17 AP |
16 | # if defined(BASETYPES) || defined(_WINDEF_H) |
17 | /* application has to include <windows.h> to use this */ | |
ff75a257 MC |
18 | #define OSSL_ASYNC_FD HANDLE |
19 | #define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE | |
f1f5ee17 | 20 | # endif |
2b2c78d4 | 21 | #else |
ff75a257 MC |
22 | #define OSSL_ASYNC_FD int |
23 | #define OSSL_BAD_ASYNC_FD -1 | |
2b2c78d4 | 24 | #endif |
52df25cf | 25 | # include <openssl/asyncerr.h> |
2b2c78d4 MC |
26 | |
27 | ||
a3667c31 MC |
28 | # ifdef __cplusplus |
29 | extern "C" { | |
30 | # endif | |
31 | ||
32 | typedef struct async_job_st ASYNC_JOB; | |
ff75a257 | 33 | typedef struct async_wait_ctx_st ASYNC_WAIT_CTX; |
a3667c31 MC |
34 | |
35 | #define ASYNC_ERR 0 | |
252d6d3a MC |
36 | #define ASYNC_NO_JOBS 1 |
37 | #define ASYNC_PAUSE 2 | |
38 | #define ASYNC_FINISH 3 | |
39 | ||
68487a9b MC |
40 | int ASYNC_init_thread(size_t max_size, size_t init_size); |
41 | void ASYNC_cleanup_thread(void); | |
a3667c31 | 42 | |
f1f5ee17 | 43 | #ifdef OSSL_ASYNC_FD |
ff75a257 MC |
44 | ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void); |
45 | void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx); | |
46 | int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, | |
47 | OSSL_ASYNC_FD fd, | |
48 | void *custom_data, | |
49 | void (*cleanup)(ASYNC_WAIT_CTX *, const void *, | |
50 | OSSL_ASYNC_FD, void *)); | |
51 | int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, | |
52 | OSSL_ASYNC_FD *fd, void **custom_data); | |
53 | int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd, | |
54 | size_t *numfds); | |
55 | int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd, | |
56 | size_t *numaddfds, OSSL_ASYNC_FD *delfd, | |
57 | size_t *numdelfds); | |
58 | int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key); | |
f1f5ee17 | 59 | #endif |
ff75a257 | 60 | |
667867cc MC |
61 | int ASYNC_is_capable(void); |
62 | ||
ff75a257 MC |
63 | int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret, |
64 | int (*func)(void *), void *args, size_t size); | |
a3667c31 | 65 | int ASYNC_pause_job(void); |
a3667c31 | 66 | |
f4da39d2 | 67 | ASYNC_JOB *ASYNC_get_current_job(void); |
ff75a257 | 68 | ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job); |
e8dfb5bf MC |
69 | void ASYNC_block_pause(void); |
70 | void ASYNC_unblock_pause(void); | |
f4da39d2 | 71 | |
69588edb | 72 | int ERR_load_ASYNC_strings(void); |
a3667c31 | 73 | |
0cd0a820 | 74 | # ifdef __cplusplus |
079a1a90 | 75 | } |
0cd0a820 | 76 | # endif |
a3667c31 | 77 | #endif |