static void set_ssock_param(pj_ssl_sock_param *ssock_param,
    struct tls_listener *listener)
{
    int af, sip_ssl_method;
    pj_uint32_t sip_ssl_proto;

    /* Build SSL socket param */
    af = pjsip_transport_type_get_af(listener->factory.type);
    pj_ssl_sock_param_default(ssock_param);
    ssock_param->sock_af = af;
    ssock_param->cb.on_accept_complete2 = &on_accept_complete2;
    ssock_param->async_cnt = listener->async_cnt;
    ssock_param->ioqueue = pjsip_endpt_get_ioqueue(listener->endpt);
    ssock_param->timer_heap = pjsip_endpt_get_timer_heap(listener->endpt);
    ssock_param->require_client_cert = listener->tls_setting.require_client_cert;
    ssock_param->timeout = listener->tls_setting.timeout;
    ssock_param->user_data = listener;
    ssock_param->verify_peer = PJ_FALSE; /* avoid SSL socket closing the socket
					  * due to verification error */
    if (ssock_param->send_buffer_size < PJSIP_MAX_PKT_LEN)
	ssock_param->send_buffer_size = PJSIP_MAX_PKT_LEN;
    if (ssock_param->read_buffer_size < PJSIP_MAX_PKT_LEN)
	ssock_param->read_buffer_size = PJSIP_MAX_PKT_LEN;
    ssock_param->ciphers_num = listener->tls_setting.ciphers_num;
    ssock_param->ciphers = listener->tls_setting.ciphers;
    ssock_param->curves_num = listener->tls_setting.curves_num;
    ssock_param->curves = listener->tls_setting.curves;
    ssock_param->sigalgs = listener->tls_setting.sigalgs;
    ssock_param->entropy_type = listener->tls_setting.entropy_type;
    ssock_param->entropy_path = listener->tls_setting.entropy_path;
    ssock_param->reuse_addr = listener->tls_setting.reuse_addr;
    ssock_param->qos_type = listener->tls_setting.qos_type;
    ssock_param->qos_ignore_error = listener->tls_setting.qos_ignore_error;
    pj_memcpy(&ssock_param->qos_params, &listener->tls_setting.qos_params,
	      sizeof(ssock_param->qos_params));

    ssock_param->sockopt_ignore_error =
				    listener->tls_setting.sockopt_ignore_error;
    /* Copy the sockopt */
    pj_memcpy(&ssock_param->sockopt_params,
	      &listener->tls_setting.sockopt_params,
	      sizeof(listener->tls_setting.sockopt_params));

    sip_ssl_method = listener->tls_setting.method;
    sip_ssl_proto = listener->tls_setting.proto;
    ssock_param->proto = ssl_get_proto(sip_ssl_method, sip_ssl_proto);
}
static void set_ssock_param(pj_ssl_sock_param *ssock_param,
    struct tls_listener *listener)
{
    int af, sip_ssl_method;
    pj_uint32_t sip_ssl_proto;

     
    af = pjsip_transport_type_get_af(listener->factory.type);
    pj_ssl_sock_param_default(ssock_param);
    ssock_param->sock_af = af;
    ssock_param->cb.on_accept_complete2 = &on_accept_complete2;
    ssock_param->async_cnt = listener->async_cnt;
    ssock_param->ioqueue = pjsip_endpt_get_ioqueue(listener->endpt);
    ssock_param->timer_heap = pjsip_endpt_get_timer_heap(listener->endpt);
    ssock_param->require_client_cert = listener->tls_setting.require_client_cert;
    ssock_param->timeout = listener->tls_setting.timeout;
    ssock_param->user_data = listener;
    ssock_param->verify_peer = PJ_FALSE;  
    if (ssock_param->send_buffer_size < PJSIP_MAX_PKT_LEN)
	ssock_param->send_buffer_size = PJSIP_MAX_PKT_LEN;
    if (ssock_param->read_buffer_size < PJSIP_MAX_PKT_LEN)
	ssock_param->read_buffer_size = PJSIP_MAX_PKT_LEN;
    ssock_param->ciphers_num = listener->tls_setting.ciphers_num;
    ssock_param->ciphers = listener->tls_setting.ciphers;
    ssock_param->curves_num = listener->tls_setting.curves_num;
    ssock_param->curves = listener->tls_setting.curves;
    ssock_param->sigalgs = listener->tls_setting.sigalgs;
    ssock_param->entropy_type = listener->tls_setting.entropy_type;
    ssock_param->entropy_path = listener->tls_setting.entropy_path;
    ssock_param->reuse_addr = listener->tls_setting.reuse_addr;
    ssock_param->qos_type = listener->tls_setting.qos_type;
    ssock_param->qos_ignore_error = listener->tls_setting.qos_ignore_error;
    pj_memcpy(&ssock_param->qos_params, &listener->tls_setting.qos_params,
	      sizeof(ssock_param->qos_params));

    ssock_param->sockopt_ignore_error =
				    listener->tls_setting.sockopt_ignore_error;
     
    pj_memcpy(&ssock_param->sockopt_params,
	      &listener->tls_setting.sockopt_params,
	      sizeof(listener->tls_setting.sockopt_params));

    sip_ssl_method = listener->tls_setting.method;
    sip_ssl_proto = listener->tls_setting.proto;
    ssock_param->proto = ssl_get_proto(sip_ssl_method, sip_ssl_proto);
}