|
6 | 6 | #ifndef INCLUDE_NET_SOCKETS_H_
|
7 | 7 | #define INCLUDE_NET_SOCKETS_H_
|
8 | 8 |
|
| 9 | +#include <stdint.h> |
| 10 | + |
9 | 11 | #ifdef __cplusplus
|
10 | 12 | extern "C" {
|
11 | 13 | #endif
|
@@ -42,25 +44,6 @@ enum sock_events_e {
|
42 | 44 | SOCK_EV_GPRS_FAILED, /**< GPRS bearer failed. */
|
43 | 45 | };
|
44 | 46 |
|
45 |
| -/** |
46 |
| - * SSL version |
47 |
| - */ |
48 |
| -enum ssl_ver_e { |
49 |
| - SSL_VER_DEFAULT, /**< Default SSL version (TLS 1.2) */ |
50 |
| - TLS_VER_1V2 = SSL_VER_DEFAULT,/**< TLS v1.2 */ |
51 |
| - TLS_VER_1V1, /**< TLS v1.1 */ |
52 |
| - TLS_VER_1V0, /**< TLS v1.0 */ |
53 |
| - SSL_VER_3V0, /**< SSL v3 */ |
54 |
| -}; |
55 |
| - |
56 |
| -/** |
57 |
| - * SSL certificate input type |
58 |
| - */ |
59 |
| -enum ssl_type_e { |
60 |
| - SSL_TYPE_BUFFER,/**< certificate provided as a buffer */ |
61 |
| - SSL_TYPE_FILE /**< certificate provided as a filename */ |
62 |
| -}; |
63 |
| - |
64 | 47 | /**
|
65 | 48 | * Socket callback structure
|
66 | 49 | */
|
@@ -110,20 +93,20 @@ struct sockopt_t {
|
110 | 93 | struct ssl_sockopt_t {
|
111 | 94 | char server_ip[100]; /**< IP/Domain name of server */
|
112 | 95 | int port; /**< SSL server port */
|
113 |
| - int (*status_callback)(int sockid, int status); /**< SSL socket status callback */ |
114 | 96 | void *arg; /**< user data to associate with socket */
|
| 97 | + uint32_t timeout; /**< SSL handshake timeout in seconds, 0 for default timeout */ |
115 | 98 | };
|
116 | 99 |
|
117 | 100 | /**
|
118 | 101 | * SSL client certificates
|
119 | 102 | */
|
120 | 103 | struct ssl_certs_t {
|
121 |
| - int cert_type; /**< Input type see @ref ssl_type_e */ |
122 |
| - const void *cert; /**< filename/buffer containing certificate (Only PEM format supported) */ |
123 |
| - int cert_len; /**< Length of certificate in case buffer is provided */ |
124 |
| - int pkey_type; /**< Input type see @ref ssl_type_e */ |
125 |
| - const void *privatekey; /**< filename/buffer containing private key (Only PEM format supported) */ |
126 |
| - int privatekey_len; /**< Length of private key in case buffer is provided */ |
| 104 | + const char *rootca; /**< buffer containing Root CA */ |
| 105 | + int rootca_len; /**< Length of Root CA buffer (with null) */ |
| 106 | + const char *cert; /**< buffer containing certificate */ |
| 107 | + int cert_len; /**< Length of certificate buffer (with null) */ |
| 108 | + const char *privatekey; /**< buffer containing private key */ |
| 109 | + int privatekey_len; /**< Length of private key buffer (with null) */ |
127 | 110 | };
|
128 | 111 |
|
129 | 112 | /* Normal Socket */
|
@@ -241,11 +224,10 @@ int socket_free(int id);
|
241 | 224 | /* SSL Sockets */
|
242 | 225 | /**
|
243 | 226 | * Request an SSL socket.
|
244 |
| - * @param ssl_version [in] SSL version @ref ssl_ver_e |
245 | 227 | * @param certs [in] SSL client certificate and private key. NULL if not used
|
246 | 228 | * @return On success SSL socket ID is returned, On error negative value is returned
|
247 | 229 | */
|
248 |
| -int ssl_socket_request(int ssl_version, struct ssl_certs_t *certs); |
| 230 | +int ssl_socket_request(struct ssl_certs_t *certs); |
249 | 231 |
|
250 | 232 | /**
|
251 | 233 | * Configure SSL socket
|
|
0 commit comments