On Sun, Jun 20, 2004 at 01:44:48PM -0400, Robert Story wrote:
> Use the delegated flag and either a separate thread or a periodic non-blocking
> read.

Ok, I used the solution you suggested by using a thread but I have a
problem when referencing the delegated cache:

* I register an handler for a scalar with:

    netsnmp_register_scalar(
        netsnmp_create_handler_registration("data", data_handler,
                               data_oid, OID_LENGTH(data_oid),
                               HANDLER_CAN_RWRITE)
    );

* Then in data_handler I crete a delegated cache and spawn the thread:

    requests->delegated = ~0;


    cache = netsnmp_create_delegated_cache(handler, reginfo, reqinfo, requests,
    if (cache == NULL)
       goto create_cache;

    ret = pthread_create(&tid, NULL, data_delayed_handler, cache);
    if (ret < 0)
       goto create_thread;
    pthread_detach(tid);

* When I check the delegated cache in data_delayed_handler I got NULL!

    cache = (netsnmp_delegated_cache *) data;

    cache = netsnmp_handler_check_cache(cache);
    if (cache == NULL) {
       snmp_log(LOG_ERR, "illegal call to return delayed response for \"data\"\n");
       return;
    }

Where I do wrong?

Thanks in advance,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    [EMAIL PROTECTED]
Linux Device Driver                             [EMAIL PROTECTED]
Embedded Systems                     home page: giometti.enneenne.com
UNIX programming                     phone:     +39 349 2432127


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to