A super trimmed down TLS stack, GPL licensed
Dependents: MiniTLS-HTTPS-Example
MiniTLS - A super trimmed down TLS/SSL Library for embedded devices Author: Donatien Garnier Copyright (C) 2013-2014 AppNearMe Ltd
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
core/fwk.h@4:cbaf466d717d, 2014-06-10 (annotated)
- Committer:
- MiniTLS
- Date:
- Tue Jun 10 14:23:09 2014 +0000
- Revision:
- 4:cbaf466d717d
- Parent:
- 3:eb324ffffd2b
Fixes for mbed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MiniTLS | 2:527a66d0a1a9 | 1 | /* |
MiniTLS | 2:527a66d0a1a9 | 2 | MiniTLS - A super trimmed down TLS/SSL Library for embedded devices |
MiniTLS | 2:527a66d0a1a9 | 3 | Author: Donatien Garnier |
MiniTLS | 2:527a66d0a1a9 | 4 | Copyright (C) 2013-2014 AppNearMe Ltd |
MiniTLS | 2:527a66d0a1a9 | 5 | |
MiniTLS | 2:527a66d0a1a9 | 6 | This program is free software; you can redistribute it and/or |
MiniTLS | 2:527a66d0a1a9 | 7 | modify it under the terms of the GNU General Public License |
MiniTLS | 2:527a66d0a1a9 | 8 | as published by the Free Software Foundation; either version 2 |
MiniTLS | 2:527a66d0a1a9 | 9 | of the License, or (at your option) any later version. |
MiniTLS | 2:527a66d0a1a9 | 10 | |
MiniTLS | 2:527a66d0a1a9 | 11 | This program is distributed in the hope that it will be useful, |
MiniTLS | 2:527a66d0a1a9 | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
MiniTLS | 2:527a66d0a1a9 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MiniTLS | 2:527a66d0a1a9 | 14 | GNU General Public License for more details. |
MiniTLS | 2:527a66d0a1a9 | 15 | |
MiniTLS | 2:527a66d0a1a9 | 16 | You should have received a copy of the GNU General Public License |
MiniTLS | 2:527a66d0a1a9 | 17 | along with this program; if not, write to the Free Software |
MiniTLS | 2:527a66d0a1a9 | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
MiniTLS | 2:527a66d0a1a9 | 19 | *//** |
MiniTLS | 2:527a66d0a1a9 | 20 | * \file fwk.h |
MiniTLS | 2:527a66d0a1a9 | 21 | * \copyright Copyright (c) AppNearMe Ltd 2013 |
MiniTLS | 2:527a66d0a1a9 | 22 | * \author Donatien Garnier |
MiniTLS | 2:527a66d0a1a9 | 23 | * \details Standard include and defines |
MiniTLS | 2:527a66d0a1a9 | 24 | */ |
MiniTLS | 2:527a66d0a1a9 | 25 | |
MiniTLS | 2:527a66d0a1a9 | 26 | #ifndef FWK_H_ |
MiniTLS | 2:527a66d0a1a9 | 27 | #define FWK_H_ |
MiniTLS | 2:527a66d0a1a9 | 28 | |
MiniTLS | 2:527a66d0a1a9 | 29 | //Standard types definition |
MiniTLS | 2:527a66d0a1a9 | 30 | #include "stdint.h" |
MiniTLS | 2:527a66d0a1a9 | 31 | #include "stdbool.h" |
MiniTLS | 2:527a66d0a1a9 | 32 | #include "stddef.h" |
MiniTLS | 2:527a66d0a1a9 | 33 | |
MiniTLS | 2:527a66d0a1a9 | 34 | #include "string.h" |
MiniTLS | 2:527a66d0a1a9 | 35 | |
MiniTLS | 2:527a66d0a1a9 | 36 | //NULL pointer definition |
MiniTLS | 2:527a66d0a1a9 | 37 | #ifndef NULL |
MiniTLS | 2:527a66d0a1a9 | 38 | #define NULL ((void*)0) |
MiniTLS | 2:527a66d0a1a9 | 39 | #endif |
MiniTLS | 2:527a66d0a1a9 | 40 | |
MiniTLS | 2:527a66d0a1a9 | 41 | //Debugging |
MiniTLS | 2:527a66d0a1a9 | 42 | #include "debug.h" |
MiniTLS | 2:527a66d0a1a9 | 43 | |
MiniTLS | 2:527a66d0a1a9 | 44 | //Buffer |
MiniTLS | 2:527a66d0a1a9 | 45 | #include "buffer.h" |
MiniTLS | 2:527a66d0a1a9 | 46 | #include "buffer_network.h" |
MiniTLS | 2:527a66d0a1a9 | 47 | |
MiniTLS | 2:527a66d0a1a9 | 48 | //RTOS |
MiniTLS | 3:eb324ffffd2b | 49 | //#include "rtos.h" -- not for mbed |
MiniTLS | 3:eb324ffffd2b | 50 | //Must be defined by impl |
MiniTLS | 3:eb324ffffd2b | 51 | struct rtos_mtx_struct; |
MiniTLS | 3:eb324ffffd2b | 52 | struct rtos_sem_struct; |
MiniTLS | 3:eb324ffffd2b | 53 | |
MiniTLS | 3:eb324ffffd2b | 54 | //Typedefs |
MiniTLS | 3:eb324ffffd2b | 55 | typedef struct rtos_mtx_struct rtos_mtx_t; |
MiniTLS | 3:eb324ffffd2b | 56 | typedef struct rtos_sem_struct rtos_sem_t; |
MiniTLS | 3:eb324ffffd2b | 57 | |
MiniTLS | 3:eb324ffffd2b | 58 | //Semaphores |
MiniTLS | 3:eb324ffffd2b | 59 | rtos_sem_t* rtos_sem_create(int max, int count); |
MiniTLS | 3:eb324ffffd2b | 60 | bool rtos_sem_get(rtos_sem_t* pSem, int timeout); |
MiniTLS | 3:eb324ffffd2b | 61 | void rtos_sem_give(rtos_sem_t* pSem/*, int timeout*/); //Saturated |
MiniTLS | 3:eb324ffffd2b | 62 | |
MiniTLS | 3:eb324ffffd2b | 63 | //Mutexes |
MiniTLS | 3:eb324ffffd2b | 64 | rtos_mtx_t* rtos_mtx_create(void); |
MiniTLS | 3:eb324ffffd2b | 65 | void rtos_mtx_lock(rtos_mtx_t* pMtx); |
MiniTLS | 3:eb324ffffd2b | 66 | void rtos_mtx_unlock(rtos_mtx_t* pMtx); |
MiniTLS | 3:eb324ffffd2b | 67 | |
MiniTLS | 3:eb324ffffd2b | 68 | |
MiniTLS | 2:527a66d0a1a9 | 69 | |
MiniTLS | 2:527a66d0a1a9 | 70 | //Macros |
MiniTLS | 2:527a66d0a1a9 | 71 | #define MAX(a,b) (((a)>(b))?(a):(b)) |
MiniTLS | 2:527a66d0a1a9 | 72 | #define MIN(a,b) (((a)<(b))?(a):(b)) |
MiniTLS | 2:527a66d0a1a9 | 73 | |
MiniTLS | 2:527a66d0a1a9 | 74 | //Pack |
MiniTLS | 2:527a66d0a1a9 | 75 | #ifdef __GNUC__ |
MiniTLS | 2:527a66d0a1a9 | 76 | #define PACKED __attribute__ ((packed)) |
MiniTLS | 2:527a66d0a1a9 | 77 | #else |
MiniTLS | 2:527a66d0a1a9 | 78 | #define PACKED |
MiniTLS | 2:527a66d0a1a9 | 79 | #endif |
MiniTLS | 2:527a66d0a1a9 | 80 | |
MiniTLS | 2:527a66d0a1a9 | 81 | #endif /* FWK_H_ */ |