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


C++ osip_list_size函数代码示例

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


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

示例1: sdp_message_a_attribute_del_at_index

int
sdp_message_a_attribute_del_at_index (sdp_message_t * sdp, int pos_media,
                                      char *att_field, int pos_attr)
{
  int i;
  sdp_media_t *med;
  sdp_attribute_t *attr;

  if (sdp == NULL)
    return -1;
  if ((pos_media != -1) && (osip_list_size (&sdp->m_medias) < pos_media + 1))
    return -1;
  if (pos_media == -1)
    {
      if (pos_attr == -1)
        {
          for (i = 0; i < osip_list_size (&sdp->a_attributes);)
            {
              attr = osip_list_get (&sdp->a_attributes, i);
              if (strcmp (attr->a_att_field, att_field) == 0)
                {
                  osip_list_remove (&sdp->a_attributes, i);
                  sdp_attribute_free (attr);
              } else
                i++;
            }
      } else if ((attr = osip_list_get (&sdp->a_attributes, pos_attr)) != NULL)
        {
          osip_list_remove (&sdp->a_attributes, pos_attr);
          sdp_attribute_free (attr);
        }
      return 0;
    }
  med = (sdp_media_t *) osip_list_get (&sdp->m_medias, pos_media);
  if (med == NULL)
    return -1;
  for (i = 0; i < osip_list_size (&med->a_attributes);)
    {
      if (pos_attr == -1)
        {
          attr = osip_list_get (&med->a_attributes, i);
          if (strcmp (attr->a_att_field, att_field) == 0)
            {
              osip_list_remove (&med->a_attributes, i);
              sdp_attribute_free (attr);
          } else
            i++;
      } else if ((attr = osip_list_get (&med->a_attributes, pos_attr)) != NULL)
        {
          osip_list_remove (&med->a_attributes, pos_attr);
          sdp_attribute_free (attr);
        }
    }
  return 0;
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:55,代码来源:sdp_accessor.c

示例2: osip_dialog_update_route_set_as_uac

int
osip_dialog_update_route_set_as_uac (osip_dialog_t * dialog, osip_message_t * response)
{
  /* only the remote target URI is updated here... */
  osip_contact_t *contact;
  int i;

  if (dialog == NULL)
    return OSIP_BADPARAMETER;
  if (response == NULL)
    return OSIP_BADPARAMETER;

  if (osip_list_eol (&response->contacts, 0)) { /* no contact header in response? */
    OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_WARNING, NULL, "missing a contact in response!\n"));
  }
  else {
    /* I personally think it's a bad idea to keep the old
       value in case the new one is broken... */
    if (dialog->remote_contact_uri != NULL) {
      osip_contact_free (dialog->remote_contact_uri);
    }
    dialog->remote_contact_uri = NULL;
    contact = osip_list_get (&response->contacts, 0);
    i = osip_contact_clone (contact, &(dialog->remote_contact_uri));
    if (i != 0)
      return i;
  }

  if (dialog->state == DIALOG_EARLY && osip_list_size (&dialog->route_set) > 0) {
    osip_list_special_free (&dialog->route_set, (void (*)(void *)) &osip_record_route_free);
    osip_list_init (&dialog->route_set);
  }

  if (dialog->state == DIALOG_EARLY && osip_list_size (&dialog->route_set) == 0) {      /* update the route set */
    int pos = 0;

    while (!osip_list_eol (&response->record_routes, pos)) {
      osip_record_route_t *rr;
      osip_record_route_t *rr2;

      rr = (osip_record_route_t *) osip_list_get (&response->record_routes, pos);
      i = osip_record_route_clone (rr, &rr2);
      if (i != 0)
        return i;
      osip_list_add (&dialog->route_set, rr2, 0);
      pos++;
    }
  }

  if (MSG_IS_STATUS_2XX (response))
    dialog->state = DIALOG_CONFIRMED;
  return OSIP_SUCCESS;
}
开发者ID:benjaminlevine,项目名称:Huawei-HG633-Open-Source-Software-Package,代码行数:53,代码来源:osip_dialog.c

示例3: 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 -1;

  /* 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);
  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 (!osip_list_eol (content_type->gen_params, pos))
      {				/* needed for cannonical form! (authentication issue of rfc2543) */
	sprintf (tmp, " ");
	tmp++;
      }
    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 -1;
	  }
	tmp_len = strlen (buf) + 4 + strlen (u_param->gname)
	  + strlen (u_param->gvalue);
	if (len < tmp_len)
	  {
	    buf = osip_realloc (buf, tmp_len);
	    len = tmp_len;
	    tmp = buf + strlen (buf);
	  }
	sprintf (tmp, ";%s=%s", u_param->gname, u_param->gvalue);
	tmp = tmp + strlen (tmp);
	pos++;
      }
  }
  *dest = buf;
  return 0;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:61,代码来源:osip_content_type.c

示例4: GB_Find_Record_Node_by_cmdType

GB_Record_Node * GB_Find_Record_Node_by_cmdType(GB_CONNECT_STATE *gb_cons, int cmdType, int idx, int *index)
{
	GB_Record_Node *record = NULL;
	int pos;
	int list_size = 0;

	if(gb_cons == NULL || cmdType < 0 || cmdType >= gb_CommandType_NUM || idx < 0)
	{
		TRACE(SCI_TRACE_NORMAL,MOD_GB,"%s  line=%d  Err\n",__FUNCTION__,__LINE__);
		return NULL;
	}

	list_size = osip_list_size(&(gb_cons->record_node_list));
	if(list_size <= 0)
	{
		return NULL;	
	}
	
	for(pos=idx; pos<list_size; pos++)
	{
		record = osip_list_get(&(gb_cons->record_node_list), pos);
		if(record)
		{
			if(record->cmd == cmdType && record->call_id == NULL)
			{
				*index = pos;
				return record;
			}
			record = NULL;
		}
	}

	return NULL;	
}
开发者ID:github188,项目名称:Decoder_GB,代码行数:34,代码来源:GB_parser.c

示例5: GB_Find_Record_Node_by_Call_ID

GB_Record_Node * GB_Find_Record_Node_by_Call_ID(GB_CONNECT_STATE *gb_cons, osip_call_id_t *call_id, int *index)
{
	GB_Record_Node *record = NULL;
	int pos;
	int list_size = 0;

	if(gb_cons == NULL || call_id == NULL)
	{
		TRACE(SCI_TRACE_NORMAL,MOD_GB,"%s  line=%d  Err\n",__FUNCTION__,__LINE__);
		return NULL;
	}

	list_size = osip_list_size(&(gb_cons->record_node_list));
	if(list_size <= 0)
	{
		return NULL;	
	}
	
	for(pos=0; pos<list_size; pos++)
	{
		record = osip_list_get(&(gb_cons->record_node_list), pos);
		if(record)
		{
			if(osip_call_id_match(record->call_id, call_id) == 0)
			{
				*index = pos;
				return record;
			}
			record = NULL;
		}
	}

	return NULL;	
}
开发者ID:github188,项目名称:Decoder_GB,代码行数:34,代码来源:GB_parser.c

示例6: GB_Remove_Record_Node

int GB_Remove_Record_Node(GB_CONNECT_STATE *gb_cons, int index)
{
	GB_Record_Node *record = NULL;

	if(gb_cons == NULL)
	{
		TRACE(SCI_TRACE_NORMAL,MOD_GB,"%s  line=%d  Err\n",__FUNCTION__,__LINE__);
		return -1;
	}
	
	if(index <= osip_list_size(&(gb_cons->record_node_list)) && index >= 0)
	{
		record = (GB_Record_Node *)osip_list_get(&(gb_cons->record_node_list), index);

		if(record)
		{
			if(record->call_id)
				osip_call_id_free(record->call_id);
			if(record->data)
				SN_FREE(record->data);
			osip_list_remove(&(gb_cons->record_node_list), index);
			SN_FREE(record);

			return 0;
		}
	}

	return -1;
	
}
开发者ID:github188,项目名称:Decoder_GB,代码行数:30,代码来源:GB_parser.c

示例7: sdp_message_c_connection_add

int
sdp_message_c_connection_add (sdp_message_t * sdp, int pos_media,
                              char *nettype, char *addrtype,
                              char *addr, char *addr_multicast_ttl,
                              char *addr_multicast_int)
{
  int i;
  sdp_media_t *med;
  sdp_connection_t *conn;

  if (sdp == NULL)
    return -1;
  if ((pos_media != -1) && (osip_list_size (&sdp->m_medias) < pos_media + 1))
    return -1;
  i = sdp_connection_init (&conn);
  if (i != 0)
    return -1;
  conn->c_nettype = nettype;
  conn->c_addrtype = addrtype;
  conn->c_addr = addr;
  conn->c_addr_multicast_ttl = addr_multicast_ttl;
  conn->c_addr_multicast_int = addr_multicast_int;
  if (pos_media == -1)
    {
      sdp->c_connection = conn;
      return 0;
    }
  med = (sdp_media_t *) osip_list_get (&sdp->m_medias, pos_media);
  osip_list_add (&med->c_connections, conn, -1);
  return 0;
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:31,代码来源:sdp_accessor.c

示例8: GB_ResetConState

void GB_ResetConState(GB_CONNECT_STATE *gb_cons)
{
	if (gb_cons == NULL)
		return;

	TRACE(SCI_TRACE_NORMAL,MOD_GB,"GB_ResetConState\n");
	
	gb_cons->cur_state = GB_STATE_IDEL;
	gb_cons->connfd = -1;
	gb_cons->local_cseq = 1;
	gb_cons->bUnRegister = 0;

	if (gb_cons->wwwa)
	{
		osip_www_authenticate_free(gb_cons->wwwa);
		gb_cons->wwwa = NULL;	
	}
			
	GB_reset_recv_buffer(gb_cons, 0);

	if(osip_list_size(&(gb_cons->record_node_list)) > 0)
	{
		GB_reset_Record_Node_list(gb_cons);
	}
	osip_list_init(&(gb_cons->record_node_list));


	gb_cons->keepalive_timeout_cnt = 0;
	gb_cons->last_keepalivetime = 0;
	gb_cons->last_sendtime = 0;
	gb_cons->last_registertime = 0;

	return ;
}
开发者ID:github188,项目名称:Decoder_GB,代码行数:34,代码来源:GB_sipd.c

示例9: sdp_message_b_bandwidth_add

int
sdp_message_b_bandwidth_add (sdp_message_t * sdp, int pos_media, char *bwtype,
                             char *bandwidth)
{
  int i;
  sdp_media_t *med;
  sdp_bandwidth_t *band;

  if (sdp == NULL)
    return -1;
  if ((pos_media != -1) && (osip_list_size (&sdp->m_medias) < pos_media + 1))
    return -1;
  i = sdp_bandwidth_init (&band);
  if (i != 0)
    return -1;
  band->b_bwtype = bwtype;
  band->b_bandwidth = bandwidth;
  if (pos_media == -1)
    {
      osip_list_add (&sdp->b_bandwidths, band, -1);
      return 0;
    }
  med = (sdp_media_t *) osip_list_get (&sdp->m_medias, pos_media);
  osip_list_add (&med->b_bandwidths, band, -1);
  return 0;
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:26,代码来源:sdp_accessor.c

示例10: sdp_message_a_attribute_add

int
sdp_message_a_attribute_add (sdp_message_t * sdp, int pos_media,
                             char *att_field, char *att_value)
{
  int i;
  sdp_media_t *med;
  sdp_attribute_t *attr;

  if (sdp == NULL)
    return -1;
  if ((pos_media != -1) && (osip_list_size (&sdp->m_medias) < pos_media + 1))
    return -1;
  i = sdp_attribute_init (&attr);
  if (i != 0)
    return -1;
  attr->a_att_field = att_field;
  attr->a_att_value = att_value;
  if (pos_media == -1)
    {
      osip_list_add (&sdp->a_attributes, attr, -1);
      return 0;
    }
  med = (sdp_media_t *) osip_list_get (&sdp->m_medias, pos_media);
  osip_list_add (&med->a_attributes, attr, -1);
  return 0;
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:26,代码来源:sdp_accessor.c

示例11: osip_fifo_insert

int
osip_fifo_insert (osip_fifo_t * ff, void *el)
{
#ifdef OSIP_MT
  osip_mutex_lock (ff->qislocked);
#endif

  if (ff->etat != plein)
    {
      /* ff->nb_elt++; */
      osip_list_add (ff->queue, el, 0);	/* insert at end of queue */
    }
  else
    {
      OSIP_TRACE (osip_trace
		  (__FILE__, __LINE__, OSIP_WARNING, NULL,
		   "too much traffic in fifo.\n"));
#ifdef OSIP_MT
      osip_mutex_unlock (ff->qislocked);
#endif
      return -1;		/* stack is full */
    }
  /* if (ff->nb_elt >= MAX_LEN) */
  if (osip_list_size (ff->queue) >= MAX_LEN)
    ff->etat = plein;
  else
    ff->etat = ok;

#ifdef OSIP_MT
  osip_sem_post (ff->qisempty);
  osip_mutex_unlock (ff->qislocked);
#endif
  return 0;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:34,代码来源:port_fifo.c

示例12: osip_fifo_get

void *
osip_fifo_get (osip_fifo_t * ff)
{
  void *el;
  int i = osip_sem_wait (ff->qisempty);

  if (i != 0)
    return NULL;
  osip_mutex_lock (ff->qislocked);

  if (ff->etat != vide)
    {
      el = osip_list_get (ff->queue, 0);
      osip_list_remove (ff->queue, 0);
      /* ff->nb_elt--; */
    }
  else
    {
      OSIP_TRACE (osip_trace
		  (__FILE__, __LINE__, OSIP_ERROR, NULL,
		   "no element in fifo.\n"));
      osip_mutex_unlock (ff->qislocked);
      return 0;			/* pile vide */
    }
  /* if (ff->nb_elt <= 0) */
  if (osip_list_size (ff->queue) <= 0)
    ff->etat = vide;
  else
    ff->etat = ok;

  osip_mutex_unlock (ff->qislocked);
  return el;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:33,代码来源:port_fifo.c

示例13: osip_message_get_knownheaderlist

int
osip_message_get_knownheaderlist (osip_list_t * header_list, int pos, void **dest)
{
  *dest = NULL;
  if (osip_list_size (header_list) <= pos)
    return OSIP_UNDEFINED_ERROR;        /* does not exist */
  *dest = (void *) osip_list_get (header_list, pos);
  return pos;
}
开发者ID:Christof0113,项目名称:rtsp-tools,代码行数:9,代码来源:osip_message.c

示例14: osip_message_get_header

/* return null on error. */
int
osip_message_get_header (const osip_message_t * sip, int pos, osip_header_t ** dest)
{
  *dest = NULL;
  if (osip_list_size (sip->headers) <= pos)
    return -1;			/* NULL */
  *dest = (osip_header_t *) osip_list_get (sip->headers, pos);
  return 0;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:10,代码来源:osip_header.c

示例15: osip_message_get_header

/* return null on error. */
int
osip_message_get_header(const osip_message_t * sip, int pos, osip_header_t ** dest)
{
	*dest = NULL;
	if (osip_list_size(&sip->headers) <= pos)
		return OSIP_UNDEFINED_ERROR;	/* NULL */
	*dest = (osip_header_t *) osip_list_get(&sip->headers, pos);
	return pos;
}
开发者ID:avis,项目名称:osip,代码行数:10,代码来源:osip_header.c


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