当前位置: 首页>>代码示例>>C++>>正文


C++ osip_message_free函数代码示例

本文整理汇总了C++中osip_message_free函数的典型用法代码示例。如果您正苦于以下问题:C++ osip_message_free函数的具体用法?C++ osip_message_free怎么用?C++ osip_message_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osip_message_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eXosip_register_send_register

int
eXosip_register_send_register (int rid, osip_message_t * reg)
{
  osip_transaction_t *transaction;
  osip_event_t *sipevent;
  eXosip_reg_t *jr;
  int i;

  jr = eXosip_reg_find (rid);
  if (jr == NULL)
    {
      osip_message_free (reg);
      return -1;
    }

  if (jr->r_last_tr != NULL)
    {
      if (jr->r_last_tr->state != NICT_TERMINATED
          && jr->r_last_tr->state != NICT_COMPLETED)
        {
          osip_message_free (reg);
          return -1;
        }
    }

  if (reg == NULL)
    {
      i = _eXosip_register_build_register (jr, &reg);
      if (i != 0)
        {
          OSIP_TRACE (osip_trace
                      (__FILE__, __LINE__, OSIP_ERROR, NULL,
                       "eXosip: cannot build REGISTER!"));
          return i;
        }
    }

  i = _eXosip_transaction_init (&transaction, NICT, eXosip.j_osip, reg);
  if (i != 0)
    {
      /* TODO: release the j_call.. */

      osip_message_free (reg);
      return -2;
    }

  jr->r_last_tr = transaction;

  /* send REGISTER */
  sipevent = osip_new_outgoing_sipmessage (reg);
  sipevent->transactionid = transaction->transactionid;
  osip_message_force_update (reg);

  osip_transaction_add_event (transaction, sipevent);
  __eXosip_wakeup ();
  return 0;
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:57,代码来源:eXregister_api.c

示例2: eXosip_message_send_answer

int
eXosip_message_send_answer (int tid, int status, osip_message_t * answer)
{
  osip_transaction_t *tr = NULL;
  osip_event_t *evt_answer;
  int i = -1;

  if (tid <= 0)
    return OSIP_BADPARAMETER;
  if (status <= 100 || status > 699)
    return OSIP_BADPARAMETER;
  if (answer == NULL && status > 100 && status < 200)
    return OSIP_BADPARAMETER;

  if (tid > 0)
    {
      eXosip_transaction_find (tid, &tr);
    }
  if (tr == NULL)
    {
      OSIP_TRACE (osip_trace
                  (__FILE__, __LINE__, OSIP_ERROR, NULL,
                   "eXosip: No MESSAGE transaction found\n"));
      osip_message_free (answer);
      return OSIP_NOTFOUND;
    }

  /* is the transaction already answered? */
  if (tr->state == NIST_COMPLETED || tr->state == NIST_TERMINATED)
    {
      OSIP_TRACE (osip_trace
                  (__FILE__, __LINE__, OSIP_ERROR, NULL,
                   "eXosip: transaction already answered\n"));
      osip_message_free (answer);
      return OSIP_WRONG_STATE;
    }

  if (answer == NULL)
    {
      i = -1;
      if (status > 199 && status < 300)
        i = _eXosip_build_response_default (&answer, NULL, status,
                                            tr->orig_request);
      else if (status > 300 && status <= 699)
        i = _eXosip_build_response_default (&answer, NULL, status,
                                            tr->orig_request);
      if (i != 0)
        return i;
    }

  evt_answer = osip_new_outgoing_sipmessage (answer);
  evt_answer->transactionid = tr->transactionid;

  osip_transaction_add_event (tr, evt_answer);
  __eXosip_wakeup ();
  return OSIP_SUCCESS;
}
开发者ID:LaughingAngus,项目名称:linphone-vs2008,代码行数:57,代码来源:eXmessage_api.c

示例3: GB_Send_Response

//  发送响应消息
int GB_Send_Response(GB_CONNECT_STATE *gb_cons, void *cmd_struct, gb_CommandType_enum cmdType, osip_call_id_t **call_id)
{
	osip_message_t *reg = NULL;
	PRM_GB_SIPD_CFG gb_cfg;
	char to[GB_URI_MAX_LEN] = {0};
	char from[GB_URI_MAX_LEN] = {0};
	char proxy[GB_URI_MAX_LEN] = {0};
	int ret;
	char *result = NULL;
	size_t length;
	char localip[20];
	char sipserver_ip[20] = {0};
	
	SN_MEMSET(&gb_cfg, 0, sizeof(gb_cfg));
	GB_Get_GBCfg(&gb_cfg);

	SN_MEMSET(localip,0,sizeof(localip));
	SN_STRCPY(localip,sizeof(localip),GB_Get_LocalIP());
		
	SN_SPRINTF(sipserver_ip,sizeof(sipserver_ip),"%d.%d.%d.%d",
		gb_cfg.sipserver_ip[0],gb_cfg.sipserver_ip[1],gb_cfg.sipserver_ip[2],gb_cfg.sipserver_ip[3]);

	SN_SPRINTF(from, GB_URI_MAX_LEN, "sip:%[email protected]%s", gb_cfg.deviceID, localip);
	SN_SPRINTF(to, GB_URI_MAX_LEN, "sip:%[email protected]%s", gb_cfg.sipserver_ID, sipserver_ip);
	SN_SPRINTF(proxy, GB_URI_MAX_LEN, "sip:%[email protected]%s:%d", gb_cfg.sipserver_ID,sipserver_ip, gb_cfg.sipserver_port);
	
	ret = gb_generating_MESSAGE(&reg, Transport_Str[gb_cons->transfer_protocol], from, to, proxy, 
					localip,gb_cfg.local_port, gb_cons->local_cseq, (void *)cmd_struct, cmdType);
		
	if (ret < 0)
	{
		osip_message_free (reg);
		printf("%s	line=%d\n",__FUNCTION__,__LINE__);
		return -1;
	}

	if(call_id != NULL)
	{
		osip_call_id_clone(reg->call_id,call_id);
	}
	
	ret = osip_message_to_str(reg, &result, &length);

	if (ret == -1) 
	{
		printf("ERROR: failed while printing message!\n");
		osip_message_free (reg);
		return -1;
	}	
	gb_cons->local_cseq++;
	GB_SocketSendData(gb_cons->connfd,inet_ntoa(gb_cons->remoteAddr.sin_addr), ntohs(gb_cons->remoteAddr.sin_port), result, length, 0);
	SN_FREE(result);
	osip_message_free(reg);
	
	return 0;
}
开发者ID:github188,项目名称:Decoder_GB,代码行数:57,代码来源:GB_parser.c

示例4: eXosip_subscribe_send_refresh_request

int
eXosip_subscribe_send_refresh_request (struct eXosip_t *excontext, int did, osip_message_t * sub)
{
  eXosip_dialog_t *jd = NULL;
  eXosip_subscribe_t *js = NULL;

  osip_transaction_t *transaction;
  osip_event_t *sipevent;
  int i;

  if (did <= 0)
    return OSIP_BADPARAMETER;

  if (did > 0) {
    _eXosip_subscribe_dialog_find (excontext, did, &js, &jd);
  }
  if (jd == NULL) {
    OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No subscribe here?\n"));
    osip_message_free (sub);
    return OSIP_NOTFOUND;
  }

  transaction = NULL;
  transaction = _eXosip_find_last_out_subscribe (js, jd);

  if (transaction != NULL) {
    if (transaction->state != NICT_TERMINATED && transaction->state != NIST_TERMINATED && transaction->state != NICT_COMPLETED && transaction->state != NIST_COMPLETED) {
      osip_message_free (sub);
      return OSIP_WRONG_STATE;
    }
    transaction = NULL;
  }

  transaction = NULL;
  i = _eXosip_transaction_init (excontext, &transaction, NICT, excontext->j_osip, sub);

  if (i != 0) {
    osip_message_free (sub);
    return i;
  }

  js->s_reg_period = 3600;
  _eXosip_subscribe_set_refresh_interval (js, sub);
  osip_list_add (jd->d_out_trs, transaction, 0);

  sipevent = osip_new_outgoing_sipmessage (sub);
  sipevent->transactionid = transaction->transactionid;

  osip_transaction_set_reserved5 (transaction, js);
  osip_transaction_set_reserved3 (transaction, jd);

  osip_transaction_add_event (transaction, sipevent);
  _eXosip_wakeup (excontext);
  return OSIP_SUCCESS;
}
开发者ID:CrazyBBer,项目名称:sip_stack,代码行数:55,代码来源:eXsubscription_api.c

示例5: GB_sipd_register

int GB_sipd_register(GB_CONNECT_STATE *gb_cons, int flag)
{
	osip_message_t *reg = NULL;
	PRM_GB_SIPD_CFG gb_cfg;
	char from[GB_URI_MAX_LEN] = {0};
	char proxy[GB_URI_MAX_LEN] = {0};
	int ret;
	char *result = NULL;
	size_t length;
	char localip[20];
	char sipserver_ip[20] = {0};
	
	SN_MEMSET(&gb_cfg, 0, sizeof(gb_cfg));

	GB_Get_GBCfg(&gb_cfg);

	SN_MEMSET(localip,0,sizeof(localip));
	SN_STRCPY(localip,sizeof(localip),GB_Get_LocalIP());
	
	SN_SPRINTF(sipserver_ip,sizeof(sipserver_ip),"%d.%d.%d.%d",
		gb_cfg.sipserver_ip[0],gb_cfg.sipserver_ip[1],gb_cfg.sipserver_ip[2],gb_cfg.sipserver_ip[3]);

	SN_SPRINTF(from, GB_URI_MAX_LEN, "sip:%[email protected]%s", gb_cfg.deviceID, localip);
	SN_SPRINTF(proxy, GB_URI_MAX_LEN, "sip:%[email protected]%s:%d", gb_cfg.sipserver_ID,sipserver_ip, gb_cfg.sipserver_port);

	if(flag == 0)  // 注册
	{
		ret = gb_generating_register(&reg, Transport_Str[gb_cons->transfer_protocol], from, proxy, NULL, gb_cfg.register_period, localip,gb_cfg.local_port, gb_cons->local_cseq);
	}
	else  //  注销
	{
		ret = gb_generating_register(&reg, Transport_Str[gb_cons->transfer_protocol], from, proxy, NULL, 0, localip,gb_cfg.local_port, gb_cons->local_cseq);	
	}
	
	if (ret < 0)
	{
		osip_message_free (reg);
		return -1;
	}
	
	//printf("gb_cons->callID:%s\n", gb_cons->callID);
	ret = osip_message_to_str(reg, &result, &length);
	if (ret == -1) 
	{
		printf("ERROR: failed while printing message!\n");
		osip_message_free (reg);
		return -1;
	}	
	gb_cons->local_cseq++;
	GB_SocketSendData(gb_cons->connfd,inet_ntoa(gb_cons->remoteAddr.sin_addr), ntohs(gb_cons->remoteAddr.sin_port), result, length, 0);
	SN_FREE(result);
	osip_message_free(reg);
	
	return 0;
}
开发者ID:github188,项目名称:Decoder_GB,代码行数:55,代码来源:GB_parser.c

示例6: eXosip_event_free

void
eXosip_event_free (eXosip_event_t * je)
{
  if (je == NULL)
    return;
  if (je->request != NULL)
    osip_message_free (je->request);
  if (je->response != NULL)
    osip_message_free (je->response);
  if (je->ack != NULL)
    osip_message_free (je->ack);
  osip_free (je);
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:13,代码来源:jevents.c

示例7: sal_subscribe_presence

/*presence Subscribe/notify*/
int sal_subscribe_presence(SalOp *op, const char *from, const char *to){
	osip_message_t *msg=NULL;
	if (from)
		sal_op_set_from(op,from);
	if (to)
		sal_op_set_to(op,to);
	sal_exosip_fix_route(op);
	eXosip_lock();
	eXosip_subscribe_build_initial_request(&msg,sal_op_get_to(op),sal_op_get_from(op),
	    	sal_op_get_route(op),"presence",600);
	if (msg==NULL){
		ms_error("Could not build subscribe request to %s",to);
		eXosip_unlock();
		return -1;
	}
	if (op->base.contact){
		_osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free);
		osip_message_set_contact(msg,op->base.contact);
	}
	op->sid=eXosip_subscribe_send_initial_request(msg);
	eXosip_unlock();
	if (op->sid==-1){
		osip_message_free(msg);
		return -1;
	}
	sal_add_out_subscribe(op->base.root,op);
	return 0;
}
开发者ID:rogerhzh,项目名称:linphone_linux_XIA,代码行数:29,代码来源:sal_eXosip2_presence.c

示例8: nict_rcv_23456xx

void
nict_rcv_23456xx (osip_transaction_t * nict, osip_event_t * evt)
{
  /* leave this answer to the core application */

  if (nict->last_response != NULL)
    {
      osip_message_free (nict->last_response);
    }
  nict->last_response = evt->sip;

  if (EVT_IS_RCV_STATUS_2XX (evt))
    __osip_message_callback (OSIP_NICT_STATUS_2XX_RECEIVED, nict,
                             nict->last_response);
  else if (MSG_IS_STATUS_3XX (nict->last_response))
    __osip_message_callback (OSIP_NICT_STATUS_3XX_RECEIVED, nict,
                             nict->last_response);
  else if (MSG_IS_STATUS_4XX (nict->last_response))
    __osip_message_callback (OSIP_NICT_STATUS_4XX_RECEIVED, nict,
                             nict->last_response);
  else if (MSG_IS_STATUS_5XX (nict->last_response))
    __osip_message_callback (OSIP_NICT_STATUS_5XX_RECEIVED, nict,
                             nict->last_response);
  else
    __osip_message_callback (OSIP_NICT_STATUS_6XX_RECEIVED, nict,
                             nict->last_response);

  if (nict->state != NICT_COMPLETED)    /* reset timer K */
    {
      osip_gettimeofday (&nict->nict_context->timer_k_start, NULL);
      add_gettimeofday (&nict->nict_context->timer_k_start,
                        nict->nict_context->timer_k_length);
    }
  __osip_transaction_set_state (nict, NICT_COMPLETED);
}
开发者ID:BackupTheBerlios,项目名称:sfsipua-svn,代码行数:35,代码来源:nict_fsm.c

示例9: eXosip_options_send_request

int
eXosip_options_send_request (osip_message_t * options)
{
  osip_transaction_t *transaction;
  osip_event_t *sipevent;
  int i;

  i = osip_transaction_init (&transaction, NICT, eXosip.j_osip, options);
  if (i != 0)
    {
      osip_message_free (options);
      return -1;
    }

  osip_list_add (eXosip.j_transactions, transaction, 0);

  sipevent = osip_new_outgoing_sipmessage (options);
  sipevent->transactionid = transaction->transactionid;

  osip_transaction_set_your_instance (transaction,
                                      __eXosip_new_jinfo (NULL, NULL, NULL, NULL));
  osip_transaction_add_event (transaction, sipevent);

  __eXosip_wakeup ();
  return 0;
}
开发者ID:tibastral,项目名称:symphonie,代码行数:26,代码来源:eXoptions_api.c

示例10: eXosip_message_send_request

int
eXosip_message_send_request (osip_message_t * message)
{
  osip_transaction_t *transaction;
  osip_event_t *sipevent;
  int i;

  i = _eXosip_transaction_init (&transaction, NICT, eXosip.j_osip, message);
  if (i != 0)
    {
      osip_message_free (message);
      return -1;
    }

  osip_list_add (eXosip.j_transactions, transaction, 0);

  sipevent = osip_new_outgoing_sipmessage (message);
  sipevent->transactionid = transaction->transactionid;

#ifndef MINISIZE
  osip_transaction_set_your_instance (transaction,
                                      __eXosip_new_jinfo (NULL, NULL, NULL, NULL));
#else
  osip_transaction_set_your_instance (transaction,
                                      __eXosip_new_jinfo (NULL, NULL));
#endif
  osip_transaction_add_event (transaction, sipevent);

  __eXosip_wakeup ();
  return 0;
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:31,代码来源:eXmessage_api.c

示例11: ist_snd_3456xx

void
ist_snd_3456xx (osip_transaction_t * ist, osip_event_t * evt)
{
  int i;

  if (ist->last_response != NULL) {
    osip_message_free (ist->last_response);
  }
  ist->last_response = evt->sip;

  i = __osip_transaction_snd_xxx (ist, evt->sip);
  if (i != 0) {
    ist_handle_transport_error (ist, i);
    return;
  }
  else {
    if (MSG_IS_STATUS_3XX (ist->last_response))
      __osip_message_callback (OSIP_IST_STATUS_3XX_SENT, ist, ist->last_response);
    else if (MSG_IS_STATUS_4XX (ist->last_response))
      __osip_message_callback (OSIP_IST_STATUS_4XX_SENT, ist, ist->last_response);
    else if (MSG_IS_STATUS_5XX (ist->last_response))
      __osip_message_callback (OSIP_IST_STATUS_5XX_SENT, ist, ist->last_response);
    else
      __osip_message_callback (OSIP_IST_STATUS_6XX_SENT, ist, ist->last_response);
  }

  if (ist->ist_context->timer_g_length != -1) {
    osip_gettimeofday (&ist->ist_context->timer_g_start, NULL);
    add_gettimeofday (&ist->ist_context->timer_g_start, ist->ist_context->timer_g_length);
  }
  osip_gettimeofday (&ist->ist_context->timer_h_start, NULL);
  add_gettimeofday (&ist->ist_context->timer_h_start, ist->ist_context->timer_h_length);
  __osip_transaction_set_state (ist, IST_COMPLETED);
  return;
}
开发者ID:benjaminlevine,项目名称:Huawei-HG633-Open-Source-Software-Package,代码行数:35,代码来源:ist_fsm.c

示例12: ict_rcv_1xx

void ict_rcv_1xx(osip_transaction_t * ict, osip_event_t * evt)
{
	/* leave this answer to the core application */

	if (ict->last_response != NULL) {
		osip_message_free(ict->last_response);
	}
	ict->last_response = evt->sip;
	__osip_message_callback(OSIP_ICT_STATUS_1XX_RECEIVED, ict, evt->sip);
	__osip_transaction_set_state(ict, ICT_PROCEEDING);
}
开发者ID:avis,项目名称:osip,代码行数:11,代码来源:ict_fsm.c

示例13: ict_rcv_2xx

void ict_rcv_2xx(osip_transaction_t * ict, osip_event_t * evt)
{
	/* leave this answer to the core application */

	if (ict->last_response != NULL) {
		osip_message_free(ict->last_response);
	}
	ict->last_response = evt->sip;

	__osip_message_callback(OSIP_ICT_STATUS_2XX_RECEIVED, ict, evt->sip);

	__osip_transaction_set_state(ict, ICT_TERMINATED);
	__osip_kill_transaction_callback(OSIP_ICT_KILL_TRANSACTION, ict);
}
开发者ID:avis,项目名称:osip,代码行数:14,代码来源:ict_fsm.c

示例14: bSipSend

int bSipSend(
						 osip_message_t    *msgPtr,
						 osip_fsm_type_t   transactionType)
{
	int status;
	osip_transaction_t *transactionPtr;
	osip_event_t       *sipeventPtr;

	if ( (status = osip_transaction_init(&transactionPtr,transactionType,osip,msgPtr)) != 0 ){
		printf("Failed to init transaction %d",status);
		return -1;
	}

	if((sipeventPtr = osip_new_outgoing_sipmessage(msgPtr)) == NULL){
		printf("Can't allocate message");
		osip_message_free(msgPtr);
		return -1;
	}

	sipeventPtr->transactionid =  transactionPtr->transactionid;


	if((status = osip_message_force_update(msgPtr)) != 0){
		printf("Failed force update",status);
		osip_message_free(msgPtr);
		return -1;
	}

	if((status = osip_transaction_add_event(transactionPtr, sipeventPtr)) != 0){
		printf("Can't add event");
		osip_message_free(msgPtr);
		return -1;
	}

	return 0;

}
开发者ID:usamaaftab80,项目名称:multi-p2p,代码行数:37,代码来源:main.c

示例15: eXosip_subscribe_send_initial_request

int
eXosip_subscribe_send_initial_request (struct eXosip_t *excontext, osip_message_t * subscribe)
{
  eXosip_subscribe_t *js = NULL;
  osip_transaction_t *transaction;
  osip_event_t *sipevent;
  int i;

  i = _eXosip_subscribe_init (&js);
  if (i != 0) {
    OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: cannot subscribe."));
    osip_message_free (subscribe);
    return i;
  }

  i = _eXosip_transaction_init (excontext, &transaction, NICT, excontext->j_osip, subscribe);
  if (i != 0) {
    _eXosip_subscribe_free (excontext, js);
    osip_message_free (subscribe);
    return i;
  }

  js->s_reg_period = 3600;
  _eXosip_subscribe_set_refresh_interval (js, subscribe);
  js->s_out_tr = transaction;

  sipevent = osip_new_outgoing_sipmessage (subscribe);
  sipevent->transactionid = transaction->transactionid;

  osip_transaction_set_reserved5 (transaction, js);
  osip_transaction_add_event (transaction, sipevent);

  ADD_ELEMENT (excontext->j_subscribes, js);
  _eXosip_update (excontext);   /* fixed? */
  _eXosip_wakeup (excontext);
  return js->s_id;
}
开发者ID:CrazyBBer,项目名称:sip_stack,代码行数:37,代码来源:eXsubscription_api.c


注:本文中的osip_message_free函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。