Developer World
Spresense Arduino Library
v3.3.0-b2e6327
TLSClient.h
1
/*
2
* TLSClient.h - TLSClient include file for Spresense Arduino
3
* Copyright 2019 Sony Semiconductor Solutions Corporation
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
*/
19
20
#ifndef _TLS_CLIENT_H_
21
#define _TLS_CLIENT_H_
22
23
#ifdef SUBCORE
24
#error "TLSClient library is NOT supported by SubCore."
25
#endif
26
27
/****************************************************************************
28
* Included Files
29
****************************************************************************/
30
31
#include <mbedtls/config.h>
32
#include <mbedtls/ctr_drbg.h>
33
#include <mbedtls/entropy.h>
34
#include <mbedtls/net_sockets.h>
35
#include <mbedtls/platform.h>
36
#include <mbedtls/ssl.h>
37
38
typedef
struct
tlsClientContext_s
39
{
40
mbedtls_ssl_context ssl;
41
mbedtls_ssl_config conf;
42
mbedtls_net_context serverFd;
43
mbedtls_ctr_drbg_context ctrDrbg;
44
mbedtls_entropy_context entropy;
45
mbedtls_x509_crt caCert;
46
mbedtls_x509_crt cliCert;
47
mbedtls_pk_context cliKey;
48
}
tlsClientContext_t
;
49
50
void
tlsInit(
tlsClientContext_t
*tlsCtx);
51
void
tlsShutdown(
tlsClientContext_t
*tlsCtx);
52
int
tlsConnect(
tlsClientContext_t
*tlsCtx,
const
char
*host, uint32_t port,
53
uint32_t timeout,
54
const
char
*rootCA,
size_t
rootCASize,
55
const
char
*clientCA,
size_t
clientCASize,
56
const
char
*privateKey,
size_t
privateKeySize);
57
int
tlsGetAvailable(
tlsClientContext_t
*tlsCtx);
58
int
tlsRead(
tlsClientContext_t
*tlsCtx, uint8_t *buffer,
int
len);
59
int
tlsWrite(
tlsClientContext_t
*tlsCtx,
const
uint8_t *buffer,
int
len,
60
uint32_t timeout);
61
62
#endif
tlsClientContext_s
Definition:
TLSClient.h:39
LTE
src
TLSClient.h
Generated by
1.9.4