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


C++ osip_free函数代码示例

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


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

示例1: sip_login_do_login

static int sip_login_do_login(SipSetupContext * ctx, const char *uri, const char *passwd){
	LinphoneProxyConfig *cfg=sip_setup_context_get_proxy_config(ctx);
	LinphoneCore *lc=linphone_proxy_config_get_core(cfg);
	LinphoneAuthInfo *auth;
	osip_from_t *parsed_uri;
	char *tmp;

	osip_from_init(&parsed_uri);
	osip_from_parse(parsed_uri,uri);
	if (parsed_uri->displayname==NULL || strlen(parsed_uri->displayname)==0){
		guess_display_name(parsed_uri);
	}
	osip_from_to_str(parsed_uri,&tmp);
	linphone_proxy_config_set_identity(cfg,tmp);
	if (passwd ) {
		auth=linphone_auth_info_new(parsed_uri->url->username,NULL,passwd,NULL,NULL);
		linphone_core_add_auth_info(lc,auth);
	}
	linphone_proxy_config_enable_register(cfg,TRUE);
	linphone_proxy_config_done(cfg);
	osip_free(tmp);
	osip_from_free(parsed_uri);
	ms_message("SipLogin: done");
	return 0;
}
开发者ID:hunghtbk,项目名称:LinphoneV1,代码行数:25,代码来源:siplogin.c

示例2: _eXosip_subscribe_free

void
_eXosip_subscribe_free (struct eXosip_t *excontext, eXosip_subscribe_t * js)
{
  /* ... */

  eXosip_dialog_t *jd;

  if (js->s_inc_tr != NULL && js->s_inc_tr->orig_request != NULL && js->s_inc_tr->orig_request->call_id != NULL && js->s_inc_tr->orig_request->call_id->number != NULL)
    _eXosip_delete_nonce (excontext, js->s_inc_tr->orig_request->call_id->number);
  else if (js->s_out_tr != NULL && js->s_out_tr->orig_request != NULL && js->s_out_tr->orig_request->call_id != NULL && js->s_out_tr->orig_request->call_id->number != NULL)
    _eXosip_delete_nonce (excontext, js->s_out_tr->orig_request->call_id->number);

  for (jd = js->s_dialogs; jd != NULL; jd = js->s_dialogs) {
    REMOVE_ELEMENT (js->s_dialogs, jd);
    _eXosip_dialog_free (excontext, jd);
  }

  _eXosip_delete_reserved (js->s_inc_tr);
  _eXosip_delete_reserved (js->s_out_tr);
  if (js->s_inc_tr != NULL)
    osip_list_add (&excontext->j_transactions, js->s_inc_tr, 0);
  if (js->s_out_tr != NULL)
    osip_list_add (&excontext->j_transactions, js->s_out_tr, 0);

  osip_free (js);
}
开发者ID:CrazyBBer,项目名称:sip_stack,代码行数:26,代码来源:jsubscribe.c

示例3: sdp_message_clone

int
sdp_message_clone (sdp_message_t * sdp, sdp_message_t ** dest)
{
  int i;
  char *body;

  i = sdp_message_init (dest);
  if (i != 0)
    return -1;

  i = sdp_message_to_str (sdp, &body);
  if (i != 0)
    goto error_sc1;

  i = sdp_message_parse (*dest, body);
  osip_free (body);
  if (i != 0)
    goto error_sc1;

  return 0;

error_sc1:
  sdp_message_free (*dest);
  return -1;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:25,代码来源:sdp_message.c

示例4: main

int main(int argc, char **argv)
{
	FILE *froms_file;


	osip_from_t *from;
	char *a_from;
	char *dest;
	char *res;

	froms_file = fopen(argv[1], "r");
	if (froms_file == NULL) {
		fprintf(stdout, "Failed to open %s file.\nUsage: tfrom froms.txt\n",
				argv[1]);
		exit(0);
	}

	a_from = (char *) osip_malloc(200);
	res = fgets(a_from, 200, froms_file);	/* lines are under 200 */
	while (res != NULL) {

		int errcode;

		/* remove the last '\n' before parsing */
		strncpy(a_from + strlen(a_from) - 1, "\0", 1);

		if (0 != strncmp(a_from, "#", 1)) {
			/* allocate & init from */
			osip_from_init(&from);
			printf("=================================================\n");
			printf("FROM TO PARSE: |%s|\n", a_from);
			errcode = osip_from_parse(from, a_from);
			if (errcode != -1) {
				if (osip_from_to_str(from, &dest) != -1) {
					printf("result:        |%s|\n", dest);
					osip_free(dest);
				}
			} else
				printf("Bad from format: %s\n", a_from);
			osip_from_free(from);
			printf("=================================================\n");
		}
		res = fgets(a_from, 200, froms_file);	/* lines are under 200 */
	}
	osip_free(a_from);
	return 0;
}
开发者ID:AirDev,项目名称:linphone-android,代码行数:47,代码来源:tfrom.c

示例5: main

int main(int argc, char **argv)
{
	FILE *callids_file;


	osip_call_id_t *callid;
	char *a_callid;
	char *dest;
	char *res;

	callids_file = fopen(argv[1], "r");
	if (callids_file == NULL) {
		fprintf(stdout,
				"Failed to open %s file.\nUsage: tcallid callids.txt\n", argv[1]);
		exit(0);
	}

	a_callid = (char *) osip_malloc(200);
	res = fgets(a_callid, 200, callids_file);	/* lines are under 200 */
	while (res != NULL) {

		int errcode;

		/* remove the last '\n' before parsing */
		strncpy(a_callid + strlen(a_callid) - 1, "\0", 1);

		if (0 != strncmp(a_callid, "#", 1)) {
			/* allocate & init callid */
			osip_call_id_init(&callid);
			printf("=================================================\n");
			printf("CALLID TO PARSE: |%s|\n", a_callid);
			errcode = osip_call_id_parse(callid, a_callid);
			if (errcode != -1) {
				if (osip_call_id_to_str(callid, &dest) != -1) {
					printf("result:        |%s|\n", dest);
					osip_free(dest);
				}
			} else
				printf("Bad callid format: %s\n", a_callid);
			osip_call_id_free(callid);
			printf("=================================================\n");
		}
		res = fgets(a_callid, 200, callids_file);	/* lines are under 200 */
	}
	osip_free(a_callid);
	return 0;
}
开发者ID:AirDev,项目名称:linphone-android,代码行数:47,代码来源:tcallid.c

示例6: __osip_nist_init

int
__osip_nist_init (osip_nist_t ** nist, osip_t * osip, osip_message_t * invite)
{
  int i;

  OSIP_TRACE (osip_trace
              (__FILE__, __LINE__, OSIP_INFO2, NULL, "allocating NIST context\n"));

  *nist = (osip_nist_t *) osip_malloc (sizeof (osip_nist_t));
  if (*nist == NULL)
    return OSIP_NOMEM;
  memset (*nist, 0, sizeof (osip_nist_t));
  /* for INVITE retransmissions */
  {
    osip_via_t *via;
    char *proto;

    i = osip_message_get_via (invite, 0, &via); /* get top via */
    if (i < 0)
	{
	  osip_free (*nist);
	  *nist=NULL;
	  return i;
	}
    proto = via_get_protocol (via);
    if (proto == NULL)
	{
	  osip_free (*nist);
	  *nist=NULL;
	  return OSIP_UNDEFINED_ERROR;
	}

    if (osip_strcasecmp (proto, "TCP") != 0
        && osip_strcasecmp (proto, "TLS") != 0
        && osip_strcasecmp (proto, "SCTP") != 0)
      {
        (*nist)->timer_j_length = 64 * DEFAULT_T1;
        (*nist)->timer_j_start.tv_sec = -1;     /* not started */
    } else
      {                         /* reliable protocol is used: */
        (*nist)->timer_j_length = 0;    /* MUST do the transition immediatly */
        (*nist)->timer_j_start.tv_sec = -1;     /* not started */
      }
  }

  return OSIP_SUCCESS;
}
开发者ID:LaughingAngus,项目名称:linphone-vs2008,代码行数:47,代码来源:nist.c

示例7: aiptv_log_message

void aiptv_log_message(osip_message_t *sip_message)
{
char *dest = NULL;
size_t length = 0;
osip_message_to_str (sip_message, &dest, &length);
aiptv_log(dest);
osip_free(dest);
}
开发者ID:WindyCitySDR,项目名称:uctimscharging,代码行数:8,代码来源:auxilliary_methods.c

示例8: groups_ctx_free

void
groups_ctx_free()
{
    if (groups_context==NULL) return;

    osip_free(groups_context);
    groups_context = NULL;
}
开发者ID:gozfree,项目名称:src,代码行数:8,代码来源:groups.c

示例9: osip_content_type_to_str

/* returns null on error. */
int osip_content_type_to_str(const osip_content_type_t * content_type, char **dest)
{
	char *buf;
	char *tmp;
	size_t len;

	*dest = NULL;
	if ((content_type == NULL) || (content_type->type == NULL)
		|| (content_type->subtype == NULL))
		return OSIP_BADPARAMETER;

	/* try to guess a long enough length */
	len = strlen(content_type->type) + strlen(content_type->subtype) + 4	/* for '/', ' ', ';' and '\0' */
		+ 10 * osip_list_size(&content_type->gen_params);

	buf = (char *) osip_malloc(len);
	if (buf == NULL)
		return OSIP_NOMEM;
	tmp = buf;

	sprintf(tmp, "%s/%s", content_type->type, content_type->subtype);

	tmp = tmp + strlen(tmp);
	{
		int pos = 0;
		osip_generic_param_t *u_param;

#if 0
		if (!osip_list_eol(content_type->gen_params, pos)) {	/* needed for cannonical form! (authentication issue of rfc2543) */
			sprintf(tmp, " ");
			tmp++;
		}
#endif
		while (!osip_list_eol(&content_type->gen_params, pos)) {
			size_t tmp_len;

			u_param =
				(osip_generic_param_t *) osip_list_get(&content_type->gen_params,
													   pos);
			if (u_param->gvalue == NULL) {
				osip_free(buf);
				return OSIP_SYNTAXERROR;
			}
			tmp_len = strlen(buf) + 4 + strlen(u_param->gname)
				+ strlen(u_param->gvalue) + 1;
			if (len < tmp_len) {
				buf = osip_realloc(buf, tmp_len);
				len = tmp_len;
				tmp = buf + strlen(buf);
			}
			snprintf(tmp, len - (tmp - buf), "; %s=%s", u_param->gname, u_param->gvalue);
			tmp = tmp + strlen(tmp);
			pos++;
		}
	}
	*dest = buf;
	return OSIP_SUCCESS;
}
开发者ID:avis,项目名称:osip,代码行数:59,代码来源:osip_content_type.c

示例10: osip_dialog_match_as_uas

int
osip_dialog_match_as_uas (osip_dialog_t * dlg, osip_message_t * request)
{
    osip_generic_param_t *tag_param_remote;
    int i;
    char *tmp;

    osip_call_id_to_str (request->call_id, &tmp);
    if (0 != strcmp (dlg->call_id, tmp))
    {
        osip_free (tmp);
        return -1;
    }
    osip_free (tmp);

    /* for INCOMING REQUEST:
       To: local_uri;local_tag           <- LOCAL TAG ALWAYS EXIST
       From: remote_uri;remote_tag
     */

    if (dlg->local_tag == NULL)
        /* NOT POSSIBLE BECAUSE I MANAGE REMOTE_TAG AND I ALWAYS ADD IT! */
        return -1;

    i = osip_from_get_tag (request->from, &tag_param_remote);
    if (i != 0 && dlg->remote_tag != NULL)	/* no tag in request but tag in dialog */
        return -1;			/* impossible... */
    if (i != 0 && dlg->remote_tag == NULL)	/* no tag in request AND no tag in dialog */
    {
        if (0 ==
                osip_from_compare ((osip_from_t *) dlg->remote_uri, (osip_from_t *) request->from)
                && 0 == osip_from_compare (dlg->local_uri, request->to))
            return 0;
        return -1;
    }

    /* we don't have to compare
       remote_uri with from
       && local_uri with to.    ----> we have both tag recognized, it's enough..
     */
    if (0 == strcmp (tag_param_remote->gvalue, dlg->remote_tag))
        return 0;

    return -1;
}
开发者ID:smx-smx,项目名称:dsl-n55u,代码行数:45,代码来源:osip_dialog.c

示例11: osip_uri_free

void
osip_uri_free (osip_uri_t * url)
{
  int pos = 0;

  if (url == NULL)
    return;
  osip_free (url->scheme);
  osip_free (url->username);
  osip_free (url->password);
  osip_free (url->host);
  osip_free (url->port);

  osip_uri_param_freelist (&url->url_params);

  {
    osip_uri_header_t *u_header;

    while (!osip_list_eol (&url->url_headers, pos))
      {
        u_header = (osip_uri_header_t *) osip_list_get (&url->url_headers, pos);
        osip_list_remove (&url->url_headers, pos);
        osip_uri_header_free (u_header);
      }
  }

  osip_free (url->string);

  osip_free (url);
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:30,代码来源:osip_uri.c

示例12: strcat_simple_header

static int
strcat_simple_header (char **_string, size_t * malloc_size, char **_message, void *ptr_header, char *header_name, size_t size_of_header, int (*xxx_to_str) (void *, char **), char **next)
{
  char *string;
  char *message;
  char *tmp;
  int i;

  string = *_string;
  message = *_message;

  if (ptr_header != NULL) {
    if (*malloc_size < message - string + 100 + size_of_header)
      /* take some memory avoid to osip_realloc too much often */
    {                           /* should not happen often */
      size_t size = message - string;

      *malloc_size = message - string + size_of_header + 100;
      string = osip_realloc (string, *malloc_size);
      if (string == NULL) {
        *_string = NULL;
        *_message = NULL;
        return OSIP_NOMEM;
      }
      message = string + size;
    }
    message = osip_strn_append (message, header_name, size_of_header);

    i = xxx_to_str (ptr_header, &tmp);
    if (i != 0) {
      *_string = string;
      *_message = message;
      *next = NULL;
      return i;
    }
    if (*malloc_size < message - string + strlen (tmp) + 100) {
      size_t size = message - string;

      *malloc_size = message - string + strlen (tmp) + 100;
      string = osip_realloc (string, *malloc_size);
      if (string == NULL) {
        *_string = NULL;
        *_message = NULL;
        return OSIP_NOMEM;
      }
      message = string + size;
    }

    message = osip_str_append (message, tmp);
    osip_free (tmp);
    message = osip_strn_append (message, CRLF, 2);
  }
  *_string = string;
  *_message = message;
  *next = message;
  return OSIP_SUCCESS;
}
开发者ID:benjaminlevine,项目名称:Huawei-HG633-Open-Source-Software-Package,代码行数:57,代码来源:osip_message_to_str.c

示例13: PPL_DECLARE

PPL_DECLARE (int) ppl_pipe_close (ppl_pipe_t * apipe)
{
  if (apipe == NULL)
    return -1;
  ppl_socket_close (apipe->pipes[0]);
  ppl_socket_close (apipe->pipes[1]);
  osip_free (apipe);
  return 0;
}
开发者ID:gozfree,项目名称:src,代码行数:9,代码来源:pplpipe.c

示例14: jpipe_close

int jpipe_close (jpipe_t * apipe)
{
  if (apipe == NULL)
    return -1;
  close (apipe->pipes[0]);
  close (apipe->pipes[1]);
  osip_free (apipe);
  return 0;
}
开发者ID:BackupTheBerlios,项目名称:sfsipua-svn,代码行数:9,代码来源:jpipe.c

示例15: jpipe_close

int jpipe_close(jpipe_t * apipe)
{
	if (apipe == NULL)
		return OSIP_BADPARAMETER;
	close(apipe->pipes[0]);
	close(apipe->pipes[1]);
	osip_free(apipe);
	return OSIP_SUCCESS;
}
开发者ID:AirDev,项目名称:linphone-android,代码行数:9,代码来源:jpipe.c


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