Exemplo n.º 1
0
struct ADC_client* ADC_client_create(const char* nickname, const char* description, void* ptr)
{
	ADC_TRACE;
	struct ADC_client* client = (struct ADC_client*) hub_malloc_zero(sizeof(struct ADC_client));

	ADC_client_set_state(client, ps_none);

	client->nick = hub_strdup(nickname);
	client->desc = hub_strdup(description);

	client->send_queue = ioq_send_create();
	client->recv_queue = ioq_recv_create();

	client->ptr = ptr;

	if (!g_adc_client)
	{
		g_adc_client = (struct ADC_client_global*) hub_malloc_zero(sizeof(struct ADC_client_global));
#ifdef SSL_SUPPORT
		g_adc_client->ctx = net_ssl_context_create("1.2", "HIGH");

#endif
	}
	g_adc_client->references++;

	return client;
}
Exemplo n.º 2
0
Arquivo: hub.c Projeto: imobilis/uhub
static int load_ssl_certificates(struct hub_info* hub, struct hub_config* config)
{
	if (config->tls_enable)
	{
		hub->ctx = net_ssl_context_create(config->tls_version, config->tls_ciphersuite);

		if (!hub->ctx)
		  return 0;

		if (ssl_load_certificate(hub->ctx, config->tls_certificate) &&
			ssl_load_private_key(hub->ctx, config->tls_private_key) &&
			ssl_check_private_key(hub->ctx))
		{
			LOG_INFO("Enabling TLS (%s), using certificate: %s, private key: %s", net_ssl_get_provider(), config->tls_certificate, config->tls_private_key);
			return 1;
		}
		return 0;
	}
	return 1;
}