Lines Matching refs:d1

102     DTLS1_STATE *d1;
106 if ((d1 = OPENSSL_malloc(sizeof *d1)) == NULL)
108 memset(d1, 0, sizeof *d1);
110 /* d1->handshake_epoch=0; */
112 d1->bitmap.length = 64;
114 d1->bitmap.length = sizeof(d1->bitmap.map) * 8;
116 pq_64bit_init(&(d1->bitmap.map));
117 pq_64bit_init(&(d1->bitmap.max_seq_num));
119 d1->next_bitmap.length = d1->bitmap.length;
120 pq_64bit_init(&(d1->next_bitmap.map));
121 pq_64bit_init(&(d1->next_bitmap.max_seq_num));
123 d1->unprocessed_rcds.q = pqueue_new();
124 d1->processed_rcds.q = pqueue_new();
125 d1->buffered_messages = pqueue_new();
126 d1->sent_messages = pqueue_new();
127 d1->buffered_app_data.q = pqueue_new();
130 d1->cookie_len = sizeof(s->d1->cookie);
133 if (!d1->unprocessed_rcds.q || !d1->processed_rcds.q
134 || !d1->buffered_messages || !d1->sent_messages
135 || !d1->buffered_app_data.q) {
136 if (d1->unprocessed_rcds.q)
137 pqueue_free(d1->unprocessed_rcds.q);
138 if (d1->processed_rcds.q)
139 pqueue_free(d1->processed_rcds.q);
140 if (d1->buffered_messages)
141 pqueue_free(d1->buffered_messages);
142 if (d1->sent_messages)
143 pqueue_free(d1->sent_messages);
144 if (d1->buffered_app_data.q)
145 pqueue_free(d1->buffered_app_data.q);
146 OPENSSL_free(d1);
150 s->d1 = d1;
160 while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) {
169 while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) {
178 while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) {
196 while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) {
209 while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) {
224 pqueue_free(s->d1->unprocessed_rcds.q);
225 pqueue_free(s->d1->processed_rcds.q);
226 pqueue_free(s->d1->buffered_messages);
227 pqueue_free(s->d1->sent_messages);
228 pqueue_free(s->d1->buffered_app_data.q);
230 pq_64bit_free(&(s->d1->bitmap.map));
231 pq_64bit_free(&(s->d1->bitmap.max_seq_num));
233 pq_64bit_free(&(s->d1->next_bitmap.map));
234 pq_64bit_free(&(s->d1->next_bitmap.max_seq_num));
236 OPENSSL_free(s->d1);
237 s->d1 = NULL;
249 if (s->d1) {
250 unprocessed_rcds = s->d1->unprocessed_rcds.q;
251 processed_rcds = s->d1->processed_rcds.q;
252 buffered_messages = s->d1->buffered_messages;
253 sent_messages = s->d1->sent_messages;
254 buffered_app_data = s->d1->buffered_app_data.q;
255 mtu = s->d1->mtu;
259 pq_64bit_free(&(s->d1->bitmap.map));
260 pq_64bit_free(&(s->d1->bitmap.max_seq_num));
262 pq_64bit_free(&(s->d1->next_bitmap.map));
263 pq_64bit_free(&(s->d1->next_bitmap.max_seq_num));
265 memset(s->d1, 0, sizeof(*(s->d1)));
268 s->d1->cookie_len = sizeof(s->d1->cookie);
272 s->d1->mtu = mtu;
275 s->d1->unprocessed_rcds.q = unprocessed_rcds;
276 s->d1->processed_rcds.q = processed_rcds;
277 s->d1->buffered_messages = buffered_messages;
278 s->d1->sent_messages = sent_messages;
279 s->d1->buffered_app_data.q = buffered_app_data;
282 s->d1->bitmap.length = 64;
284 s->d1->bitmap.length = sizeof(s->d1->bitmap.map) * 8;
286 pq_64bit_init(&(s->d1->bitmap.map));
287 pq_64bit_init(&(s->d1->bitmap.max_seq_num));
289 s->d1->next_bitmap.length = s->d1->bitmap.length;
290 pq_64bit_init(&(s->d1->next_bitmap.map));
291 pq_64bit_init(&(s->d1->next_bitmap.max_seq_num));
361 if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) {
362 s->d1->timeout_duration = 1;
366 get_current_time(&(s->d1->next_timeout));
369 s->d1->next_timeout.tv_sec += s->d1->timeout_duration;
371 &(s->d1->next_timeout));
379 if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) {
387 if (s->d1->next_timeout.tv_sec < timenow.tv_sec ||
388 (s->d1->next_timeout.tv_sec == timenow.tv_sec &&
389 s->d1->next_timeout.tv_usec <= timenow.tv_usec)) {
395 memcpy(timeleft, &(s->d1->next_timeout), sizeof(struct timeval));
434 s->d1->timeout_duration *= 2;
435 if (s->d1->timeout_duration > 60)
436 s->d1->timeout_duration = 60;
443 memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st));
444 memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
445 s->d1->timeout_duration = 1;
447 &(s->d1->next_timeout));
454 s->d1->timeout.num_alerts++;
457 if (s->d1->timeout.num_alerts > 2) {
458 s->d1->mtu =
463 if (s->d1->timeout.num_alerts > DTLS1_TMO_ALERT_COUNT) {
484 s->d1->timeout.read_timeouts++;
485 if (s->d1->timeout.read_timeouts > DTLS1_TMO_READ_COUNT) {
486 s->d1->timeout.read_timeouts = 1;
518 s->d1->listen = 1;