1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** NetX Secure Component */
16 /** */
17 /** Datagram Transport Layer Security (DTLS) */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define NX_SECURE_SOURCE_CODE
23
24 #include "nx_secure_dtls.h"
25
26 /**************************************************************************/
27 /* */
28 /* FUNCTION RELEASE */
29 /* */
30 /* _nxe_secure_dtls_server_notify_set PORTABLE C */
31 /* 6.1 */
32 /* AUTHOR */
33 /* */
34 /* Timothy Stapko, Microsoft Corporation */
35 /* */
36 /* DESCRIPTION */
37 /* */
38 /* This function checks for errors when assigning the optional notify */
39 /* callbacks to a DTLS server instance. */
40 /* */
41 /* INPUT */
42 /* */
43 /* server_ptr DTLS server control block */
44 /* disconnect_notify DTLS disconnect callback */
45 /* error_notify DTLS error callback */
46 /* */
47 /* OUTPUT */
48 /* */
49 /* status Completion status */
50 /* */
51 /* CALLS */
52 /* */
53 /* _nx_secure_dtls_server_notify_set 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_notify_set(NX_SECURE_DTLS_SERVER * server_ptr,UINT (* disconnect_notify)(NX_SECURE_DTLS_SESSION * dtls_session),UINT (* error_notify)(NX_SECURE_DTLS_SESSION * dtls_session,UINT error_code))68 UINT _nxe_secure_dtls_server_notify_set(NX_SECURE_DTLS_SERVER *server_ptr,
69 UINT (*disconnect_notify)(NX_SECURE_DTLS_SESSION *dtls_session),
70 UINT (*error_notify)(NX_SECURE_DTLS_SESSION *dtls_session, UINT error_code))
71
72
73 {
74 #ifdef NX_SECURE_ENABLE_DTLS
75 UINT status;
76
77 if(server_ptr == NX_NULL)
78 {
79 return(NX_PTR_ERROR);
80 }
81
82 /* Actual function call. */
83 status = _nx_secure_dtls_server_notify_set(server_ptr, disconnect_notify, error_notify);
84
85 return(status);
86 #else
87 NX_PARAMETER_NOT_USED(server_ptr);
88 NX_PARAMETER_NOT_USED(disconnect_notify);
89 NX_PARAMETER_NOT_USED(error_notify);
90
91 return(NX_NOT_SUPPORTED);
92 #endif /* NX_SECURE_ENABLE_DTLS */
93 }
94
95