Lines Matching refs:d1
66 DTLS1_STATE *d1; in dtls1_new() local
78 if ((d1 = OPENSSL_zalloc(sizeof(*d1))) == NULL) { in dtls1_new()
83 d1->buffered_messages = pqueue_new(); in dtls1_new()
84 d1->sent_messages = pqueue_new(); in dtls1_new()
87 d1->cookie_len = sizeof(s->d1->cookie); in dtls1_new()
90 d1->link_mtu = 0; in dtls1_new()
91 d1->mtu = 0; in dtls1_new()
93 if (d1->buffered_messages == NULL || d1->sent_messages == NULL) { in dtls1_new()
94 pqueue_free(d1->buffered_messages); in dtls1_new()
95 pqueue_free(d1->sent_messages); in dtls1_new()
96 OPENSSL_free(d1); in dtls1_new()
101 s->d1 = d1; in dtls1_new()
120 while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) { in dtls1_clear_received_buffer()
132 while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) { in dtls1_clear_sent_buffer()
158 if (s->d1 != NULL) { in dtls1_free()
160 pqueue_free(s->d1->buffered_messages); in dtls1_free()
161 pqueue_free(s->d1->sent_messages); in dtls1_free()
168 OPENSSL_free(s->d1); in dtls1_free()
169 s->d1 = NULL; in dtls1_free()
186 if (s->d1) { in dtls1_clear()
187 DTLS_timer_cb timer_cb = s->d1->timer_cb; in dtls1_clear()
189 buffered_messages = s->d1->buffered_messages; in dtls1_clear()
190 sent_messages = s->d1->sent_messages; in dtls1_clear()
191 mtu = s->d1->mtu; in dtls1_clear()
192 link_mtu = s->d1->link_mtu; in dtls1_clear()
196 memset(s->d1, 0, sizeof(*s->d1)); in dtls1_clear()
199 s->d1->timer_cb = timer_cb; in dtls1_clear()
202 s->d1->cookie_len = sizeof(s->d1->cookie); in dtls1_clear()
206 s->d1->mtu = mtu; in dtls1_clear()
207 s->d1->link_mtu = link_mtu; in dtls1_clear()
210 s->d1->buffered_messages = buffered_messages; in dtls1_clear()
211 s->d1->sent_messages = sent_messages; in dtls1_clear()
251 s->d1->link_mtu = larg; in dtls1_ctrl()
262 s->d1->mtu = larg; in dtls1_ctrl()
271 static void dtls1_bio_set_next_timeout(BIO *bio, const DTLS1_STATE *d1) in dtls1_bio_set_next_timeout() argument
273 struct timeval tv = ossl_time_to_timeval(d1->next_timeout); in dtls1_bio_set_next_timeout()
286 s->d1->next_timeout = ossl_time_zero(); in dtls1_start_timer()
295 if (ossl_time_is_zero(s->d1->next_timeout)) { in dtls1_start_timer()
296 if (s->d1->timer_cb != NULL) in dtls1_start_timer()
297 s->d1->timeout_duration_us = s->d1->timer_cb(ssl, 0); in dtls1_start_timer()
299 s->d1->timeout_duration_us = 1000000; in dtls1_start_timer()
303 duration = ossl_us2time(s->d1->timeout_duration_us); in dtls1_start_timer()
304 s->d1->next_timeout = ossl_time_add(ossl_time_now(), duration); in dtls1_start_timer()
307 dtls1_bio_set_next_timeout(SSL_get_rbio(ssl), s->d1); in dtls1_start_timer()
315 if (ossl_time_is_zero(s->d1->next_timeout)) in dtls1_get_timeout()
326 *timeleft = ossl_time_subtract(s->d1->next_timeout, timenow); in dtls1_get_timeout()
350 s->d1->timeout_duration_us *= 2; in dtls1_double_timeout()
351 if (s->d1->timeout_duration_us > 60000000) in dtls1_double_timeout()
352 s->d1->timeout_duration_us = 60000000; in dtls1_double_timeout()
358 s->d1->timeout_num_alerts = 0; in dtls1_stop_timer()
359 s->d1->next_timeout = ossl_time_zero(); in dtls1_stop_timer()
360 s->d1->timeout_duration_us = 1000000; in dtls1_stop_timer()
361 dtls1_bio_set_next_timeout(s->rbio, s->d1); in dtls1_stop_timer()
371 s->d1->timeout_num_alerts++; in dtls1_check_timeout_num()
374 if (s->d1->timeout_num_alerts > 2 in dtls1_check_timeout_num()
378 if (mtu < s->d1->mtu) in dtls1_check_timeout_num()
379 s->d1->mtu = mtu; in dtls1_check_timeout_num()
382 if (s->d1->timeout_num_alerts > DTLS1_TMO_ALERT_COUNT) { in dtls1_check_timeout_num()
398 if (s->d1->timer_cb != NULL) in dtls1_handle_timeout()
399 s->d1->timeout_duration_us = s->d1->timer_cb(SSL_CONNECTION_GET_USER_SSL(s), in dtls1_handle_timeout()
400 s->d1->timeout_duration_us); in dtls1_handle_timeout()
799 s->d1->handshake_read_seq = 1; in DTLSv1_listen()
800 s->d1->handshake_write_seq = 1; in DTLSv1_listen()
801 s->d1->next_handshake_write_seq = 1; in DTLSv1_listen()
891 if (s->d1->link_mtu) { in dtls1_query_mtu()
892 s->d1->mtu = in dtls1_query_mtu()
893 s->d1->link_mtu - BIO_dgram_get_mtu_overhead(SSL_get_wbio(ssl)); in dtls1_query_mtu()
894 s->d1->link_mtu = 0; in dtls1_query_mtu()
898 if (s->d1->mtu < dtls1_min_mtu(s)) { in dtls1_query_mtu()
900 s->d1->mtu = in dtls1_query_mtu()
907 if (s->d1->mtu < dtls1_min_mtu(s)) { in dtls1_query_mtu()
909 s->d1->mtu = dtls1_min_mtu(s); in dtls1_query_mtu()
911 (long)s->d1->mtu, NULL); in dtls1_query_mtu()
942 mtu = s->d1->mtu; in DTLS_get_data_mtu()
981 s->d1->timer_cb = cb; in DTLS_set_timer_cb()