codekingpro/portable-devtools
115k
1/*2 * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.3 *4 * Licensed under the Apache License 2.0 (the "License"). You may not use5 * this file except in compliance with the License. You can obtain a copy6 * in the file LICENSE in the source distribution or at7 * https://www.openssl.org/source/license.html8 */9 10#include <stdlib.h>11 12#ifndef OPENSSL_ASYNC_H13# define OPENSSL_ASYNC_H14# pragma once15 16# include <openssl/macros.h>17# ifndef OPENSSL_NO_DEPRECATED_3_018# define HEADER_ASYNC_H19# endif20 21#if defined(_WIN32)22# if defined(BASETYPES) || defined(_WINDEF_H)23/* application has to include <windows.h> to use this */24#define OSSL_ASYNC_FD HANDLE25#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE26# endif27#else28#define OSSL_ASYNC_FD int29#define OSSL_BAD_ASYNC_FD -130#endif31# include <openssl/asyncerr.h>32 33 34# ifdef __cplusplus35extern "C" {36# endif37 38typedef struct async_job_st ASYNC_JOB;39typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;40typedef int (*ASYNC_callback_fn)(void *arg);41 42#define ASYNC_ERR 043#define ASYNC_NO_JOBS 144#define ASYNC_PAUSE 245#define ASYNC_FINISH 346 47#define ASYNC_STATUS_UNSUPPORTED 048#define ASYNC_STATUS_ERR 149#define ASYNC_STATUS_OK 250#define ASYNC_STATUS_EAGAIN 351 52int ASYNC_init_thread(size_t max_size, size_t init_size);53void ASYNC_cleanup_thread(void);54 55#ifdef OSSL_ASYNC_FD56ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);57void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);58int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,59 OSSL_ASYNC_FD fd,60 void *custom_data,61 void (*cleanup)(ASYNC_WAIT_CTX *, const void *,62 OSSL_ASYNC_FD, void *));63int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,64 OSSL_ASYNC_FD *fd, void **custom_data);65int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,66 size_t *numfds);67int ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx,68 ASYNC_callback_fn *callback,69 void **callback_arg);70int ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx,71 ASYNC_callback_fn callback,72 void *callback_arg);73int ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status);74int ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx);75int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,76 size_t *numaddfds, OSSL_ASYNC_FD *delfd,77 size_t *numdelfds);78int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);79#endif80 81int ASYNC_is_capable(void);82 83int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,84 int (*func)(void *), void *args, size_t size);85int ASYNC_pause_job(void);86 87ASYNC_JOB *ASYNC_get_current_job(void);88ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);89void ASYNC_block_pause(void);90void ASYNC_unblock_pause(void);91 92 93# ifdef __cplusplus94}95# endif96#endif97 