Send information through ADC client interface about the TLS connection.

This commit is contained in:
Jan Vidar Krey 2014-08-05 17:45:32 +02:00
parent 95de69efeb
commit 4919aea8d5
3 changed files with 15 additions and 1 deletions

View File

@ -634,7 +634,14 @@ static void ADC_client_on_connected(struct ADC_client* client)
static void ADC_client_on_connected_ssl(struct ADC_client* client)
{
ADC_TRACE;
client->callback(client, ADC_CLIENT_SSL_OK, 0);
struct ADC_client_callback_data data;
struct ADC_client_tls_info tls_info;
data.tls_info = &tls_info;
tls_info.version = net_ssl_get_tls_version(client->con);
tls_info.cipher = net_ssl_get_tls_cipher(client->con);
client->callback(client, ADC_CLIENT_SSL_OK, &data);
ADC_client_send_handshake(client);
}
#endif

View File

@ -95,6 +95,11 @@ struct ADC_client_quit_reason
int flags;
};
struct ADC_client_tls_info
{
const char* cipher;
const char* version;
};
struct ADC_client_callback_data
{
@ -103,6 +108,7 @@ struct ADC_client_callback_data
struct ADC_chat_message* chat;
struct ADC_user* user;
struct ADC_client_quit_reason* quit;
struct ADC_client_tls_info* tls_info;
};
};

View File

@ -108,6 +108,7 @@ static int handle(struct ADC_client* client, enum ADC_client_callback_type type,
break;
case ADC_CLIENT_SSL_OK:
printf("*** SSL connected (%s/%s).\n", data->tls_info->version, data->tls_info->cipher);
break;
case ADC_CLIENT_LOGGING_IN: