On 25 August 2011 09:53, devel tech <devel.te...@gmail.com> wrote:
> i compiled [my MIB] using mib2c command  and it generated two files .c and h 
> of
> object Namesys.
>
> mib2c -c mib2c.scalar.conf Namesys


> it was okay, then i run make command and i got following errors
>
> --------------------
> test/Namesys.c: In function 'handle_Namesys':
> test/Namesys.c:43: error: expected expression before ',' token
> test/Namesys.c:63: error: expected expression before ')' token
> test/Namesys.c:76: error: expected expression before ')' token
> test/Namesys.c:83: error: expected expression before ')' token
> test/Namesys.c:91: error: expected expression before ')' token

It looks as if you haven't finished writing the code in the MIB template.
Remember that the output of mib2c is the *starting* point for
a MIB implementation.   It's not finished code.

>From the FAQ entry
    Why doesn't my new MIB module report anything?

  Remember that 'mib2c' simply generates template code for your MIB module.
  It's up to you to fill in the details, to report the actual information from
  whatever underlying subsystem is being monitored.   Mib2c cannot help with
  the semantics of the MIB module - it's purely there to provide an initial
  code framework, based on the _syntax_ of the MIB module objects.



Note that word "template".




> I tried to fix above error but i could not. below i pasted mentioned lines
> of errror.
>
> line 43 of Namesys.c is  switch(reqinfo->mode) {
>
>         case MODE_GET:
>             snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
>                                      /* XXX: a pointer to the scalar's data 
> */,
>                                      /* XXX: the length of the data in bytes 
> */);
>             break;


You have two comments there, indicating the places where you need to
provide suitable code.   You need to declare a variable that contains the
value to be reported, and this goes into the first gap.
   The size of this value  (typically using 'strlen' for a printable string,
or 'sizeof' for a fixed buffer binary string) is provided as the final
parameter.

Just as the comments tell you.



> lines no. 63..-65
>  case MODE_SET_RESERVE2:
>             /* XXX malloc "undo" storage buffer */
>             if (/* XXX if malloc, or whatever, failed: */) {
>                 netsnmp_set_request_error(reqinfo, requests,
> SNMP_ERR_RESOURCEUNAVAILABLE);
>             }

Again, this block is asking you to provide whatever code
is necessary to store a temporary copy of the new (or old) value,
so that the assignment can be reversed if necessary.


I will repeat my advice that I *strongly* suggest you spend
some time getting used to how the agent works before you
try to develop your own MIB.
   Both in terms of simply using the agent, to see how it behaves.
And also looking at the existing MIB code, to see how that works.

There are plenty of examples of scalar objects in the standard tree.
Please look at those, and try to understand how they have been
implemented.   That will stand you in good stead when you
finally come to write your own MIB code.

Dave

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
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/listinfo/net-snmp-users

Reply via email to