change some parameters in the library to meet the needs of the website httpbin.org
Fork of MiniTLS-GPL by
tls/tls_socket.h@0:35aa5be3b78d, 2014-06-06 (annotated)
- Committer:
- MiniTLS
- Date:
- Fri Jun 06 10:49:02 2014 +0000
- Revision:
- 0:35aa5be3b78d
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MiniTLS | 0:35aa5be3b78d | 1 | /* |
MiniTLS | 0:35aa5be3b78d | 2 | MuTLS - A super trimmed down TLS/SSL Library for embedded devices |
MiniTLS | 0:35aa5be3b78d | 3 | Author: Donatien Garnier |
MiniTLS | 0:35aa5be3b78d | 4 | Copyright (C) 2013-2014 AppNearMe Ltd |
MiniTLS | 0:35aa5be3b78d | 5 | |
MiniTLS | 0:35aa5be3b78d | 6 | This program is free software; you can redistribute it and/or |
MiniTLS | 0:35aa5be3b78d | 7 | modify it under the terms of the GNU General Public License |
MiniTLS | 0:35aa5be3b78d | 8 | as published by the Free Software Foundation; either version 2 |
MiniTLS | 0:35aa5be3b78d | 9 | of the License, or (at your option) any later version. |
MiniTLS | 0:35aa5be3b78d | 10 | |
MiniTLS | 0:35aa5be3b78d | 11 | This program is distributed in the hope that it will be useful, |
MiniTLS | 0:35aa5be3b78d | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
MiniTLS | 0:35aa5be3b78d | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MiniTLS | 0:35aa5be3b78d | 14 | GNU General Public License for more details. |
MiniTLS | 0:35aa5be3b78d | 15 | |
MiniTLS | 0:35aa5be3b78d | 16 | You should have received a copy of the GNU General Public License |
MiniTLS | 0:35aa5be3b78d | 17 | along with this program; if not, write to the Free Software |
MiniTLS | 0:35aa5be3b78d | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
MiniTLS | 0:35aa5be3b78d | 19 | *//** |
MiniTLS | 0:35aa5be3b78d | 20 | * \file tls_socket.h |
MiniTLS | 0:35aa5be3b78d | 21 | * \copyright Copyright (c) AppNearMe Ltd 2013 |
MiniTLS | 0:35aa5be3b78d | 22 | * \author Donatien Garnier |
MiniTLS | 0:35aa5be3b78d | 23 | */ |
MiniTLS | 0:35aa5be3b78d | 24 | |
MiniTLS | 0:35aa5be3b78d | 25 | #ifndef TLS_SOCKET_H_ |
MiniTLS | 0:35aa5be3b78d | 26 | #define TLS_SOCKET_H_ |
MiniTLS | 0:35aa5be3b78d | 27 | |
MiniTLS | 0:35aa5be3b78d | 28 | #ifdef __cplusplus |
MiniTLS | 0:35aa5be3b78d | 29 | extern "C" { |
MiniTLS | 0:35aa5be3b78d | 30 | #endif |
MiniTLS | 0:35aa5be3b78d | 31 | |
MiniTLS | 0:35aa5be3b78d | 32 | #include "core/fwk.h" |
MiniTLS | 0:35aa5be3b78d | 33 | #include "inc/mutls_errors.h" |
MiniTLS | 0:35aa5be3b78d | 34 | /* |
MiniTLS | 0:35aa5be3b78d | 35 | typedef struct __tls_record tls_record_t; |
MiniTLS | 0:35aa5be3b78d | 36 | typedef struct __tls_handshake tls_handshake_t;*/ |
MiniTLS | 0:35aa5be3b78d | 37 | |
MiniTLS | 0:35aa5be3b78d | 38 | #include "tls_record.h" |
MiniTLS | 0:35aa5be3b78d | 39 | #include "tls_handshake.h" |
MiniTLS | 0:35aa5be3b78d | 40 | //#include "tls_ecc.h" |
MiniTLS | 0:35aa5be3b78d | 41 | #include "mutls.h" |
MiniTLS | 0:35aa5be3b78d | 42 | |
MiniTLS | 0:35aa5be3b78d | 43 | #include "tls_socket_defs.h" |
MiniTLS | 0:35aa5be3b78d | 44 | |
MiniTLS | 0:35aa5be3b78d | 45 | mutls_err_t tls_socket_init(tls_socket_t* sock, mutls_t* mutls, uint8_t* write_buffer, size_t write_buffer_size, uint8_t* read_buffer, size_t read_buffer_size); |
MiniTLS | 0:35aa5be3b78d | 46 | |
MiniTLS | 0:35aa5be3b78d | 47 | mutls_err_t tls_socket_connect(tls_socket_t* sock, const char* hostname, uint16_t port, int timeout); |
MiniTLS | 0:35aa5be3b78d | 48 | |
MiniTLS | 0:35aa5be3b78d | 49 | void tls_socket_copy_session(tls_socket_t* to, tls_socket_t* from); |
MiniTLS | 0:35aa5be3b78d | 50 | |
MiniTLS | 0:35aa5be3b78d | 51 | //Events API -- select like |
MiniTLS | 0:35aa5be3b78d | 52 | mutls_err_t tls_socket_event_list_init(tls_socket_event_list_t* list); |
MiniTLS | 0:35aa5be3b78d | 53 | mutls_err_t tls_socket_event_init_and_register(tls_socket_event_t* event, tls_socket_event_list_t* list, tls_socket_t* sock, bool read, bool write); |
MiniTLS | 0:35aa5be3b78d | 54 | mutls_err_t tls_socket_event_list_wait(tls_socket_event_list_t* list, int timeout); //All events unregistered at the end of wait, timeout in ms, -1 for infinite timeout |
MiniTLS | 0:35aa5be3b78d | 55 | |
MiniTLS | 0:35aa5be3b78d | 56 | //These calls are non-blocking |
MiniTLS | 0:35aa5be3b78d | 57 | mutls_err_t tls_socket_read(tls_socket_t* socket, uint8_t* bytes, size_t max_size, size_t* read_size); |
MiniTLS | 0:35aa5be3b78d | 58 | mutls_err_t tls_socket_write(tls_socket_t* socket, uint8_t* bytes, size_t size, size_t* written_size); |
MiniTLS | 0:35aa5be3b78d | 59 | |
MiniTLS | 0:35aa5be3b78d | 60 | //These calls are blocking |
MiniTLS | 0:35aa5be3b78d | 61 | mutls_err_t tls_socket_flush_read(tls_socket_t* socket, int timeout); |
MiniTLS | 0:35aa5be3b78d | 62 | mutls_err_t tls_socket_flush_write(tls_socket_t* socket, int timeout); |
MiniTLS | 0:35aa5be3b78d | 63 | |
MiniTLS | 0:35aa5be3b78d | 64 | //Called from record layer |
MiniTLS | 0:35aa5be3b78d | 65 | mutls_err_t tls_socket_readable_callback(tls_socket_t* sock, buffer_t* buffer); |
MiniTLS | 0:35aa5be3b78d | 66 | |
MiniTLS | 0:35aa5be3b78d | 67 | mutls_err_t tls_socket_close(tls_socket_t* sock); |
MiniTLS | 0:35aa5be3b78d | 68 | |
MiniTLS | 0:35aa5be3b78d | 69 | |
MiniTLS | 0:35aa5be3b78d | 70 | #ifdef __cplusplus |
MiniTLS | 0:35aa5be3b78d | 71 | } |
MiniTLS | 0:35aa5be3b78d | 72 | #endif |
MiniTLS | 0:35aa5be3b78d | 73 | |
MiniTLS | 0:35aa5be3b78d | 74 | #endif /* TLS_SOCKET_H_ */ |