in case of a table has not primitive types:agent/mibgroup/examples/data_set.c - SNMP

This is a discussion on in case of a table has not primitive types:agent/mibgroup/examples/data_set.c - SNMP ; Hello, all! I am playing about with data_set.c example. It shows how to work with tables by next structure: +--mytable(1) | +--Entry(1) | Index: index | +-- ---- String index(1) | Size: 1..32 +-- CR-- String name1(2) +-- CR-- String ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: in case of a table has not primitive types:agent/mibgroup/examples/data_set.c

  1. in case of a table has not primitive types:agent/mibgroup/examples/data_set.c

    Hello, all!

    I am playing about with data_set.c example. It shows how to work with
    tables by next structure:

    +--mytable(1)
    |
    +--Entry(1)
    | Index: index
    |
    +-- ---- String index(1)
    | Size: 1..32
    +-- CR-- String name1(2)
    +-- CR-- String name2(3)

    as you can see here are three fields, one index and other
    informational fields. They have primitive types, OCTET STRING. In
    order to set row in that table I should use netsnmp_set_row_column()
    fundtion, for example:

    netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "Linux", strlen("Linux"));
    where third parameter is primitive type, next value of this type and its length.

    I created more complex table:

    +--complexTable(3)
    |
    +--specialCase(1)
    | Index: i1
    |
    +-- -RW- INTEGER i1(1)
    |
    +--struct(2)
    | Index: i2
    |
    +-- -RW- INTEGER i2(1)
    +-- -RW- String field1(2)
    +-- -RW- String field1(3)

    Below table includes other table... my question is what interface
    should I use to work with aggregate types, not with primitive type.

    Thanks in advance.

    --
    /BR, Alexander

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-users mailing list
    Net-snmp-users@lists.sourceforge.net
    Please see the following page to unsubscribe or change other options:
    https://lists.sourceforge.net/lists/...net-snmp-users


  2. RE: in case of a table has not primitive


    > From: net-snmp-users-bounces@lists.sourceforge.net
    > [mailto:net-snmp-users-bounces@lists.sourceforge.net] On
    > Behalf Of Alexander Bubnov
    > Sent: Wednesday, July 23, 2008 4:56 AM


    > I created more complex table:
    >
    > +--complexTable(3)
    > |
    > +--specialCase(1)
    > | Index: i1
    > |
    > +-- -RW- INTEGER i1(1)
    > |
    > +--struct(2)
    > | Index: i2
    > |
    > +-- -RW- INTEGER i2(1)
    > +-- -RW- String field1(2)
    > +-- -RW- String field1(3)
    >
    > Below table includes other table... my question is what interface
    > should I use to work with aggregate types, not with primitive type.


    You cannot do this. Specifically, the SMI rules forbid putting anything but a primitive type in a table. However, you can have multiple indices:

    +--notComplexTable(3)
    |
    +--Entry(1)
    | Index: i1, i2
    |
    +--struct(2)
    |
    +-- -NA- INTEGER i1(1)
    +-- -NA- INTEGER i2(1)
    +-- -RW- String field1(2)
    +-- -RW- String field1(3)

    Note that the access of the index is not-accessible, since it is returned as part of the OID anyway.

    It may be helpful to note that MIBs should not be constructed as if they were data structures, but rather as if they were database tables. It is still possible to represent arbitrary data models, but the techniques one uses are different.


    HTH,

    Mike

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-users mailing list
    Net-snmp-users@lists.sourceforge.net
    Please see the following page to unsubscribe or change other options:
    https://lists.sourceforge.net/lists/...net-snmp-users


  3. Re: in case of a table has not primitive

    Hi!
    Thanks a lot, Mike!


    2008/7/24 Mike Ayers :
    >
    >> From: net-snmp-users-bounces@lists.sourceforge.net
    >> [mailto:net-snmp-users-bounces@lists.sourceforge.net] On
    >> Behalf Of Alexander Bubnov
    >> Sent: Wednesday, July 23, 2008 4:56 AM

    >
    >> I created more complex table:
    >>
    >> +--complexTable(3)
    >> |
    >> +--specialCase(1)
    >> | Index: i1
    >> |
    >> +-- -RW- INTEGER i1(1)
    >> |
    >> +--struct(2)
    >> | Index: i2
    >> |
    >> +-- -RW- INTEGER i2(1)
    >> +-- -RW- String field1(2)
    >> +-- -RW- String field1(3)
    >>
    >> Below table includes other table... my question is what interface
    >> should I use to work with aggregate types, not with primitive type.

    >
    > You cannot do this. Specifically, the SMI rules forbid putting anything but a primitive type in a table. However, you can have multiple indices:
    >
    > +--notComplexTable(3)
    > |
    > +--Entry(1)
    > | Index: i1, i2
    > |
    > +--struct(2)
    > |
    > +-- -NA- INTEGER i1(1)
    > +-- -NA- INTEGER i2(1)
    > +-- -RW- String field1(2)
    > +-- -RW- String field1(3)
    >
    > Note that the access of the index is not-accessible, since it is returned as part of the OID anyway.
    >
    > It may be helpful to note that MIBs should not be constructed as if they were data structures, but rather as if they were database tables. It is still possible to represent arbitrary data models, but the techniques one uses are different.
    >
    >
    > HTH,
    >
    > Mike
    >




    --
    /BR, Alexander

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-users mailing list
    Net-snmp-users@lists.sourceforge.net
    Please see the following page to unsubscribe or change other options:
    https://lists.sourceforge.net/lists/...net-snmp-users


+ Reply to Thread