On Thu, 2005-05-26 at 23:15, Vance Shipley wrote:
> In the examples for the table_data helper UNDO is accomplished
> by having old and new entries in the row data structure:
Mostly because that was a fairly simple way to implement
UNDO handling, and fitted in neatly with the documentation
I've been writing - extending parallel "current" and "old"
scalar variables to a table structure.
The 'array_user' helper (?and MfD?) use a different approach,
of copying the whole row data structure into a second "safety"
copy, before starting to update the original. The UNDO
pass simply involves copying the contents of this safety
copy back into the original structure.
I'm not sure how easily that would fit into the table_data
helper processing, but you could easily add an extra field
to the per-row data structure to point to such a safety copy:
>
> struct foo_entry {
> ...
> long foo;
> long bar;
> ...
+ struct foo_entry *old;
> };
This would normally be NULL, but could be created (probably
during the RESERVE2 pass) by the first varbind processed in
each row.
But as you've realised - the row->data is an arbitrary pointer,
and you are free to interpret it as you wish.
The main things to bear in mind are that a single SET request
may well refer to more than one row of the table (so any UNDO
handling must cope with multiple rows at once), as well as
several columns from each row (so the second and subsequent
varbind processing shouldn't lose the original value of the
first varbind).
In fact, it could even contain two (different) assignments
to the *same* instance - if the second of these fails, the
agent must revert to the *original* value - not that of
the first assignment.
Dave
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders