[Nice] Making sense of it all...

Youness Alaoui youness.alaoui at collabora.co.uk
Thu Aug 19 20:56:25 PDT 2010


On 08/19/2010 11:05 PM, Tony Di Croce wrote:
>     >> I would expect, then, to see a way to provide
>     >> that information to libnice, so that the two clients can begin
>     >> negotiating the best connection method...
>     >libnice is the one that will do the STUN requests, so you don't
>     need to do it
>     >yourself, and you don't need to give the result to libnice.
>     >All you need to do is set the 'stun-server' and 'stun-server-port'
>     properties on
>     >the NiceAgent object :
>     >http://nice.freedesktop.org/libnice/NiceAgent.html#NiceAgent--stun-server
>     >Then libnice will do the STUN mechanism when you call the
>     >nice_agent_gather_candidates() method
> 
> 
> Ok, so I can use nice_agent_get_local_candidates() to acquire a GSList*
> of local connection type candidates. I then transmit this to the other
> agent who probably does a nice_agent_set_remote_candidates() with that
> data (also, he acquired his local candidates, sent them to me, and I
> called nice_agent_set_remote_candidates() on those).
Yes, you also need to call nice_agent_get_local_credentials() to get your local
credentials (username/password) and call nice_agent_set_remote_credentials()
after the remote user/pass gets exchanged.
And yeah, sorry, I forgot to add those to the example code.
Don't forget that you also need to call the nice_agent_attach_recv() method to
make sure you receive data (such as the STUN response in the candidate gathering
phase).
There are other things you might want to do, make sure you read the gtk-doc of
the library and understand what each method is and what it's meant for.

> 
> Now all I need to know is how you serialize whatever data is returned in
> that GSList*, so I can transmit it. :) I think I'm starting to get this...

well, the serialization, if I understand what you mean, is how you send the
candidates to the other side, right ?
In that case, that's not part of the ICE methodology.. you can 'serialize' the
candidates/user/pass any way you want.. one method is to put it in the SDP of a
SIP invite. You can also send it as an XML using Jingle's XEP over an XMPP
connection.. it really all depends on what protocol is being used to connect to
the server (SIP, XMPP, custom, other...). I'll let you decide on the best way to
do that.
But I'm curious, what is it exactly you're trying to achieve with libnice? What
application are you working on? and what protocol is being used behind it ?

Good luck!
Youness.

> 
>     td
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/nice/attachments/20100819/8a33b3b4/attachment.pgp>


More information about the Nice mailing list