[sr-dev] git:master: core: extended xavp api

Juha Heinanen jh at tutpro.com
Wed Dec 26 13:17:30 CET 2012


Daniel-Constantin Mierla writes:

> - functions to add an avp last in a list or inserted at a specific
>   position, to extract an avp from top of the list

in t_serial.c, i'm currently adding branches to contacts_avp like this:

while (there are contacts left) {
  record = NULL;
  several xavp_add_value(&name, &val, &record) calls;
  val.type = SR_XTYPE_XAVP;
  val.v.xavp = record;
  xavp_add_value(&contacts_avp, &val, NULL);
}

i'm wondering, if it would be faster to do this instead:

list = NULL;
while (there are contacts left) {
  record = NULL;
  several xavp_add_value(&name, &val, &record) calls;
  val.type = SR_XTYPE_XAVP;
  val.v.xavp = record;
  xavp_add(&val, &list);
}
val.type = SR_XTYPE_XAVP;
val.v.xavp = list;
xavp_add_value(&contacts_avp, &val, NULL);

but after that xavp_get(&contacts_avp, NULL) returns a list of xavps
that contains only one element although i added three to the list.

obviously, i do not understand the semantics of the new xavp api
functions.

what is the best way to achieve what i'm trying to do, i.e., add several
xavps to contacts_avp?

-- juha



More information about the sr-dev mailing list