[AGENT++] Read-only rows in MibTable
Alex Agranov
alex.agranov at gmail.com
Sun Oct 11 11:35:14 CEST 2009
I think that I found a simple solution to my problem.
Adding the following implementation of prepare_set_request() method to
StorageTable class solves the issue. Note that the below code does two
things:
1) blocks SET on any column for read-only storage type
2) blocks row deletion for permanent storage type
int StorageTable::prepare_set_request(Request* req, int& ind)
{
if (storage_type)
{
Oidx idx = index(req->get_oid(ind));
MibTableRow* row = find_index(idx);
if (row) {
StorageType * s = (StorageType *)row->get_nth(storage_type);
if ((s) && (s->valid())) {
if (s->get_state() == 5)
return SNMP_ERROR_NOT_WRITEABLE;
if (s->get_state() == 4)
{
if ((row_status) &&
(get_generator(req->get_oid(ind)) == row_status)) {
Vbx vb(req->get_value(ind));
int l;
if (vb.get_value(l) != SNMP_CLASS_SUCCESS)
return SNMP_ERROR_WRONG_VALUE;
if ((l == rowDestroy) && (s->get_state() == 4))
return SNMP_ERROR_INCONSIST_VAL;
}
}
}
}
}
return MibTable::prepare_set_request(req, ind);
}
Regards,
Alex
On Sat, Oct 10, 2009 at 2:58 PM, Alex Agranov <alex.agranov at gmail.com>wrote:
> Hi,
>
> I wonder whether the fact that AGENT++ v3.5.29 allows SNMP manager to
> delete and modify MibTable entries that have StorageType=5(read-only) is a
> bug or a feature? I guess this can be worked-around by creating a voter at
> "application layer", however I wonder why this is not a default behavior?
>
> Thanks in advance,
> Alex
>
More information about the AGENTPP
mailing list