Lines Matching refs:d1

97 	DTLS1_STATE *d1;
100 if ((d1=OPENSSL_malloc(sizeof *d1)) == NULL) return (0);
101 memset(d1,0, sizeof *d1);
103 /* d1->handshake_epoch=0; */
105 d1->unprocessed_rcds.q=pqueue_new();
106 d1->processed_rcds.q=pqueue_new();
107 d1->buffered_messages = pqueue_new();
108 d1->sent_messages=pqueue_new();
109 d1->buffered_app_data.q=pqueue_new();
113 d1->cookie_len = sizeof(s->d1->cookie);
116 if( ! d1->unprocessed_rcds.q || ! d1->processed_rcds.q
117 || ! d1->buffered_messages || ! d1->sent_messages || ! d1->buffered_app_data.q)
119 if ( d1->unprocessed_rcds.q) pqueue_free(d1->unprocessed_rcds.q);
120 if ( d1->processed_rcds.q) pqueue_free(d1->processed_rcds.q);
121 if ( d1->buffered_messages) pqueue_free(d1->buffered_messages);
122 if ( d1->sent_messages) pqueue_free(d1->sent_messages);
123 if ( d1->buffered_app_data.q) pqueue_free(d1->buffered_app_data.q);
124 OPENSSL_free(d1);
128 s->d1=d1;
139 while( (item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL)
150 while( (item = pqueue_pop(s->d1->processed_rcds.q)) != NULL)
161 while( (item = pqueue_pop(s->d1->buffered_messages)) != NULL)
169 while ( (item = pqueue_pop(s->d1->sent_messages)) != NULL)
177 while ( (item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL)
192 pqueue_free(s->d1->unprocessed_rcds.q);
193 pqueue_free(s->d1->processed_rcds.q);
194 pqueue_free(s->d1->buffered_messages);
195 pqueue_free(s->d1->sent_messages);
196 pqueue_free(s->d1->buffered_app_data.q);
198 OPENSSL_free(s->d1);
210 if (s->d1)
212 unprocessed_rcds = s->d1->unprocessed_rcds.q;
213 processed_rcds = s->d1->processed_rcds.q;
214 buffered_messages = s->d1->buffered_messages;
215 sent_messages = s->d1->sent_messages;
216 buffered_app_data = s->d1->buffered_app_data.q;
217 mtu = s->d1->mtu;
221 memset(s->d1, 0, sizeof(*(s->d1)));
225 s->d1->cookie_len = sizeof(s->d1->cookie);
230 s->d1->mtu = mtu;
233 s->d1->unprocessed_rcds.q = unprocessed_rcds;
234 s->d1->processed_rcds.q = processed_rcds;
235 s->d1->buffered_messages = buffered_messages;
236 s->d1->sent_messages = sent_messages;
237 s->d1->buffered_app_data.q = buffered_app_data;
299 memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
305 if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0)
307 s->d1->timeout_duration = 1;
311 get_current_time(&(s->d1->next_timeout));
314 s->d1->next_timeout.tv_sec += s->d1->timeout_duration;
315 BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &(s->d1->next_timeout));
323 if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0)
332 if (s->d1->next_timeout.tv_sec < timenow.tv_sec ||
333 (s->d1->next_timeout.tv_sec == timenow.tv_sec &&
334 s->d1->next_timeout.tv_usec <= timenow.tv_usec))
341 memcpy(timeleft, &(s->d1->next_timeout), sizeof(struct timeval));
385 s->d1->timeout_duration *= 2;
386 if (s->d1->timeout_duration > 60)
387 s->d1->timeout_duration = 60;
394 memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st));
395 memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
396 s->d1->timeout_duration = 1;
397 BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &(s->d1->next_timeout));
404 s->d1->timeout.num_alerts++;
407 if (s->d1->timeout.num_alerts > 2)
409 s->d1->mtu = BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_GET_FALLBACK_MTU, 0, NULL);
412 if (s->d1->timeout.num_alerts > DTLS1_TMO_ALERT_COUNT)
435 s->d1->timeout.read_timeouts++;
436 if (s->d1->timeout.read_timeouts > DTLS1_TMO_READ_COUNT)
438 s->d1->timeout.read_timeouts = 1;
475 s->d1->listen = 1;