Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MiniTLS-HTTPS-Example
tls_socket.h
00001 /* 00002 MiniTLS - A super trimmed down TLS/SSL Library for embedded devices 00003 Author: Donatien Garnier 00004 Copyright (C) 2013-2014 AppNearMe Ltd 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 *//** 00020 * \file tls_socket.h 00021 * \copyright Copyright (c) AppNearMe Ltd 2013 00022 * \author Donatien Garnier 00023 */ 00024 00025 #ifndef TLS_SOCKET_H_ 00026 #define TLS_SOCKET_H_ 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 #include "core/fwk.h" 00033 #include "inc/minitls_errors.h" 00034 /* 00035 typedef struct __tls_record tls_record_t; 00036 typedef struct __tls_handshake tls_handshake_t;*/ 00037 00038 #include "tls_record.h" 00039 #include "tls_handshake.h" 00040 //#include "tls_ecc.h" 00041 #include "minitls.h" 00042 00043 #include "tls_socket_defs.h" 00044 00045 minitls_err_t tls_socket_init(tls_socket_t* sock, minitls_t* minitls, uint8_t* write_buffer, size_t write_buffer_size, uint8_t* read_buffer, size_t read_buffer_size); 00046 00047 minitls_err_t tls_socket_connect(tls_socket_t* sock, const char* hostname, uint16_t port, int timeout); 00048 00049 void tls_socket_copy_session(tls_socket_t* to, tls_socket_t* from); 00050 00051 //Events API -- select like 00052 minitls_err_t tls_socket_event_list_init(tls_socket_event_list_t* list); 00053 minitls_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); 00054 minitls_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 00055 00056 //These calls are non-blocking 00057 minitls_err_t tls_socket_read(tls_socket_t* socket, uint8_t* bytes, size_t max_size, size_t* read_size); 00058 minitls_err_t tls_socket_write(tls_socket_t* socket, uint8_t* bytes, size_t size, size_t* written_size); 00059 00060 //These calls are blocking 00061 minitls_err_t tls_socket_flush_read(tls_socket_t* socket, int timeout); 00062 minitls_err_t tls_socket_flush_write(tls_socket_t* socket, int timeout); 00063 00064 //Called from record layer 00065 minitls_err_t tls_socket_readable_callback(tls_socket_t* sock, buffer_t* buffer); 00066 00067 minitls_err_t tls_socket_close(tls_socket_t* sock); 00068 00069 00070 #ifdef __cplusplus 00071 } 00072 #endif 00073 00074 #endif /* TLS_SOCKET_H_ */
Generated on Wed Jul 13 2022 00:22:55 by
1.7.2