Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
#define NX_SECURE_SOURCE_CODE
#include "nx_secure_dtls.h"
...
...
_nx_secure_dtls_session_reset(NX_SECURE_DTLS_SESSION *)
Files
loading...
SourceVuSTM32 Libraries and Samplesnetxduonx_secure/src/nx_secure_dtls_session_reset.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ ... /**************************************************************************/ /**************************************************************************/ /** */ /** NetX Secure Component */ /** */ /** Datagram Transport Layer Security (DTLS) */ /** */... /**************************************************************************/ /**************************************************************************/ #define NX_SECURE_SOURCE_CODE #include "nx_secure_dtls.h" ... /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _nx_secure_dtls_session_reset PORTABLE C */ /* 6.1.10 */ /* AUTHOR */ /* */ /* Timothy Stapko, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function resets a DTLS session object, clearing out all data */ /* for initialization or re-use. */ /* */ /* INPUT */ /* */ /* dtls_session DTLS session control block */ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* tx_thread_wait_abort Abort wait process */ /* tx_mutex_get Get protection mutex */ /* tx_mutex_put Put protection mutex */ /* _nx_secure_tls_session_reset Clear out the session */ /* nx_secure_tls_packet_release Release packet */ /* */ /* CALLED BY */ /* */ /* Application */ /* _nx_secure_dtls_server_stop Stop DTLS server */ /* _nx_secure_dtls_session_delete Delete the DTLS session */ /* _nx_secure_dtls_session_end End of a session */ /* nx_secure_dtls_session_cache_delete Delete a session */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ /* 09-30-2020 Timothy Stapko Modified comment(s), */ /* released packet securely, */ /* resulting in version 6.1 */ /* 01-31-2022 Timothy Stapko Modified comment(s), */ /* updated cookie handling, */ /* resulting in version 6.1.10 */ /* */... /**************************************************************************/ UINT _nx_secure_dtls_session_reset(NX_SECURE_DTLS_SESSION *dtls_session) { #ifdef NX_SECURE_ENABLE_DTLS NX_PACKET *packet_ptr = NX_NULL; NX_PACKET *next_packet_ptr; /* Get the protection. */ tx_mutex_get(&_nx_secure_tls_protection, TX_WAIT_FOREVER); /* UDP doesn't have a persistent state like TCP, so save off IP address index and Port. */ dtls_session -> nx_secure_dtls_local_ip_address_index = 0xffffffff; dtls_session -> nx_secure_dtls_local_port = 0; /* Reset remote port and address. */ dtls_session -> nx_secure_dtls_remote_ip_address.nxd_ip_version = 0; dtls_session -> nx_secure_dtls_remote_port = 0; /* Reset session state. */ dtls_session -> nx_secure_dtls_session_in_use = NX_FALSE; /* Reset the cookie. */ dtls_session -> nx_secure_dtls_cookie_length = 0; NX_SECURE_MEMSET(dtls_session -> nx_secure_dtls_cookie, 0, sizeof(dtls_session -> nx_secure_dtls_cookie)); dtls_session -> nx_secure_dtls_client_cookie_ptr = NX_NULL; /* Reset the fragment length. */ dtls_session -> nx_secure_dtls_fragment_length = 0; /* Reset the handshake sequence numbers. */ dtls_session -> nx_secure_dtls_local_handshake_sequence = 0; dtls_session -> nx_secure_dtls_remote_handshake_sequence = 0; dtls_session -> nx_secure_dtls_expected_handshake_sequence = 0; /* Reset the DTLS epoch. */ dtls_session -> nx_secure_dtls_local_epoch = 0; dtls_session -> nx_secure_dtls_remote_epoch = 0; /* Is there any thread waiting for packet? */ if (dtls_session -> nx_secure_dtls_thread_suspended) { /* Yes. Just abort it. */ tx_thread_wait_abort(dtls_session -> nx_secure_dtls_thread_suspended); dtls_session -> nx_secure_dtls_thread_suspended = NX_NULL; }if (dtls_session -> nx_secure_dtls_thread_suspended) { ... } /* Reset the receive queue. */ if (dtls_session -> nx_secure_dtls_receive_queue_head) { packet_ptr = dtls_session -> nx_secure_dtls_receive_queue_head; dtls_session -> nx_secure_dtls_receive_queue_head = NX_NULL; }if (dtls_session -> nx_secure_dtls_receive_queue_head) { ... } /* Reset the internal TLS session state. */ _nx_secure_tls_session_reset(&dtls_session -> nx_secure_dtls_tls_session); /* Release the protection. */ tx_mutex_put(&_nx_secure_tls_protection); /* Release the queued packets. */ while (packet_ptr) { next_packet_ptr = packet_ptr -> nx_packet_queue_next; nx_secure_tls_packet_release(packet_ptr); packet_ptr = next_packet_ptr; }while (packet_ptr) { ... } return(NX_SUCCESS);/* ... */ #else NX_PARAMETER_NOT_USED(dtls_session); return(NX_NOT_SUPPORTED);/* ... */ #endif /* NX_SECURE_ENABLE_DTLS */ }{ ... }
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.