diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-09-09 17:06:13 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-09-09 17:06:13 +0000 |
commit | 43e9e1a16054e50a850c3d884e0d432b532fc90d (patch) | |
tree | 0598d219abcca85ee80a2866866b487a5668010a /ssl/d1_lib.c | |
parent | d0969d24cf8304d836ad7fa71ac785da412e1422 (diff) |
PR: 2033
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de>
Approved by: steve@openssl.org
DTLS listen support.
Diffstat (limited to 'ssl/d1_lib.c')
-rw-r--r-- | ssl/d1_lib.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c index 183717624c..63bfbacc82 100644 --- a/ssl/d1_lib.c +++ b/ssl/d1_lib.c @@ -68,6 +68,7 @@ static void get_current_time(struct timeval *t); const char dtls1_version_str[]="DTLSv1" OPENSSL_VERSION_PTEXT; +int dtls1_listen(SSL *s, struct sockaddr *client); SSL3_ENC_METHOD DTLSv1_enc_data={ dtls1_enc, @@ -225,6 +226,9 @@ long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg) case DTLS_CTRL_HANDLE_TIMEOUT: ret = dtls1_handle_timeout(s); break; + case DTLS_CTRL_LISTEN: + ret = dtls1_listen(s, parg); + break; default: ret = ssl3_ctrl(s, cmd, larg, parg); @@ -386,3 +390,17 @@ static void get_current_time(struct timeval *t) gettimeofday(t, NULL); #endif } + +int dtls1_listen(SSL *s, struct sockaddr *client) + { + int ret; + + SSL_set_options(s, SSL_OP_COOKIE_EXCHANGE); + s->d1->listen = 1; + + ret = SSL_accept(s); + if (ret <= 0) return ret; + + (void) BIO_dgram_get_peer(SSL_get_rbio(s), client); + return 1; + } |