예제 #1
0
/*
 * alloc a new ESQK and a user data element for the current user
 * @param msg: current OPTIONS request
 * @param str1: not used
 * @param str2: not used
 */
int LRF_alloc_user_data(struct sip_msg* msg, char*str1, char*str2){

	str user_uri;
	user_d * user_data;
	str service;
	struct trans_info options_tr;

	if(tmb.t_get_trans_ident(msg, &options_tr.hash_index, &options_tr.label) != 1){
		LOG(L_ERR, "ERR:"M_NAME":LRF_alloc_user_data:could not retrive hash_index and label of the current message's transaction\n");
		return CSCF_RETURN_FALSE;
	}

	service = cscf_get_headers_content(msg , service_hdr_name);
	if(!service.len || !service.s){
		LOG(L_ERR, "ERR:"M_NAME":LRF_alloc_user_data: could not find the service header in the OPTIONS, or could not be parsed\n");
		return CSCF_RETURN_FALSE;
	}

	str callid = cscf_get_call_id(msg, NULL);
	if(!callid.s || !callid.len){
		LOG(L_ERR, "ERR:"M_NAME":LRF_alloc_user_data: could not find the callid header in the OPTIONS request\n");
		return CSCF_RETURN_FALSE;
	}
	options_tr.callid.s = callid.s;
	options_tr.callid.len = callid.len;
	
	user_uri = msg->first_line.u.request.uri;
	user_data = add_user_data(user_uri, service, &options_tr);
	if(!user_data)
		return CSCF_RETURN_FALSE;
	print_lrf_user_data(L_INFO);
	return CSCF_RETURN_TRUE;
}
예제 #2
0
파일: smtrdns.c 프로젝트: INNOAUS/gsl
MODULE add_user_data_in_client_thread (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */

    add_user_data (tcb, &((TCB *)client_thread-> tcb)-> reply);
    if (tcb-> main_req_type == REQ_TYPE_HOST)
        mem_strfree (&tcb-> ip_value);
    else
        mem_strfree (&tcb-> host_name);
}
예제 #3
0
파일: smtrdns.c 프로젝트: INNOAUS/gsl
MODULE create_request_thread (THREAD *thread)
{
    THREAD
        *child;                         /*  Handle to child thread           */
    TCB
        *main_tcb;
    char
        *thread_name = NULL;

    main_tcb = thread-> tcb;

    if (main_tcb-> main_req_type == REQ_TYPE_HOST)
        thread_name = main_tcb-> ip_value;
    else
        thread_name = main_tcb-> host_name;
    if (thread_name == NULL)
        thread_name = "";
    if ((child = thread_create (AGENT_NAME, thread_name)) != NULL)
      {
        event_send (
            &child-> queue-> qid,       /*  Send to child thread queue       */
            &thread-> event-> sender,   /*  Queue for reply                  */
            "_CLIENT",                  /*  Name of event to send            */
            thread-> event-> body,      /*  Event body                       */
            thread-> event-> body_size, /*    and size                       */
            NULL, NULL, NULL,           /*  No response events               */
            0);                         /*  No timeout                       */
        tcb = (TCB *) child-> tcb;

        list_reset (&tcb-> reply);
        add_user_data (main_tcb, &tcb-> reply);
        tcb-> thread_type   = client_event;
        tcb-> main_req_type = main_tcb-> main_req_type;
        tcb-> host_name     = NULL;
        tcb-> ip_value      = NULL;
        if (tcb-> main_req_type == REQ_TYPE_HOST)
          {
            tcb-> ip_address = main_tcb-> ip_address;
            tcb-> ip_value   = mem_strdup (main_tcb-> ip_value);
            mem_strfree (&main_tcb-> ip_value);
          }
        else
          {
            tcb-> host_name = mem_strdup (main_tcb-> host_name);
            mem_strfree (&main_tcb-> host_name);
          }
      }
}