RE: Index in Table .... request for explanation

"M. Zeeshan - IMS" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Thanx for the help Dear Mike:

well let me bother you with some scenario, lolx.....

I have added the initial values as follows:

----------------------------------------------------------------------------------
row = netsnmp_create_table_data_row();
    netsnmp_table_row_add_index(row, ASN_OCTET_STR, "sh-client",
                                strlen("sh-client"));
    
    netsnmp_set_row_column(row, 1, ASN_OCTET_STR, "sh-client",
                           strlen("sh-client"));
    netsnmp_mark_row_column_writable(row, 1, 1);        /* make writable */
    
    netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "Initiator",
                           strlen("Initiator"));
    netsnmp_mark_row_column_writable(row, 2, 1);        /* make writable */

    netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "127.0.0.1",
                           strlen("127.0.0.1"));
    netsnmp_mark_row_column_writable(row, 3, 1);        /* make writable */

    long peer_port=3868;
    netsnmp_set_row_column(row, 4, ASN_INTEGER, (u_char *) & peer_port,
                           sizeof(peer_port));
    netsnmp_mark_row_column_writable(row, 3, 1);        /* make writable */
----------------------------------------------------------------------------------





and then used snmpwalk as follows with results:

---------------------------------------------------------------------------------
snmpwalk -v 3 -u wes -n "" -l authNoPriv -a MD5 -A passphras localhost peerTable

CM-HSS-IMS-MIB::peerIdentity."sh-client" = STRING: "sh-client"
CM-HSS-IMS-MIB::peerRole."sh-client" = STRING: "Initiator"
CM-HSS-IMS-MIB::peerIPAddress."sh-client" = STRING: "127.0.0.1"
CM-HSS-IMS-MIB::peerPort."sh-client" = INTEGER: 3868
---------------------------------------------------------------------------------


I am still uncomfortable with such way of indexing,

Quries:

1. Do we have to use such index like "sh-client" for each row entry in the table.
2. we do this with the help of netsnmp_table_row_add_index(), how this has to be done if we enter data into the table through an automated utility or sort of software remotly, then will the index for each row is necessary.. how will it be used fot getting the data as well.
3. when i generated code using mib2c with "mib2c.create-dataset.conf" file, then the indexing was done with the function "netsnmp_table_set_add_indexes()", while the example in data_set.c uses the function "netsnmp_table_row_add_index()" a bit earlier in the code, whats the difference between these two functions.

Thanking in advance.

Regards,

- Muhammad Zeeshan


--- On Wed, 28/1/09, Mike Ayers <[email protected]> wrote:
From: Mike Ayers <[email protected]>
Subject: RE: Index in Table .... request for explanation
To: "m.zeeshan" <[email protected]>
Cc: [email protected]
Date: Wednesday, 28 January, 2009, 11:33 PM

> From: m.zeeshan [mailto:[email protected]] 
> Sent: Wednesday, January 28, 2009 3:20 AM

> peerTable OBJECT-TYPE
>     SYNTAX      SEQUENCE OF PeerTableEntry
>     MAX-ACCESS  not-accessible
>     STATUS      current
>     DESCRIPTION
> 	"This table merely contains a set of data which is otherwise."
>     ::= { tableHSS 1 }
> 
> peerTableEntry OBJECT-TYPE
>     SYNTAX      PeerTableEntry
>     MAX-ACCESS  not-accessible
>     STATUS      current
>     DESCRIPTION
> 	"A row describing a given working group"
>     INDEX   { peerIdentity }
>     ::= {peerTable 1 }
> 
> PeerTableEntry ::= SEQUENCE {
> 	peerIdentity	OCTET STRING,
> 	peerRole	OCTET STRING,
> 	peerIPAddress	OCTET STRING,
>     	peerPort	Integer32
> }
> 
> 
> peerIdentity OBJECT-TYPE
>     SYNTAX      OCTET STRING (SIZE(1..32))
>     MAX-ACCESS  read-write
>     STATUS      current
>     DESCRIPTION
> 	"The name of the IETF Working Group this table describes."
>     ::= { peerTableEntry 1 }
> 
> peerRole OBJECT-TYPE
>     SYNTAX      OCTET STRING
>     MAX-ACCESS  read-write
>     STATUS      current
>     DESCRIPTION
> 	"One of the names of the chairs for the IETF working group."
>     ::= { peerTableEntry 2 }
> 
> peerIPAddress OBJECT-TYPE
>     SYNTAX      OCTET STRING
>     MAX-ACCESS  read-write
>     STATUS      current
>     DESCRIPTION
> 	"The other name, if one exists, of the chairs for the IETF
> 	working group."
>     ::= { peerTableEntry 3 }
> 
> 
> peerPort OBJECT-TYPE
>     SYNTAX      Integer32
>     MAX-ACCESS  read-write
>     STATUS      current
>     DESCRIPTION
> 	"The mode number for the current operation being performed."
>     ::= { peerTableEntry 4 }

> 2. the thing i m surely missing is the neat understanding of Indexed
> and/or the purpose of like "snmpv3" tag at the end of each
> nsTransactionTable entry ........ like following...
> 
> CM-HSS-IMS-MIB::peerRole."snmpv3" = STRING:
"sh-client"
> 
> why we need this last tag ...... of ....  ."snmpv3"

	A table is a collection of rows of data.  In order to distinguish individual
pieces of data, we need two things:  the object in the row, and the row in the
table.  We distinguish the object in the row by its position in the SEQUENCE -
1, 2, etc., symbolically referred to by the names given - peerIdentity,
peerRole, etc.  The determination of which row is done explicitly, by having an
index, which is part of each objects name.  You have defined an OCTET STRING
index, so that is what must be used.  So in your example:

> CM-HSS-IMS-MIB::peerRole."snmpv3" = STRING:
"sh-client"

	we see that the second object in the row indexed as "snmpv3" in the
peerTable of the CM-HSS-IMS-MIB has the value of "sh-client".  There
could also be rows for "aaa", "EoS" (giggle),
"SMiNG" (chortle), and "snmpconf" (ROFLMAO!)....oops, sorry
- my postjudices are showing.

	MIB objects do not exist unless they have data, so it is basically impossible
to distinguish between an unimplemented table, a table with no rows, and a table
one is not permitted to view.  This is by design.  If you want to see the table
when it comes up, add a row during startup.


	HTH,

Mike

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
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




      Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

_______________________________________________
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.