Lines Matching full:d1

69     DTLS1_STATE *d1;  in dtls1_new()  local
77 if ((d1 = OPENSSL_zalloc(sizeof(*d1))) == NULL) { in dtls1_new()
82 d1->buffered_messages = pqueue_new(); in dtls1_new()
83 d1->sent_messages = pqueue_new(); in dtls1_new()
86 d1->cookie_len = sizeof(s->d1->cookie); in dtls1_new()
89 d1->link_mtu = 0; in dtls1_new()
90 d1->mtu = 0; in dtls1_new()
92 if (d1->buffered_messages == NULL || d1->sent_messages == NULL) { in dtls1_new()
93 pqueue_free(d1->buffered_messages); in dtls1_new()
94 pqueue_free(d1->sent_messages); in dtls1_new()
95 OPENSSL_free(d1); in dtls1_new()
100 s->d1 = d1; in dtls1_new()
119 while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) { in dtls1_clear_received_buffer()
131 while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) { in dtls1_clear_sent_buffer()
162 if (s->d1 != NULL) { in dtls1_free()
164 pqueue_free(s->d1->buffered_messages); in dtls1_free()
165 pqueue_free(s->d1->sent_messages); in dtls1_free()
168 OPENSSL_free(s->d1); in dtls1_free()
169 s->d1 = NULL; in dtls1_free()
181 if (s->d1) { in dtls1_clear()
182 DTLS_timer_cb timer_cb = s->d1->timer_cb; in dtls1_clear()
184 buffered_messages = s->d1->buffered_messages; in dtls1_clear()
185 sent_messages = s->d1->sent_messages; in dtls1_clear()
186 mtu = s->d1->mtu; in dtls1_clear()
187 link_mtu = s->d1->link_mtu; in dtls1_clear()
191 memset(s->d1, 0, sizeof(*s->d1)); in dtls1_clear()
194 s->d1->timer_cb = timer_cb; in dtls1_clear()
197 s->d1->cookie_len = sizeof(s->d1->cookie); in dtls1_clear()
201 s->d1->mtu = mtu; in dtls1_clear()
202 s->d1->link_mtu = link_mtu; in dtls1_clear()
205 s->d1->buffered_messages = buffered_messages; in dtls1_clear()
206 s->d1->sent_messages = sent_messages; in dtls1_clear()
240 s->d1->link_mtu = larg; in dtls1_ctrl()
251 s->d1->mtu = larg; in dtls1_ctrl()
267 memset(&s->d1->next_timeout, 0, sizeof(s->d1->next_timeout)); in dtls1_start_timer()
276 if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) { in dtls1_start_timer()
278 if (s->d1->timer_cb != NULL) in dtls1_start_timer()
279 s->d1->timeout_duration_us = s->d1->timer_cb(s, 0); in dtls1_start_timer()
281 s->d1->timeout_duration_us = 1000000; in dtls1_start_timer()
285 get_current_time(&(s->d1->next_timeout)); in dtls1_start_timer()
289 sec = s->d1->timeout_duration_us / 1000000; in dtls1_start_timer()
290 usec = s->d1->timeout_duration_us - (sec * 1000000); in dtls1_start_timer()
292 s->d1->next_timeout.tv_sec += sec; in dtls1_start_timer()
293 s->d1->next_timeout.tv_usec += usec; in dtls1_start_timer()
295 if (s->d1->next_timeout.tv_usec >= 1000000) { in dtls1_start_timer()
296 s->d1->next_timeout.tv_sec++; in dtls1_start_timer()
297 s->d1->next_timeout.tv_usec -= 1000000; in dtls1_start_timer()
301 &(s->d1->next_timeout)); in dtls1_start_timer()
309 if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) { in dtls1_get_timeout()
317 if (s->d1->next_timeout.tv_sec < timenow.tv_sec || in dtls1_get_timeout()
318 (s->d1->next_timeout.tv_sec == timenow.tv_sec && in dtls1_get_timeout()
319 s->d1->next_timeout.tv_usec <= timenow.tv_usec)) { in dtls1_get_timeout()
325 memcpy(timeleft, &(s->d1->next_timeout), sizeof(struct timeval)); in dtls1_get_timeout()
364 s->d1->timeout_duration_us *= 2; in dtls1_double_timeout()
365 if (s->d1->timeout_duration_us > 60000000) in dtls1_double_timeout()
366 s->d1->timeout_duration_us = 60000000; in dtls1_double_timeout()
372 s->d1->timeout_num_alerts = 0; in dtls1_stop_timer()
373 memset(&s->d1->next_timeout, 0, sizeof(s->d1->next_timeout)); in dtls1_stop_timer()
374 s->d1->timeout_duration_us = 1000000; in dtls1_stop_timer()
376 &(s->d1->next_timeout)); in dtls1_stop_timer()
385 s->d1->timeout_num_alerts++; in dtls1_check_timeout_num()
388 if (s->d1->timeout_num_alerts > 2 in dtls1_check_timeout_num()
392 if (mtu < s->d1->mtu) in dtls1_check_timeout_num()
393 s->d1->mtu = mtu; in dtls1_check_timeout_num()
396 if (s->d1->timeout_num_alerts > DTLS1_TMO_ALERT_COUNT) { in dtls1_check_timeout_num()
412 if (s->d1->timer_cb != NULL) in dtls1_handle_timeout()
413 s->d1->timeout_duration_us = s->d1->timer_cb(s, s->d1->timeout_duration_us); in dtls1_handle_timeout()
838 s->d1->handshake_read_seq = 1; in DTLSv1_listen()
839 s->d1->handshake_write_seq = 1; in DTLSv1_listen()
840 s->d1->next_handshake_write_seq = 1; in DTLSv1_listen()
904 if (s->d1->link_mtu) { in dtls1_query_mtu()
905 s->d1->mtu = in dtls1_query_mtu()
906 s->d1->link_mtu - BIO_dgram_get_mtu_overhead(SSL_get_wbio(s)); in dtls1_query_mtu()
907 s->d1->link_mtu = 0; in dtls1_query_mtu()
911 if (s->d1->mtu < dtls1_min_mtu(s)) { in dtls1_query_mtu()
913 s->d1->mtu = in dtls1_query_mtu()
920 if (s->d1->mtu < dtls1_min_mtu(s)) { in dtls1_query_mtu()
922 s->d1->mtu = dtls1_min_mtu(s); in dtls1_query_mtu()
924 (long)s->d1->mtu, NULL); in dtls1_query_mtu()
947 size_t mtu = s->d1->mtu; in DTLS_get_data_mtu()
981 s->d1->timer_cb = cb; in DTLS_set_timer_cb()