Thanks! That will work.

A system call is pretty heavy weight though, is there a cheaper OpenSSL way of 
determining the same?

Cheers!

-----
John Lane Schultz
Spread Concepts LLC
Cell: 443 838 2200

On Nov 24, 2014, at 4:23 PM, Scott Neugroschl <scot...@xypro.com> wrote:

Use getsockopt(SO_TYPE) on the underlying socket?



-----Original Message-----
From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] 
On Behalf Of John Lane Schultz
Sent: Monday, November 24, 2014 1:05 PM
To: openssl-users@openssl.org
Subject: How to determine if a ssl object is using a DTLS method?

Hi all,

I wrote generic wrappers for handling both TLS + DTLS accept and connect logic 
in a non-blocking manner.

My problem is that with DTLS (but not TLS) ssl objects I need to set my own 
timers for implementing reliability of msgs by calling, for example, 
DTLSv1_get_timeout and DTLSv1_handle_timeout.  (TCP handles this for TLS 
automatically)

Therefore, I need to check if the ssl on which I’m operating is a DTLS or a 
TLS ssl object.  Is there an easy and good way to do this?

I can do a brute force method of calling SSL_get_ssl_method and then checking 
it against all the methods I know (e.g. - DTLSv1_method(), 
DTLSv1_client_method(), DTLSv1_server_method, etc.) but that seems ugly and 
fragile, especially as more methods are added in the future.

Can anyone suggest a better way to figure out if I need to do special DTLS 
handling on a ssl object or not?

Cheers!

-----
John Lane Schultz
Spread Concepts LLC
Cell: 443 838 2200

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org
:—§I"ÏŪˆÞrØmķŸĸÃ
(ĨéėēZ+K­+ĐĶŠí1ĻĨŠxŠËhĨéėē[Žzŧ(ĨéėēZ+€­Ēf­yŌâēӝĻŪfĢĒ·hšŠ)z{,–Šā

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to