Embedded TCP/IP stack: fnet_tls.h Source File

FNET

fnet_tls.h
1 /**************************************************************************
2 *
3 * Copyright 2015-2016 by Andrey Butok. FNET Community.
4 *
5 ***************************************************************************
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ***************************************************************************
20 *
21 * TLS Library API.
22 *
23 ***************************************************************************/
24 #ifndef _FNET_TLS_H_
25 
26 #define _FNET_TLS_H_
27 
28 #if FNET_CFG_TLS || defined(__DOXYGEN__)
29 
51 /**************************************************************************/
55 typedef void *fnet_tls_desc_t;
56 
57 /**************************************************************************/
61 typedef void *fnet_tls_socket_t;
62 
63 #if 0 /* Not supported yet.*/
64 /**************************************************************************/
67 typedef enum
68 {
69  FNET_TLS_ROLE_SERVER = 1,
70  FNET_TLS_ROLE_CLIENT = 2
71 } fnet_tls_role_t;
72 #endif
73 
74 /**************************************************************************/
78 {
79 #if 0 /* Not supported yet.*/
80  fnet_tls_role_t role;
81 #endif
82  const fnet_uint8_t *certificate_buffer;
84  const fnet_uint8_t *private_key_buffer;
86 #if 0 /* Not supported yet.*/
87  char *ca_certificate_buffer;
89  fnet_size_t ca_certificate_buffer_size;
90 #endif
91 };
92 
93 #if defined(__cplusplus)
94 extern "C" {
95 #endif
96 
97 /***************************************************************************/
118 
119 /***************************************************************************/
132 void fnet_tls_release(fnet_tls_desc_t tls_desc);
133 
134 /***************************************************************************/
157 
158 /***************************************************************************/
175 
176 /***************************************************************************/
202 fnet_ssize_t fnet_tls_socket_recv(fnet_tls_socket_t tls_sock, fnet_uint8_t *buf, fnet_size_t len);
203 
204 /***************************************************************************/
229 fnet_ssize_t fnet_tls_socket_send(fnet_tls_socket_t tls_sock, fnet_uint8_t *buf, fnet_size_t len);
230 
231 #if defined(__cplusplus)
232 }
233 #endif
234 
237 #endif /* FNET_CFG_TLS */
238 
239 #endif /* _FNET_TLS_H_ */
void fnet_tls_socket_close(fnet_tls_socket_t tls_sock)
Closes the TLS socket.
const fnet_uint8_t * certificate_buffer
Buffer holding the Client or Server Certificate data, in PEM or DER format.
Definition: fnet_tls.h:82
void * fnet_tls_desc_t
TLS context descriptor.
Definition: fnet_tls.h:55
fnet_tls_desc_t fnet_tls_init(struct fnet_tls_params *params)
Initializes the TLS context.
void * fnet_socket_t
Socket descriptor.
Definition: fnet_socket.h:643
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:56
Input parameters structure for fnet_tls_init()
Definition: fnet_tls.h:77
const fnet_uint8_t * private_key_buffer
Buffer holding the private key, in PEM or DER format.
Definition: fnet_tls.h:84
fnet_ssize_t fnet_tls_socket_recv(fnet_tls_socket_t tls_sock, fnet_uint8_t *buf, fnet_size_t len)
Receives data from a TLS socket.
void * fnet_tls_socket_t
TLS socket descriptor.
Definition: fnet_tls.h:61
fnet_ssize_t fnet_tls_socket_send(fnet_tls_socket_t tls_sock, fnet_uint8_t *buf, fnet_size_t len)
Sends data on a TLS socket.
fnet_size_t private_key_buffer_size
Size of the private key buffer (including the terminating null byte for PEM data).
Definition: fnet_tls.h:85
fnet_size_t certificate_buffer_size
Size of the certificate buffer (including the terminating null byte for PEM data).
Definition: fnet_tls.h:83
fnet_tls_socket_t fnet_tls_socket(fnet_tls_desc_t tls_desc, fnet_socket_t sock)
Creates the TLS socket.
void fnet_tls_release(fnet_tls_desc_t tls_desc)
Releases the TLS context.
long fnet_ssize_t
Signed integer type representing the size in bytes.
Definition: fnet_stdlib.h:61

© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net