1 // ---------------------------------------------------------------------------- 2 // Copyright (C) 2019 3 // David Freese, W1HKJ 4 // 5 // This file is part of fldigi 6 // 7 // fldigi is free software; you can redistribute it and/or modify 8 // it under the terms of the GNU General Public License as published by 9 // the Free Software Foundation; either version 3 of the License, or 10 // (at your option) any later version. 11 // 12 // fldigi is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // along with this program. If not, see <http://www.gnu.org/licenses/>. 19 // ---------------------------------------------------------------------------- 20 21 #ifndef HTTPS_CLIENT_HTTPS_H 22 #define HTTPS_CLIENT_HTTPS_H 23 24 /* 25 #include "mbedtls/net.h" 26 #include "mbedtls/entropy.h" 27 #include "mbedtls/ctr_drbg.h" 28 #include "mbedtls/error.h" 29 #include "mbedtls/certs.h" 30 31 #define H_FIELD_SIZE 512 32 #define H_READ_SIZE 2048 33 34 //#undef TRUE 35 //#undef FALSE 36 37 //#define TRUE 1 38 //#define FALSE 0 39 40 //extern char ca_crt_rsa[]; 41 //extern size_t ca_crt_rsa_size; 42 43 typedef struct 44 { 45 char method[8]; 46 int status; 47 char content_type[H_FIELD_SIZE]; 48 long content_length; 49 bool chunked; 50 bool close; 51 char location[H_FIELD_SIZE]; 52 char referrer[H_FIELD_SIZE]; 53 char cookie[H_FIELD_SIZE]; 54 char boundary[H_FIELD_SIZE]; 55 56 } HTTP_HEADER; 57 58 typedef struct 59 { 60 bool verify; 61 62 mbedtls_net_context ssl_fd; 63 mbedtls_entropy_context entropy; 64 mbedtls_ctr_drbg_context ctr_drbg; 65 mbedtls_ssl_context ssl; 66 mbedtls_ssl_config conf; 67 mbedtls_x509_crt cacert; 68 69 } HTTP_SSL; 70 71 typedef struct { 72 73 bool https; 74 char host[256]; 75 char port[8]; 76 char path[H_FIELD_SIZE]; 77 78 } HTTP_URL; 79 80 typedef struct 81 { 82 HTTP_URL url; 83 84 HTTP_HEADER request; 85 HTTP_HEADER response; 86 HTTP_SSL tls; 87 88 long length; 89 char r_buf[H_READ_SIZE]; 90 long r_len; 91 bool header_end; 92 char *body; 93 long body_size; 94 long body_len; 95 96 97 } HTTP_INFO; 98 */ 99 100 #endif //HTTPS_CLIENT_HTTPS_H 101 102