RE: State Information in smnpset: where to keep it?

Kent Borg <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <6CEAA0C881472E40B396AD0AFA90343343E6716A@SUNAMSEXM01.AMERICAS.ROOT.PRI>
> One way to implement this is to have a structure that has backup values stored,
> such that you have the object you want to read and write, OID, and an
> placeholder old_OID.
>
> You can then iterate over the request varbinds, storing any old values until such
> time as you commit them, or undo the set.

I don't think I understand.  I am not interating over anything now, I am just getting handle_somevariableofmine() calls and I look reqinfo->mode to see what I am supposed to do.  (I have a single template I feed to mib2c and it produces a long file of repetitious code, and I figure that is the way I am supposed to do things.)

In each handler function, when I see the MODE_SET_RESERVE1, I do my pre-flighting to make sure the details make sense, then when I get the MODE_SET_COMMIT I actually store the data.  I was thinking that intermediate results from the MODE_SET_RESERVE1 step could be reused in the MODE_SET_COMMIT.  (I could just duplicate that work in COMMIT, it has no side effects, but that seems wrong.)

Is there something I should already be iterating over or are you describing an iteration I would do to connect up RESERVE1 stuff with COMMIT stuff?

Right now I am just using statics and it seems that net-snmp does not reenter my code and mix calls from more than one snmpset, but I don't know that this is guaranteed.

I was expecting I would allocate a structure in RESERVE1 and hang it from something in reqinfo, then in later calls refer to it, and in COMMIT or FREE, deallocate it.  But I don't see where to hang it.

Thanks,

-kb

--
Kent Borg
Software Engineer
CSR Technology, Inc.
A member of the CSR Group of Companies
+1-781-791-6282
[email protected]

________________________________
From: [email protected] [[email protected]]
Sent: Tuesday, January 08, 2013 10:41
To: Kent Borg; [email protected]
Subject: RE: State Information in smnpset: where to keep it?

One way to implement this is to have a structure that has backup values stored, such that you have the object you want to read and write, OID, and an placeholder old_OID.

You can then iterate over the request varbinds, storing any old values until such time as you commit them, or undo the set.
-------- Original Message --------
Subject: State Information in smnpset: where to keep it?
From: Kent Borg <[email protected]<mailto:[email protected]>>
Date: Tue, January 08, 2013 9:07 am
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>

Hello,

I am working on an AgentX agent to run in an embedded beast, and I seem to have things working.

But I am worried about the state machine used in setting a variable. How do I save state information between MODE_SET_RESERVE1 and MODE_SET_RESERVE2, MODE_SET_COMMIT?

 - reginfo->my_reg_void seems to be per-registration not per-request.
 - my_void is mentioned in old mailing list traffic but doesn't seem to exist anymore
 - storing in static variables in my handler functions seems to work, but is it safe?

Thanks,

-kb

--
Kent Borg
Software Engineer
CSR Technology, Inc.
A member of the CSR Group of Companies
+1-781-791-6282
[email protected]<mailto:[email protected]>



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com<http://www.csr.com>. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog<http://www.csr.com/blog>
________________________________
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
________________________________
_______________________________________________
Net-snmp-users mailing list
[email protected]<mailto:[email protected]>
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users



To report this email as spam click here<https://www.mailcontrol.com/sr/qUvSekYgN9PGX2PQPOmvUs3i7gRn49HgpSTsnK8brgfdX!7D1bESyqyJEslbkALniiZzsaVbARbX0F9OzBqmnw==>.

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512

_______________________________________________
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.