Regarding MibTable::commit_set_request
Cheng Chaoting
chengchaoting____huawei.com
Tue May 13 05:58:09 CEST 2003
Frank,
Thanks for your reply.
For the second problem:
2. When the manager sets 5 columns but there are only 4 then the agent
*must* return an error!
So,who returns an error?In my application,before changing the mib table
instance in memory,first,i should extract them and insert them into
database,if successful,i will change memory,otherwise i dont't change it.So,
i think i the error should be returned before calling
MibTable::commit_set_request,is it true?
An example:
int
imap_northbound_common_hwIMAPNorthboundEventFilterMgmtConfigConditionEntry::
commit_set_request(Request* req, int ind)
{
//i think an error should be returned if the manager sets 5 columns but
there are only 4 before the next operation
//agent++ stack returns the error automatically?Is it correct?
if ( it is successful inserting into database )
return MibTable::commit_set_request(req, ind);
else
return SNMP_ERROR_COMITFAIL;
}
And,for the third problem,how can we resolve it?
Thanks again!
Best regards,
Cheng Chaoting
----- Original Message -----
From: "Frank Fock" <Frank.Fock____t-online.de>
To: "Cheng Chaoting" <chengchaoting____huawei.com>
Cc: <agentpp-dl____agentpp.com>
Sent: Monday, May 12, 2003 11:58 PM
Subject: Re: Regarding MibTable::commit_set_request
> Cheng,
>
> Your code snippet is not a solution to your problem
> and I do not think that a solution exists. I see the
> following problems:
>
> 1. What happens when a manager creates a row in your
> table and simultaneously setting another object in
> your agent?
> 2. When the manager sets 5 columns but there are only
> 4 then the agent *must* return an error!
> 3. What happens when the order of requests is not the
> one you expect?
>
> Best regards,
> Frank Fock
>
> Cheng Chaoting wrote:
> > Dear All,
> >
> > In MibTable::commit_set_request function,do we need to truncate the
> > redundant columns?Suppose,for one table,every row has 4 columns,when
> > manager wants to create one row,but it inputs 5 columns,so,i think agent
> > should truncate the last column.How can we implement it?
> >
> > I wrote the following code:
> >
> > int
> >
imap_northbound_common_hwIMAPNorthboundCommonManagerInformationEntry::commit
_set_request(Request*
> > req, int ind)
> > {
> > //--AgentGen
> > BEGIN=hwIMAPNorthboundCommonManagerInformationEntry::commit_set_request
> > //--AgentGen END
> >
> > int ivbSize = req->subrequests();
> > int iMaxVbsAllowed = ivbSize % 4;
> > iMaxVbsAllowed = ivbSize - iMaxVbsAllowed;
> > req->trim_request(iMaxVbsAllowed); //here i use trim_request to
> > truncate the redundant columns
> >
> > for(int i = ind; i < iMaxVbsAllowed; i = i + 4)
> > {
> > Oidx oidRowIndex =
> >
imap_northbound_common_hwIMAPNorthboundCommonManagerInformationEntry::instan
ce->index(req->get_oid(i));
> > int iCmd;
> > req->get_value(i).get_value(iCmd);
> >
> > if(iCmd == rowDestroy)
> > ...............
> >
> > }
> > }
> >
> > When Rowstatus is CreateAndGo,it works fine,but if Rowstatus is
> > RowDestroy,agent doesn't execute the 'for' loop,because
> > req->subrequests() is 1,so iMaxVbsAllowed is 0.
> >
> >
> > Does anybody have some solutions?
> >
> > TIA.
> >
> >
> > With regards,
> > Cheng Chaoting
>
>
>
More information about the AGENTPP
mailing list