Exemplo n.º 1
0
static void cb_agent_new_candidate(NiceAgent *agent, guint stream_id, guint component_id, gchar *foundation, gpointer user_data)
{
  NiceAgent *other = g_object_get_data (G_OBJECT (agent), "other-agent");
  GSList *cands = nice_agent_get_local_candidates (agent, stream_id,
                                                   component_id);
  GSList *i = NULL;
  GSList *remote_cands = NULL;
  NiceCandidate* temp;
  gpointer tmp;
  guint id;

  g_debug ("test-dribblemode:%s: %p", G_STRFUNC, user_data);

  tmp = g_object_get_data (G_OBJECT (other), "id");
  id = GPOINTER_TO_UINT (tmp);

  for (i = cands; i; i = i->next) {
    temp = (NiceCandidate*) i->data;
    if (g_strcmp0(temp->foundation, foundation) == 0) {
      g_debug ("Adding new local candidate to other agent's connchecks");
      remote_cands = g_slist_prepend (remote_cands, nice_candidate_copy(temp));
      g_assert (nice_agent_set_remote_candidates (other, id,
                                                  NICE_COMPONENT_TYPE_RTP,
                                                  remote_cands));
    }
  }

  g_slist_free_full (remote_cands, (GDestroyNotify) nice_candidate_free);
  g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free);

}
Exemplo n.º 2
0
NiceCandidate *
component_set_selected_remote_candidate (NiceAgent *agent, Component *component,
    NiceCandidate *candidate)
{
  NiceCandidate *local = NULL;
  NiceCandidate *remote = NULL;
  guint32 priority = 0;
  GSList *item = NULL;

  for (item = component->local_candidates; item; item = g_slist_next (item)) {
    NiceCandidate *tmp = item->data;
    guint32 tmp_prio = 0;

    if (tmp->transport != candidate->transport ||
	tmp->addr.s.addr.sa_family != candidate->addr.s.addr.sa_family ||
        tmp->type != NICE_CANDIDATE_TYPE_HOST)
      continue;

    tmp_prio = agent_candidate_pair_priority (agent, tmp, candidate);

    if (tmp_prio > priority) {
      priority = tmp_prio;
      local = tmp;
    }
  }

  if (local == NULL)
    return NULL;

  remote = component_find_remote_candidate (component, &candidate->addr,
      candidate->transport);

  if (!remote) {
    remote = nice_candidate_copy (candidate);
    component->remote_candidates = g_slist_append (component->remote_candidates,
        remote);
    agent_signal_new_remote_candidate (agent, remote);
  }

  if (component->selected_pair.keepalive.tick_source != NULL) {
    g_source_destroy (component->selected_pair.keepalive.tick_source);
    g_source_unref (component->selected_pair.keepalive.tick_source);
    component->selected_pair.keepalive.tick_source = NULL;
  }

  memset (&component->selected_pair, 0, sizeof(CandidatePair));
  component->selected_pair.local = local;
  component->selected_pair.remote = remote;
  component->selected_pair.priority = priority;

  return local;
}
Exemplo n.º 3
0
NiceCandidate *
nice_component_set_selected_remote_candidate (NiceComponent *component,
    NiceAgent *agent, NiceCandidate *candidate)
{
  NiceCandidate *local = NULL;
  NiceCandidate *remote = NULL;
  guint64 priority = 0;
  GSList *item = NULL;

  g_assert (candidate != NULL);

  for (item = component->local_candidates; item; item = g_slist_next (item)) {
    NiceCandidate *tmp = item->data;
    guint64 tmp_prio = 0;

    if (tmp->transport != conn_check_match_transport(candidate->transport) ||
	tmp->addr.s.addr.sa_family != candidate->addr.s.addr.sa_family ||
        tmp->type != NICE_CANDIDATE_TYPE_HOST)
      continue;

    tmp_prio = agent_candidate_pair_priority (agent, tmp, candidate);

    if (tmp_prio > priority) {
      priority = tmp_prio;
      local = tmp;
    }
  }

  if (local == NULL)
    return NULL;

  remote = nice_component_find_remote_candidate (component, &candidate->addr,
      candidate->transport);

  if (!remote) {
    remote = nice_candidate_copy (candidate);
    component->remote_candidates = g_slist_append (component->remote_candidates,
        remote);
    agent_signal_new_remote_candidate (agent, remote);
  }

  nice_component_clear_selected_pair (component);

  component->selected_pair.local = local;
  component->selected_pair.remote = remote;
  component->selected_pair.priority = priority;

  return local;
}
Exemplo n.º 4
0
static GSList *priv_get_local_candidate (NiceAgent *agent, guint stream_id, guint component_id)
{
  GSList *cands, *i;
  GSList *result = NULL;
  NiceCandidate *out_cand = NULL;
  cands = nice_agent_get_local_candidates(agent, stream_id, component_id);
  for (i = cands; i; i = i->next) {
    NiceCandidate *cand = i->data;
    if (cand) {
      out_cand = cand;
    }
  }
  result = g_slist_append (result, nice_candidate_copy (out_cand));

  for (i = cands; i; i = i->next)
    nice_candidate_free ((NiceCandidate *) i->data);
  g_slist_free (cands);
  return result;
}
Exemplo n.º 5
0
GSList* soy_net_xmpp_agent_get_remote_candidates (soynetXMPPAgent* self, LmMessageNode* transport, guint stream_id) {
	GSList* result = NULL;
	GSList* rcands = NULL;
	LmMessageNode* candidate = NULL;
	LmMessageNode* _tmp0_ = NULL;
	LmMessageNode* _tmp1_ = NULL;
	LmMessageNode* _tmp2_ = NULL;
	LmMessageNode* _tmp3_ = NULL;
	GSList* _tmp45_ = NULL;
	GSList* _tmp46_ = NULL;
#line 119 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	g_return_val_if_fail (self != NULL, NULL);
#line 119 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	g_return_val_if_fail (transport != NULL, NULL);
#line 120 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	rcands = NULL;
#line 121 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_tmp0_ = transport;
#line 121 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_tmp1_ = lm_message_node_get_child (_tmp0_, "candidate");
#line 121 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_tmp2_ = _lm_message_node_ref0 (_tmp1_);
#line 121 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	candidate = _tmp2_;
#line 124 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_tmp3_ = candidate;
#line 124 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	if (_tmp3_ == NULL) {
#line 125 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		result = rcands;
#line 125 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_lm_message_node_unref0 (candidate);
#line 125 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		return result;
#line 584 "XMPPAgent.c"
	}
#line 127 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	while (TRUE) {
#line 588 "XMPPAgent.c"
		LmMessageNode* _tmp4_ = NULL;
		NiceCandidate* rcand = NULL;
		GeeHashMap* _tmp5_ = NULL;
		LmMessageNode* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		gpointer _tmp8_ = NULL;
		NiceCandidate* _tmp9_ = NULL;
		LmMessageNode* _tmp10_ = NULL;
		const gchar* _tmp11_ = NULL;
		LmMessageNode* _tmp12_ = NULL;
		const gchar* _tmp13_ = NULL;
		LmMessageNode* _tmp14_ = NULL;
		const gchar* _tmp15_ = NULL;
		LmMessageNode* _tmp16_ = NULL;
		const gchar* _tmp17_ = NULL;
		NiceCandidate* _tmp18_ = NULL;
		LmMessageNode* _tmp19_ = NULL;
		const gchar* _tmp20_ = NULL;
		NiceCandidate* _tmp21_ = NULL;
		LmMessageNode* _tmp22_ = NULL;
		const gchar* _tmp23_ = NULL;
		gint _tmp24_ = 0;
		NiceCandidate* _tmp25_ = NULL;
		NiceCandidate* _tmp26_ = NULL;
		LmMessageNode* _tmp27_ = NULL;
		const gchar* _tmp28_ = NULL;
		gint _tmp29_ = 0;
		NiceCandidate* _tmp30_ = NULL;
		LmMessageNode* _tmp31_ = NULL;
		const gchar* _tmp32_ = NULL;
		gint _tmp33_ = 0;
		NiceCandidate* _tmp34_ = NULL;
		guint _tmp35_ = 0U;
		NiceCandidate* _tmp36_ = NULL;
		gboolean _tmp37_ = FALSE;
		gchar* _tmp38_ = NULL;
		gchar* _tmp39_ = NULL;
		NiceCandidate* _tmp40_ = NULL;
		NiceCandidate* _tmp41_ = NULL;
		LmMessageNode* _tmp42_ = NULL;
		LmMessageNode* _tmp43_ = NULL;
		LmMessageNode* _tmp44_ = NULL;
#line 127 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp4_ = candidate;
#line 127 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		if (!(_tmp4_ != NULL)) {
#line 127 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
			break;
#line 637 "XMPPAgent.c"
		}
#line 129 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp5_ = soy_net_xmpp_agent_candidate_type_dict;
#line 129 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp6_ = candidate;
#line 129 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp7_ = lm_message_node_get_attribute (_tmp6_, "type");
#line 129 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp8_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, _tmp7_);
#line 129 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp9_ = nice_candidate_new ((guint) ((gint) ((gintptr) _tmp8_)));
#line 129 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		rcand = _tmp9_;
#line 131 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		g_print ("Remote Candidate\n");
#line 132 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp10_ = candidate;
#line 132 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp11_ = lm_message_node_get_attribute (_tmp10_, "ip");
#line 132 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		g_print ("%s\n", _tmp11_);
#line 133 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp12_ = candidate;
#line 133 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp13_ = lm_message_node_get_attribute (_tmp12_, "port");
#line 133 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		g_print ("port: %s\n", _tmp13_);
#line 134 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp14_ = candidate;
#line 134 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp15_ = lm_message_node_get_attribute (_tmp14_, "priority");
#line 134 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		g_print ("priority:  %s\n", _tmp15_);
#line 135 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp16_ = candidate;
#line 135 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp17_ = lm_message_node_get_attribute (_tmp16_, "component");
#line 135 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		g_print ("component %s\n", _tmp17_);
#line 138 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp18_ = rcand;
#line 138 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp19_ = candidate;
#line 138 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp20_ = lm_message_node_get_attribute (_tmp19_, "ip");
#line 138 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		nice_address_set_from_string (&_tmp18_->addr, _tmp20_);
#line 139 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp21_ = rcand;
#line 139 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp22_ = candidate;
#line 139 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp23_ = lm_message_node_get_attribute (_tmp22_, "port");
#line 139 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp24_ = atoi (_tmp23_);
#line 139 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		nice_address_set_port (&_tmp21_->addr, (guint) _tmp24_);
#line 140 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp25_ = rcand;
#line 140 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp25_->transport = NICE_CANDIDATE_TRANSPORT_UDP;
#line 141 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp26_ = rcand;
#line 141 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp27_ = candidate;
#line 141 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp28_ = lm_message_node_get_attribute (_tmp27_, "priority");
#line 141 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp29_ = atoi (_tmp28_);
#line 141 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp26_->priority = (guint32) _tmp29_;
#line 142 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp30_ = rcand;
#line 142 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp31_ = candidate;
#line 142 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp32_ = lm_message_node_get_attribute (_tmp31_, "component");
#line 142 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp33_ = atoi (_tmp32_);
#line 142 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp30_->component_id = (guint) _tmp33_;
#line 143 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp34_ = rcand;
#line 143 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp35_ = stream_id;
#line 143 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp34_->stream_id = _tmp35_;
#line 145 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp36_ = rcand;
#line 145 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp37_ = nice_address_is_valid (&_tmp36_->addr);
#line 145 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp38_ = bool_to_string (_tmp37_);
#line 145 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp39_ = _tmp38_;
#line 145 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		g_print ("%s\n", _tmp39_);
#line 145 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_g_free0 (_tmp39_);
#line 146 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp40_ = rcand;
#line 146 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp41_ = nice_candidate_copy (_tmp40_);
#line 146 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		rcands = g_slist_append (rcands, _tmp41_);
#line 147 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp42_ = candidate;
#line 147 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp43_ = _tmp42_->next;
#line 147 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_tmp44_ = _lm_message_node_ref0 (_tmp43_);
#line 147 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_lm_message_node_unref0 (candidate);
#line 147 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		candidate = _tmp44_;
#line 127 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
		_nice_candidate_free0 (rcand);
#line 755 "XMPPAgent.c"
	}
#line 148 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_tmp45_ = rcands;
#line 148 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_tmp46_ = g_slist_copy (_tmp45_);
#line 148 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	result = _tmp46_;
#line 148 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_lm_message_node_unref0 (candidate);
#line 148 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	_g_slist_free0 (rcands);
#line 148 "/home/jeff/Documents/libraries/libsoy/src/net/XMPPAgent.gs"
	return result;
#line 769 "XMPPAgent.c"
}