From 214a29955b9c7a8eafc90997ee29f86a284e3a12 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Thu, 24 Jan 2013 17:31:49 +0100 Subject: Add two helper functions to conn.[ch]. --- lib/conn.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/conn.c') diff --git a/lib/conn.c b/lib/conn.c index 90f1e61..815784f 100644 --- a/lib/conn.c +++ b/lib/conn.c @@ -61,6 +61,23 @@ conn_activate_timeout (struct rs_connection *conn) return RSE_OK; } +int +conn_type_tls (const struct rs_connection *conn) +{ + assert (conn->active_peer); + return conn->realm->type == RS_CONN_TYPE_TLS + || conn->realm->type == RS_CONN_TYPE_DTLS; +} + +int +conn_cred_psk (const struct rs_connection *conn) +{ + assert (conn->active_peer); + return conn->active_peer->transport_cred && + conn->active_peer->transport_cred->type == RS_CRED_TLS_PSK; +} + + /* Public functions. */ int rs_conn_create (struct rs_context *ctx, -- cgit v1.1