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_delete PORTABLE C */ 32 /* 6.1 */ 33 /* AUTHOR */ 34 /* */ 35 /* Timothy Stapko, Microsoft Corporation */ 36 /* */ 37 /* DESCRIPTION */ 38 /* */ 39 /* This function checks for errors when deleting a DTLS server. */ 40 /* */ 41 /* INPUT */ 42 /* */ 43 /* server_ptr DTLS server control block */ 44 /* */ 45 /* OUTPUT */ 46 /* */ 47 /* status Completion status */ 48 /* */ 49 /* CALLS */ 50 /* */ 51 /* _nx_secure_dtls_server_delete Actual function call */ 52 /* */ 53 /* CALLED BY */ 54 /* */ 55 /* Application Code */ 56 /* */ 57 /* RELEASE HISTORY */ 58 /* */ 59 /* DATE NAME DESCRIPTION */ 60 /* */ 61 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ 62 /* 09-30-2020 Timothy Stapko Modified comment(s), */ 63 /* resulting in version 6.1 */ 64 /* */ 65 /**************************************************************************/ _nxe_secure_dtls_server_delete(NX_SECURE_DTLS_SERVER * server_ptr)66UINT _nxe_secure_dtls_server_delete(NX_SECURE_DTLS_SERVER *server_ptr) 67 { 68 #ifdef NX_SECURE_ENABLE_DTLS 69 UINT status = NX_SUCCESS; 70 NX_SECURE_DTLS_SERVER *temp_server; 71 72 /* Check pointer */ 73 if(server_ptr == NX_NULL) 74 { 75 return(NX_PTR_ERROR); 76 } 77 78 temp_server = _nx_secure_dtls_server_created_ptr; 79 for (;;) 80 { 81 if (temp_server == NX_NULL) 82 { 83 84 /* No session created. */ 85 return(NX_PTR_ERROR); 86 } 87 88 if (temp_server == server_ptr) 89 { 90 91 /* Found the server to delete. */ 92 break; 93 } 94 95 temp_server = temp_server -> nx_dtls_server_created_next; 96 97 if (temp_server == _nx_secure_dtls_server_created_ptr) 98 { 99 100 /* This server is not created. */ 101 return(NX_PTR_ERROR); 102 } 103 } 104 105 /* Call actual function. */ 106 status = _nx_secure_dtls_server_delete(server_ptr); 107 108 return(status); 109 #else 110 NX_PARAMETER_NOT_USED(server_ptr); 111 112 return(NX_NOT_SUPPORTED); 113 #endif /* NX_SECURE_ENABLE_DTLS */ 114 } 115 116