[Nice] New API and refactor

Youness Alaoui youness.alaoui at collabora.co.uk
Fri Jun 20 14:13:59 PDT 2008


I'm glad to say that I just finished the refactoring of the STUN module. 
I also ported the libnice library to the new API.. and best of all, 
'make check' is still working for all the libs.

You can find my changes in the git repository :

The main changes are that I added a StunAgent that will take care of all 
the validations and that will make sure that any received stun 
response/error does match a previously sent request.

I also changed the filenames and moved some functions from one file to 

All stun message related functions (stun_append_* and stun_find_* ) were 
changed to have the "stun_message_" prefix, and they now take a 
StunMessage structure. That structure is filled in by the agent either 
when you do a stun_agent_init_request/indication/response/error, or when 
you do stun_agent_validate.

Other changes include the fact that the NONCE/REALM/USERNAME attributes 
should be added by the user of the library, and not by the library 
itself.. the STUN module will only add the message-integrity and the 
fingerprint attributes if necessary.

The main problem I see now is with the stun 'bind' and 'stun-ice' 
usages.. those should not be in the stun module, they should be part of 
the libnice core functions and should be a lot simpler.

I'm sure I forgot to talk about some stuff...

anyways, if you have any questions regarding the new API, don't hesitate 
to ask me.

p.s.: the libnice API itself has not been modified.


More information about the Nice mailing list