Hi,
 Thanks for the response. I have got few queries for the same.
My MIB object for the particular table doen't have any row status.

Following is the Tree Structure for which I am trying to delete the Row
Here the index will be a non-zero value
+--PlayerTable(1)
   |
   +--PlayerEntry(1)
      |  Index: PlayerID
      |
      +-- --- Unsigned  PlayerID(1)
      +-- --- String    PlayerName(2)
      |        Textual Convention: SnmpAdminString
      |        Size: 0..255
      +-- --- EnumVal   PlayerType(3)
      |        Textual Convention: BPlayerType
      |        Values: ip(0), dvb(1)
      +-- --- String    URLPlayed(4)
               Size: 0..255

Background of the Agent:
-------------------------------------
I have got some application running on the linux box you can
consider this as a Set Top Box( On a linux System). So I need to
monitor this box where User can play  as many channels as he want.
Some of the information is stored in the above table. Each channel
will have one player id.

One of my APPLICATION will be running and get the information about
the player.

Row Addition:
--------------
when a new channel is started then i will get the
Player ID and rest of the information. so this application will
send a set request to the sub agent what we are doing. This works
fine and a row is added.

ROW Deletion
---------------------
When user switch offs the channel then the APPLICATION can only
identify the PlayerID of the channel. So how do I handle this.

Current Approach:
---------------------------
On Identifying the channel switch off my APPLICATION will send the
set command with the PlayerID as 0 then I am trying to get the row
in the handler function and trying to delete. But this is not
deleting the row.

Is the approach that we are following is right or should we need to
apply some other approach. It will be very kind if some one can help us
solving the problem.

Some of the code is also attached for the reference.
Kindly help us solving the problem. Thanks in Advance

Regards
Ravi Kumar

CODE FOR REFERENCE
----------------------------------------
void
initialize_table_PlayerTable(void)
{
    static oid      PlayerTable_oid[] =
        { 1, 3, 6, 1, 4, 1, 11, 255, 1, 5, 1 };
    size_t          PlayerTable_oid_len =
        OID_LENGTH(PlayerTable_oid);
    netsnmp_table_data_set *table_set;

    /*
     * create the table structure itself
     */
    table_set = netsnmp_create_table_data_set("PlayerTable");

    /*
     * comment this out or delete if you don't support creation of new rows
     */
    table_set->allow_creation = 1;

    /***************************************************
     * Adding indexes
     */
    DEBUGMSGTL(("initialize_table_PlayerTable",
                "adding indexes to table PlayerTable\n"));
    netsnmp_table_set_add_indexes(table_set, ASN_UNSIGNED,0);

    DEBUGMSGTL(("initialize_table_PlayerTable",
                "adding column types to table PlayerTable\n"));
    netsnmp_table_set_multi_add_default_row(table_set,
                                            COLUMN_PLAYERID,
                                            ASN_UNSIGNED, 1, NULL, 0,
                                            COLUMN_PLAYERNAME,
                                            ASN_OCTET_STR, 1, NULL, 0,
                                            COLUMN_PLAYERTYPE,
                                            ASN_INTEGER, 1, NULL, 0,
                                            COLUMN_URLPLAYED,
                                            ASN_OCTET_STR, 1, NULL, 0);
    /*
     * registering the table with the master agent
     */
    netsnmp_register_table_data_set(netsnmp_create_handler_registration
                                    ("PlayerTable",
                                     PlayerTable_handler,
                                     PlayerTable_oid,
                                     PlayerTable_oid_len,
                                     HANDLER_CAN_RWRITE), table_set, NULL);

   ###   Here CODE IS WRITTEN TO ADD THE ROWS  #########
}

/** handles requests for the PlayerTable table, if anything else needs to be
done */
int
PlayerTable_handler(netsnmp_mib_handler *handler,
                       netsnmp_handler_registration *reginfo,
                       netsnmp_agent_request_info *reqinfo,
                       netsnmp_request_info *requests)
{
    /*
     * perform anything here that you need to do.  The requests have
     * already been processed by the master table_dataset handler, but
     * this gives you chance to act on the request in some other way
     * if need be.
     */
    netsnmp_table_row *rd;
    netsnmp_table_data_set *tableset;
    switch (reqinfo->mode) {

    case MODE_GET:

                break;
    case MODE_SET_ACTION:
        printf(" in MODE_SET_ACTION \n");

 printf(" Try getting the row value \n");
        rd = netsnmp_extract_table_row( requests );

        printf(" Try getting the dataset \n");
        tableset = netsnmp_extract_table_data_set(requests);

   case MODE_SET_UNDO:
        printf(" in MODE_SET_UNDO \n");

   case MODE_SET_COMMIT:
        printf(" in MODE_SET_COMMIT \n");
       

 ##  DELETE THE ROW ######
        netsnmp_table_dataset_remove_and_delete_row( tableset, rd );

        break;
   case MODE_SET_FREE:
        printf(" in MODE_SET_FREE \n");
        break;
   }
    return SNMP_ERR_NOERROR;
}


 

On 12/13/05, Dave Shield <[EMAIL PROTECTED]> wrote:
[Please do *not* repost the same request
several times - it just increases the
support load, and stresses out the developers
Thanks!]

On Mon, 2005-12-05 at 17:49 +0530, Ravi Kumar wrote:

> One of the table has the feature to add new rows and delete rows.
> I am making use of the data_set module in the mib2c  while genrating
> the code
> I am able to add the rows to the table. But I am facing problem in
> table for deleting the row.
> I would get the information of the row index for which the row has to
> be deleted.

That information will be in the OID of the varbind that requests
the row deletion.  If you extract the instance subidentifier(s),
then that will tell you which row should be deleted.

How are you defining the MIB object to control this?
Are you using 'RowStatus' or something else?

The dataset helper can handle RowStatus deletion automatically.
Just tell it which column is the RowStatus object.

Otherwise, you'll need to handle this yourself.

Dave

Reply via email to