Hi all,

I'm trying to understand how the sresolv "simple" interface works.
For this reason I wrote this small application in my sandbox, it
compiles but of course it doesn't do what I'd like to do.

I checked the doxy for sres_resolver_create() but they're quite
incomplete either I'm too dumb to understand how to properly use it.

I think this interface should work by registering some handler when
waiting for the DNS query, but I cuouldn't figure out how to register
that.

Also I would like if possible a simple description about the tags in
the sres_resolver_create (that is what they're meant to contain).

Here it is the application.
--------------------------------8<-----------------------------------
#include <sofia-sip/sresolv.h>
#include <sofia-sip/su_log.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char** argv)
{
    /* the main thread of the application which handles all the incoming events 
*/      
    su_root_t *root;

    su_log_set_level(NULL, 9);

    if (argc <= 1) {
        fprintf(stderr, "Missing the address to resolve");
        exit(1);
    }
    const char* address = argv[1];

    /* Initialize Sofia-SIP library and create event loop */
    su_init ();
    root = su_root_create(NULL);
    /* at first I need to create the DNS resolver object */

    sres_resolver_t* res = sres_resolver_create(root,
                                                "etc/resolv.conf",
                                                TAG_NULL());

    /* when should I take care of the destruction of the resolver object? */
    /* I think I should register somewhere an handler which manages the 
response of the
     * query, then invoke its destruction from there */
    /* sres_resolver_destroy(res); */

    /* waits for godot */
    while(1)
        sleep(1);

    exit(0);
}
--------------------------------8<-----------------------------------

Maybe I'm just too lazy and I should simply read the code, I'm doing
it but I'm still far from getting a good grasp of how the whole system
works.

By the way, I also noticed that the doxy documentation is scattered
through C and header files (while I'd expect it to be defined only in
the headers), is there a particular reason for this?

I should be very grateful for any hint you can provide.

Best regards.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to