[AGENT++] RE: MibTable with IpAddress index

Frank Fock fock at agentpp.com
Mon May 26 23:21:33 CEST 2008


Hi Alex,

min and max have to be 4 when using
sNMP_SYNTAX_IPADDR.

Regards,
Frank

Alex Agranov wrote:
> OK - I think I solved my problems.
> The corrected code looks as follows:
> 
> const index_info indIpTable[1] = {
>       { sNMP_SYNTAX_IPADDR, FALSE, 1, 4 } };
> 
> snIpTable::snIpTable():
>     MibTable("1.3.6.1.2.1.4.20.1", indIpTable, 1)
> {
>     add_col(new MibLeaf("1", READONLY, new IpAddress("0.0.0.0")));          // ipAdEntAddr
>     add_col(new MibLeaf("2", READONLY, new SnmpInt32(0)));                  // ipAdEntIfIndex
>     add_col(new MibLeaf("3", READONLY, new IpAddress("255.255.255.255")));  // ipAdEntNetMask
>     add_col(new MibLeaf("4", READONLY, new SnmpInt32(1)));                  // ipAdEntBcastAddr
>     add_col(new MibLeaf("5", READONLY, new SnmpInt32(0xFFFF)));             // ipAdEntReasmMaxSize
> }
> 
> void snIpTable::Update()
> {
>     mib->lock_mib();
>     start_synch();
> 
>     clear();
> 
>     mib->unlock_mib();
> 
>     Oidx Index;
>     Index += IpAddress(IP);
> 
>     MibTableRow * row = add_row(index);
>     if (row != NULL)
>     {
>          row->get_nth(0)->replace_value(new IpAddress("10.1.1.1"));
>          row->get_nth(1)->replace_value(new SnmpInt32 (1));
>          row->get_nth(2)->replace_value(new IpAddress("255.255.0.0"));
>          row->get_nth(3)->replace_value(new SnmpInt32(1));
>          row->get_nth(4)->replace_value(new SnmpInt32(0xFFFF));
>     }
> 
>     end_synch();
> }
> 
> I'm still not 100% sure about the min/max values in my table index - but at least the basic GET/GET-NEXT operations now work OK.
> 
> Sorry for disturbing you.
> Best regards,
>      Alex
> 
> ________________________________
> This email and any files transmitted with it are confidential material. They are intended solely for the use of the designated individual or entity to whom they are addressed. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful.
> 
> If you have received this email in error please immediately notify the sender and delete or destroy any copy of this message
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com



More information about the AGENTPP mailing list