2007/7/6, Fabio Margarido <[EMAIL PROTECTED]>:
> first of all, thanks a lot for the new documentation on statistics related
> tags, it's been very helpful.
> What I'd like to do now is take statistics one step further:
> 1) Is it possible to query the stack for statistics passing some kind of
> parameters (like asking for the number of retransmissions to target IP
> x.x.x.x, or number of retransmissions of INVITEs)? - I'm guessing no

No, not at the moment.

> 2) If not, would it be hard to do?

Add a custom callback for updating the application-specific statistics.

For instance, each time the nta updates statistics it could invoke a
application specific callback with prototype like

stat_callback(
  nta_agent_magic_t *context,
  tag_type_t item,
  msg_t *message,
  sip_t *sip_headers);

where event would be a particular ntatag_s_* tag. If you would like to
count requests sent to x.y.z.w you would just check that item ==
ntatag_s_sent_request and that msg_addr(message) would contain IP
address x,y.z.w and then increment your counter...

> 3) If that's not up in your priorities list, is it something someone who's
> not so familiar with the code (say, me) would be able to do?

Why not... Add a new tag accepting a pointer. Say, copy code dealing
with  ntatag_mclass in nta_tag.h and nta_tag.c, and add a prototype
for the callback in <sofia-sip/nta_tag.h> like

typedef void nta_stat_callback_f(
  nta_agent_magic_t *context,
  tag_type_t item,
  msg_t *message,
  sip_t *sip_headers);

Then add a field for pointer (say, sa_stat_cb) in struct nta_agent_s
in <nta_internal.h>:

nta_stat_callback_f *sa_stat_cb;

Next you copy mclass handling in agent_set_params() and
agent_get_params() in <nta.c>. Finally you should track all the code
incrementing counters in sa_stats within the nta.c and calls to
sa_stat_cb (preferably checking that sa_stat_cb is non-null first).

-- 
Pekka.Pessi mail at nokia.com

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to