Mistake on this page?
Report an issue in GitHub or email us
DTLSSocketWrapper.h
Go to the documentation of this file.
1 /** @file DTLSSocketWrapper.h DTLSSocketWrapper */
2 /*
3  * Copyright (c) 2018 ARM Limited
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 /** @addtogroup netsocket
19 * @{
20 */
21 
22 #ifndef DTLSSOCKETWRAPPER_H
23 #define DTLSSOCKETWRAPPER_H
24 
25 #include "TLSSocketWrapper.h"
26 #include "rtos/Kernel.h"
27 
28 // This class requires Mbed TLS SSL/TLS client code
29 #if defined(MBEDTLS_SSL_CLI_C) || defined(DOXYGEN_ONLY)
30 
31 /**
32  * \brief DTLSSocketWrapper implement DTLS stream over the existing Socket transport.
33  */
35 public:
36  /** Create a DTLSSocketWrapper.
37  *
38  * @param transport Underlying transport socket to wrap.
39  * @param hostname Hostname of the remote host, used for certificate checking.
40  * @param control Transport control mode. See @ref control_transport.
41  */
42  DTLSSocketWrapper(Socket *transport, const char *hostname = NULL, control_transport control = TRANSPORT_CONNECT_AND_CLOSE);
43 
44  /** Destroy a socket wrapper.
45  *
46  * Closes socket wrapper if the socket wrapper is still opened.
47  */
49 
50  nsapi_error_t close() override;
51 private:
52  static void timing_set_delay(void *ctx, uint32_t int_ms, uint32_t fin_ms);
53  static int timing_get_delay(void *ctx);
54  void timer_event();
55  rtos::Kernel::Clock::time_point _int_time;
56  int _timer_event_id = 0;
57  bool _timer_expired = false;
58 };
59 
60 #endif
61 #endif
62 /** @} */
nsapi_error_t close() override
Closes the socket.
~DTLSSocketWrapper()
Destroy a socket wrapper.
TLSSocket is a wrapper around Socket for interacting with TLS servers.
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:142
DTLSSocketWrapper(Socket *transport, const char *hostname=NULL, control_transport control=TRANSPORT_CONNECT_AND_CLOSE)
Create a DTLSSocketWrapper.
Socket interface.
Definition: Socket.h:40
Does call connect() and close() on transport socket.
control_transport
Transport modes.
TLSSocketWrapper.
DTLSSocketWrapper implement DTLS stream over the existing Socket transport.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.