Extending spin lock concept to a table column

"andre robalo" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Good morning!

I have one question regarding the spin lock concept.
In all examples i saw, the use of a spin lock object is only by scalar
objects.
I have a situation where I need to use this concept, but applied to a table.
In this situation, i would have a table column that is a spinlock
(testAndIncr object).

My first question is : Is this possible ?

I tried to implement this approach, but I'm having some problems with it. As
i said, i dont know if this is possible, so i may be trying  to implement a
thing that isnt supported .
Am I doing anything wrong in my code? Thank you for your help.

switch (reqinfo->mode)
    {
        case MODE_SET_RESERVE1:

                for (request=requests; request; request=request->next)
                {
                    if (requests->processed != 0) continue;

                        table_info = netsnmp_extract_table_info(request);

                        switch (table_info->colnum)
                        {
                                case COLUMN_SPINLOCK:

                                        /*if (!cache_entry)
                                        {

netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOCREATION);
                                                return SNMP_ERR_NOCREATION;
                                        }*/
                                        if ( request->requestvb->type !=
ASN_INTEGER ) {

netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
                                                return SNMP_ERR_WRONGTYPE;
                                        }

                                        rowData =
netsnmp_extract_table_row_data(request);
                                        data =
netsnmp_table_data_set_find_column(rowData,COLUMN_SPINLOCK);
                                        if(data != NULL)
                                                setspinLock  = *((int *)
data->data.voidp);
                                        else
                                                setspinLock = 0;


                                        if (*request->requestvb->val.integer
!= setspinLock)
                                        {

netsnmp_set_request_error(reqinfo, requests,SNMP_ERR_WRONGVALUE);
                                        }
                        }
                }
                break;



switch (reqinfo->mode)
    {
        case MODE_SET_RESERVE1:

                for (request=requests; request; request=request->next)
                {
                    if (requests->processed != 0) continue;

                        table_info = netsnmp_extract_table_info(request);

                        switch (table_info->colnum)
                        {
                                case COLUMN_SPINLOCK:

                                        if ( request->requestvb->type !=
ASN_INTEGER ) {

netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
                                                return SNMP_ERR_WRONGTYPE;
                                        }

                                        rowData =
netsnmp_extract_table_row_data(request);
                                        data =
netsnmp_table_data_set_find_column(rowData,COLUMN_SPINLOCK);
                                        if(data != NULL)
                                                setspinLock  = *((int *)
data->data.voidp);
                                        else
                                                setspinLock = 0;


                                        if (*request->requestvb->val.integer
!= setspinLock)
                                        {

netsnmp_set_request_error(reqinfo, requests,SNMP_ERR_WRONGVALUE);
                                        }
                        }
                }
                break;

        case MODE_SET_ACTION:

                for (request=requests; request; request=request->next)
                {
                        if (requests->processed != 0) continue;
                        table_info = netsnmp_extract_table_info(request);

                        switch (table_info->colnum)
                        {
                                case COLUMN_SPINLOCK:

                                        rowData =
netsnmp_extract_table_row_data(request);
                                        data =
netsnmp_table_data_set_find_column(rowData,COLUMN_SPINLOCK);
                                        if(data != NULL)
                                                data->data.voidp ++;
                                        else
                                                data->data.voidp = 0;
                                        break;
                        }
                }
                break;
    }


Robalo !!!

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.