wolfSSL 3.11.1 for TLS1.3 beta

Fork of wolfSSL by wolf SSL

Committer:
wolfSSL
Date:
Tue May 02 08:44:26 2017 +0000
Revision:
6:fa3bd0ca5896
wolfSSL3.10.2;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolfSSL 6:fa3bd0ca5896 1 /* wolfevent.h
wolfSSL 6:fa3bd0ca5896 2 *
wolfSSL 6:fa3bd0ca5896 3 * Copyright (C) 2006-2016 wolfSSL Inc.
wolfSSL 6:fa3bd0ca5896 4 *
wolfSSL 6:fa3bd0ca5896 5 * This file is part of wolfSSL.
wolfSSL 6:fa3bd0ca5896 6 *
wolfSSL 6:fa3bd0ca5896 7 * wolfSSL is free software; you can redistribute it and/or modify
wolfSSL 6:fa3bd0ca5896 8 * it under the terms of the GNU General Public License as published by
wolfSSL 6:fa3bd0ca5896 9 * the Free Software Foundation; either version 2 of the License, or
wolfSSL 6:fa3bd0ca5896 10 * (at your option) any later version.
wolfSSL 6:fa3bd0ca5896 11 *
wolfSSL 6:fa3bd0ca5896 12 * wolfSSL is distributed in the hope that it will be useful,
wolfSSL 6:fa3bd0ca5896 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wolfSSL 6:fa3bd0ca5896 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wolfSSL 6:fa3bd0ca5896 15 * GNU General Public License for more details.
wolfSSL 6:fa3bd0ca5896 16 *
wolfSSL 6:fa3bd0ca5896 17 * You should have received a copy of the GNU General Public License
wolfSSL 6:fa3bd0ca5896 18 * along with this program; if not, write to the Free Software
wolfSSL 6:fa3bd0ca5896 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
wolfSSL 6:fa3bd0ca5896 20 */
wolfSSL 6:fa3bd0ca5896 21
wolfSSL 6:fa3bd0ca5896 22 #ifndef _WOLF_EVENT_H_
wolfSSL 6:fa3bd0ca5896 23 #define _WOLF_EVENT_H_
wolfSSL 6:fa3bd0ca5896 24
wolfSSL 6:fa3bd0ca5896 25 #ifdef __cplusplus
wolfSSL 6:fa3bd0ca5896 26 extern "C" {
wolfSSL 6:fa3bd0ca5896 27 #endif
wolfSSL 6:fa3bd0ca5896 28
wolfSSL 6:fa3bd0ca5896 29 #ifndef SINGLE_THREADED
wolfSSL 6:fa3bd0ca5896 30 #include <wolfssl/wolfcrypt/wc_port.h>
wolfSSL 6:fa3bd0ca5896 31 #endif
wolfSSL 6:fa3bd0ca5896 32
wolfSSL 6:fa3bd0ca5896 33 typedef struct WOLFSSL WOLFSSL;
wolfSSL 6:fa3bd0ca5896 34 typedef struct WOLF_EVENT WOLF_EVENT;
wolfSSL 6:fa3bd0ca5896 35 typedef struct WOLFSSL_CTX WOLFSSL_CTX;
wolfSSL 6:fa3bd0ca5896 36
wolfSSL 6:fa3bd0ca5896 37 typedef unsigned short WOLF_EVENT_FLAG;
wolfSSL 6:fa3bd0ca5896 38
wolfSSL 6:fa3bd0ca5896 39 typedef enum WOLF_EVENT_TYPE {
wolfSSL 6:fa3bd0ca5896 40 WOLF_EVENT_TYPE_NONE,
wolfSSL 6:fa3bd0ca5896 41 #ifdef WOLFSSL_ASYNC_CRYPT
wolfSSL 6:fa3bd0ca5896 42 WOLF_EVENT_TYPE_ASYNC_ANY,
wolfSSL 6:fa3bd0ca5896 43 WOLF_EVENT_TYPE_ASYNC_WOLFSSL,
wolfSSL 6:fa3bd0ca5896 44 WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT,
wolfSSL 6:fa3bd0ca5896 45 WOLF_EVENT_TYPE_ASYNC_FIRST = WOLF_EVENT_TYPE_ASYNC_WOLFSSL,
wolfSSL 6:fa3bd0ca5896 46 WOLF_EVENT_TYPE_ASYNC_LAST = WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT,
wolfSSL 6:fa3bd0ca5896 47 #endif
wolfSSL 6:fa3bd0ca5896 48 } WOLF_EVENT_TYPE;
wolfSSL 6:fa3bd0ca5896 49
wolfSSL 6:fa3bd0ca5896 50 struct WOLF_EVENT {
wolfSSL 6:fa3bd0ca5896 51 /* double linked list */
wolfSSL 6:fa3bd0ca5896 52 WOLF_EVENT* next;
wolfSSL 6:fa3bd0ca5896 53 WOLF_EVENT* prev;
wolfSSL 6:fa3bd0ca5896 54
wolfSSL 6:fa3bd0ca5896 55 void* context;
wolfSSL 6:fa3bd0ca5896 56 #ifdef HAVE_CAVIUM
wolfSSL 6:fa3bd0ca5896 57 word64 reqId;
wolfSSL 6:fa3bd0ca5896 58 #endif
wolfSSL 6:fa3bd0ca5896 59 int ret; /* Async return code */
wolfSSL 6:fa3bd0ca5896 60 WOLF_EVENT_TYPE type;
wolfSSL 6:fa3bd0ca5896 61 WOLF_EVENT_FLAG pending:1;
wolfSSL 6:fa3bd0ca5896 62 WOLF_EVENT_FLAG done:1;
wolfSSL 6:fa3bd0ca5896 63 /* Future event flags can go here */
wolfSSL 6:fa3bd0ca5896 64 };
wolfSSL 6:fa3bd0ca5896 65
wolfSSL 6:fa3bd0ca5896 66 enum WOLF_POLL_FLAGS {
wolfSSL 6:fa3bd0ca5896 67 WOLF_POLL_FLAG_CHECK_HW = 0x01,
wolfSSL 6:fa3bd0ca5896 68 };
wolfSSL 6:fa3bd0ca5896 69
wolfSSL 6:fa3bd0ca5896 70 typedef struct {
wolfSSL 6:fa3bd0ca5896 71 WOLF_EVENT* head; /* head of queue */
wolfSSL 6:fa3bd0ca5896 72 WOLF_EVENT* tail; /* tail of queue */
wolfSSL 6:fa3bd0ca5896 73 #ifndef SINGLE_THREADED
wolfSSL 6:fa3bd0ca5896 74 wolfSSL_Mutex lock; /* queue lock */
wolfSSL 6:fa3bd0ca5896 75 #endif
wolfSSL 6:fa3bd0ca5896 76 int count;
wolfSSL 6:fa3bd0ca5896 77 } WOLF_EVENT_QUEUE;
wolfSSL 6:fa3bd0ca5896 78
wolfSSL 6:fa3bd0ca5896 79
wolfSSL 6:fa3bd0ca5896 80 #ifdef HAVE_WOLF_EVENT
wolfSSL 6:fa3bd0ca5896 81
wolfSSL 6:fa3bd0ca5896 82 /* Event */
wolfSSL 6:fa3bd0ca5896 83 WOLFSSL_API int wolfEvent_Init(WOLF_EVENT* event, WOLF_EVENT_TYPE type, void* context);
wolfSSL 6:fa3bd0ca5896 84 WOLFSSL_API int wolfEvent_Poll(WOLF_EVENT* event, WOLF_EVENT_FLAG flags);
wolfSSL 6:fa3bd0ca5896 85
wolfSSL 6:fa3bd0ca5896 86 /* Event Queue */
wolfSSL 6:fa3bd0ca5896 87 WOLFSSL_API int wolfEventQueue_Init(WOLF_EVENT_QUEUE* queue);
wolfSSL 6:fa3bd0ca5896 88 WOLFSSL_API int wolfEventQueue_Push(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event);
wolfSSL 6:fa3bd0ca5896 89 WOLFSSL_API int wolfEventQueue_Pop(WOLF_EVENT_QUEUE* queue, WOLF_EVENT** event);
wolfSSL 6:fa3bd0ca5896 90 WOLFSSL_API int wolfEventQueue_Remove(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event);
wolfSSL 6:fa3bd0ca5896 91 WOLFSSL_API int wolfEventQueue_Poll(WOLF_EVENT_QUEUE* queue, void* context_filter,
wolfSSL 6:fa3bd0ca5896 92 WOLF_EVENT** events, int maxEvents, WOLF_EVENT_FLAG flags, int* eventCount);
wolfSSL 6:fa3bd0ca5896 93 WOLFSSL_API int wolfEventQueue_Count(WOLF_EVENT_QUEUE* queue);
wolfSSL 6:fa3bd0ca5896 94 WOLFSSL_API void wolfEventQueue_Free(WOLF_EVENT_QUEUE* queue);
wolfSSL 6:fa3bd0ca5896 95
wolfSSL 6:fa3bd0ca5896 96 #endif /* HAVE_WOLF_EVENT */
wolfSSL 6:fa3bd0ca5896 97
wolfSSL 6:fa3bd0ca5896 98
wolfSSL 6:fa3bd0ca5896 99 #ifdef __cplusplus
wolfSSL 6:fa3bd0ca5896 100 } /* extern "C" */
wolfSSL 6:fa3bd0ca5896 101 #endif
wolfSSL 6:fa3bd0ca5896 102
wolfSSL 6:fa3bd0ca5896 103 #endif /* _WOLF_EVENT_H_ */
wolfSSL 6:fa3bd0ca5896 104