Re: How to seperate snmpget &snmpset?

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
2011/5/15 王文桢 <[email protected]>:
> u_char         *var_sgcc (struct variable *vp,
>                                        oid * name,
>                                        size_t * length,
>                        int exact, size_t * var_len, WriteMethod ** write_method)

OK - so you are using the old v4 UCD coding,
rather than the newer v5 handler-based approach


>    When I snmpget & snmpset  the value of PPCIP,
> how can I know whether  it's  get or set  in the program?

You can't.
The way that the UCD code works is to process the
request as a GET first (which has the side-effect of
settings the 'write_method' parameter.
    It then calls this write_method (several times)
to handle the SET processing.   See the file  AGENT.txt
for a description of how this works.


>    When I set the value of PPCIP,I want to  run  write_ppcipstr() first,
> and then return the value of  ret_func(),

That's not how the agent works.
It calls the var_xxx routine *before* processing the SET request,
and will then automatically return the correct value - i.e. the value
that was included in the SET request.  You don't have to worry
about doing this yourself - it's handled by the agent framework.


>  What should I do ?

Work with the agent - not against it :-)

Dave

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
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.