1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** NetX Secure Component                                                 */
17 /**                                                                       */
18 /**    Datagram Transport Layer Security (DTLS)                           */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define NX_SECURE_SOURCE_CODE
24 
25 #include "nx_secure_dtls.h"
26 
27 /**************************************************************************/
28 /*                                                                        */
29 /*  FUNCTION                                               RELEASE        */
30 /*                                                                        */
31 /*    _nx_secure_dtls_server_session_send                 PORTABLE C      */
32 /*                                                           6.1          */
33 /*  AUTHOR                                                                */
34 /*                                                                        */
35 /*    Timothy Stapko, Microsoft Corporation                               */
36 /*                                                                        */
37 /*  DESCRIPTION                                                           */
38 /*                                                                        */
39 /*    This function sends data using an active DTLS Server session,       */
40 /*    handling all encryption and hashing before sending data over the    */
41 /*    UDP socket to the internally-stored IP address and port.            */
42 /*                                                                        */
43 /*  INPUT                                                                 */
44 /*                                                                        */
45 /*    dtls_session                          DTLS control block            */
46 /*    packet_ptr                            Pointer to packet data        */
47 /*                                                                        */
48 /*  OUTPUT                                                                */
49 /*                                                                        */
50 /*    status                                Completion status             */
51 /*                                                                        */
52 /*  CALLS                                                                 */
53 /*                                                                        */
54 /*    _nx_secure_dtls_session_send          Send DTLS encrypted record    */
55 /*                                                                        */
56 /*  CALLED BY                                                             */
57 /*                                                                        */
58 /*    Application Code                                                    */
59 /*                                                                        */
60 /*  RELEASE HISTORY                                                       */
61 /*                                                                        */
62 /*    DATE              NAME                      DESCRIPTION             */
63 /*                                                                        */
64 /*  05-19-2020     Timothy Stapko           Initial Version 6.0           */
65 /*  09-30-2020     Timothy Stapko           Modified comment(s),          */
66 /*                                            resulting in version 6.1    */
67 /*                                                                        */
68 /**************************************************************************/
_nx_secure_dtls_server_session_send(NX_SECURE_DTLS_SESSION * dtls_session,NX_PACKET * packet_ptr)69 UINT _nx_secure_dtls_server_session_send(NX_SECURE_DTLS_SESSION *dtls_session, NX_PACKET *packet_ptr)
70 {
71 #ifdef NX_SECURE_ENABLE_DTLS
72 UINT status;
73 
74     status = _nx_secure_dtls_session_send(dtls_session, packet_ptr, &(dtls_session->nx_secure_dtls_remote_ip_address), dtls_session->nx_secure_dtls_remote_port);
75 
76     return(status);
77 #else
78     NX_PARAMETER_NOT_USED(dtls_session);
79     NX_PARAMETER_NOT_USED(packet_ptr);
80 
81     return(NX_NOT_SUPPORTED);
82 #endif /* NX_SECURE_ENABLE_DTLS */
83 }
84 
85