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 /* _nxe_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 checks for errors when sending data over a DTLS */ 40 /* server session. */ 41 /* */ 42 /* INPUT */ 43 /* */ 44 /* dtls_session DTLS control block */ 45 /* packet_ptr Pointer to packet data */ 46 /* */ 47 /* OUTPUT */ 48 /* */ 49 /* status Completion status */ 50 /* */ 51 /* CALLS */ 52 /* */ 53 /* _nx_secure_dtls_server_session_send Actual function call */ 54 /* */ 55 /* CALLED BY */ 56 /* */ 57 /* Application Code */ 58 /* */ 59 /* RELEASE HISTORY */ 60 /* */ 61 /* DATE NAME DESCRIPTION */ 62 /* */ 63 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ 64 /* 09-30-2020 Timothy Stapko Modified comment(s), */ 65 /* resulting in version 6.1 */ 66 /* */ 67 /**************************************************************************/ _nxe_secure_dtls_server_session_send(NX_SECURE_DTLS_SESSION * dtls_session,NX_PACKET * packet_ptr)68UINT _nxe_secure_dtls_server_session_send(NX_SECURE_DTLS_SESSION *dtls_session, NX_PACKET *packet_ptr) 69 { 70 #ifdef NX_SECURE_ENABLE_DTLS 71 UINT status; 72 73 if (dtls_session == NX_NULL || packet_ptr == NX_NULL) 74 { 75 return(NX_PTR_ERROR); 76 } 77 78 /* Make sure the session is initialized. */ 79 if (dtls_session->nx_secure_dtls_tls_session.nx_secure_tls_id != NX_SECURE_TLS_ID) 80 { 81 return(NX_SECURE_TLS_SESSION_UNINITIALIZED); 82 } 83 84 /* Call actual function. */ 85 status = _nx_secure_dtls_server_session_send(dtls_session, packet_ptr); 86 87 return(status); 88 #else 89 NX_PARAMETER_NOT_USED(dtls_session); 90 NX_PARAMETER_NOT_USED(packet_ptr); 91 92 return(NX_NOT_SUPPORTED); 93 #endif /* NX_SECURE_ENABLE_DTLS */ 94 } 95 96