Ejemplo n.º 1
0
void handle_nesc_nescdecl_attribute(nesc_attribute attr, nesc_declaration ndecl)
{
  iattr handler = internal_lookup(attr);

  if (handler)
    {
      if (handler->handle_ndecl)
	handler->handle_ndecl(attr, ndecl);
      else
	ignored_nesc_attribute(attr);
    }
  else
    save_user_attribute(attr, &ndecl->attributes);
}
Ejemplo n.º 2
0
void handle_nesc_tag_attribute(nesc_attribute attr, tag_declaration tdecl)
{
  iattr handler = internal_lookup(attr);

  if (handler)
    {
      if (handler->handle_tag)
	handler->handle_tag(attr, tdecl);
      else
	ignored_nesc_attribute(attr);
    }
  else
  save_user_attribute(attr, &tdecl->attributes);
}
Ejemplo n.º 3
0
void handle_nesc_field_attribute(nesc_attribute attr, field_declaration fdecl)
{
  iattr handler = internal_lookup(attr);

  if (handler)
    {
      if (handler->handle_field)
	handler->handle_field(attr, fdecl);
      else
	ignored_nesc_attribute(attr);
    }
  else
    save_user_attribute(attr, &fdecl->attributes);
}
Ejemplo n.º 4
0
void handle_nesc_type_attribute(nesc_attribute attr, type *t)
{
  iattr handler = internal_lookup(attr);

  if (handler)
    {
      if (handler->handle_type)
	handler->handle_type(attr, t);
      else
	ignored_nesc_attribute(attr);
    }
  /* In the future, we might want to record the attribute on the type,
     and support dumping this information in nesc-dump.c. For now,
     though, attributes on types are only useful if they are @macro()
     attributes */
}
Ejemplo n.º 5
0
static int lookup_matrix(struct sip_msg *msg, struct multiparam_t *_srctree, struct multiparam_t *_second, struct multiparam_t *_dstavp)
{
	int first;
	int second;
	struct usr_avp *avp;
	int_str avp_val;

	switch (_srctree->type) {
	case MP_INT:
		first = _srctree->u.n;
		break;
	case MP_AVP:
		avp = search_first_avp(_srctree->u.a.flags, _srctree->u.a.name, &avp_val, 0);
		if (!avp) {
			LM_ERR("cannot find srctree AVP\n");
			return -1;
		}
		if ((avp->flags&AVP_VAL_STR)) {
			LM_ERR("cannot process string value in srctree AVP\n");
			return -1;
		}
		else first = avp_val.n;
		break;
	default:
		LM_ERR("invalid srctree type\n");
		return -1;
	}

	switch (_second->type) {
	case MP_INT:
		second = _second->u.n;
		break;
	case MP_AVP:
		avp = search_first_avp(_second->u.a.flags, _second->u.a.name, &avp_val, 0);
		if (!avp) {
			LM_ERR("cannot find second_value AVP\n");
			return -1;
		}
		if ((avp->flags&AVP_VAL_STR)) {
			LM_ERR("cannot process string value in second_value AVP\n");
			return -1;
		}
		else second = avp_val.n;
		break;
	default:
		LM_ERR("invalid second_value type\n");
		return -1;
	}
	

	/* critical section start: avoids dirty reads when updating d-tree */
	lock_get(lock);

	avp_val.n=internal_lookup(first, second);

	/* critical section end */
	lock_release(lock);

	if (avp_val.n<0) {
		LM_INFO("lookup failed\n");
		return -1;
	}

	/* set avp ! */
	if (add_avp(_dstavp->u.a.flags, _dstavp->u.a.name, avp_val)<0) {
		LM_ERR("add AVP failed\n");
		return -1;
	}
	LM_INFO("result from lookup: %d\n", avp_val.n);
	return 1;
}