Hi,

I need some help with net-snmp tables handler.

The problem is that I need one single handler function to process SET and GET 
commands for several tables of my MIB. 

This handler needs to consult an external module to reply to GET, and needs to 
pass SET data to an external module for storage. This means that I cannot 
create a dataset because the data will be stored externally.

Without a dataset, how can I have one single handler function to process SET 
and GET commands for several tables in a MIB.

In the case of scalar values, I used the following from your examples:

[CODE 
START]-------------------------------------------------------------------------------------------------------------

struct variable2 example_variables[] = {
    { EXAMPLESTRING,    ASN_OCTET_STR, RONLY, var_example, 1, {1}},
    { EXAMPLEINTEGER,   ASN_INTEGER,   RWRITE, var_example, 2, {2,1}},
    ...
};

oid example_variables_oid[] = { 1,3,6,1,4,1,2021,254 };

void init_example(void)
{
  REGISTER_MIB("example", example_variables, variable2, example_variables_oid);
  ...
}

u_char    *
var_example(struct variable *vp,
        oid *name,
        size_t *length,
        int exact,
        size_t *var_len,
        WriteMethod **write_method)
{
  if (header_generic(vp, name, length, exact, var_len, write_method) == 
MATCH_FAILED)
    return NULL;

  switch (vp->magic){
    case EXAMPLESTRING:
      ...
      return (u_char *) string;

    case EXAMPLEINTEGER:
      ...
      return (u_char *) &long_ret;
  }
}

[CODE 
END]---------------------------------------------------------------------------------------------------------------

Can I use similar approach to tables? In this case how can I manage the row 
indexes and how can I declare the table in the array?

Do you have any example of a problem like this that I can use to guide my 
development?


Thank you in advance,

Baltazar François

[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to