[AGENT++] Notification OID Error
BalaSubrahmanyam Gattu
bgattu at sta.samsung.com
Sat Sep 13 02:14:39 CEST 2003
Hi,
I am trying to make a simple notification agent.
I am getting invalid OID's for the variables at the manager. At agent if
I print all the trap VBs all the OID's are printing properly. If I use
hardcoded OID values like "1.2.3" they are reaching manager properly.
Can you kindly advise me in this regard.
I get data as unsigned char *payload and variables information in tVar
structure. I am preparing the variable binds like following:
Oid notifOid("1.2.3.4.0.5");
Vbx *vb;
vb = new Vbx[tInfo.numOfFields]; //Assign memory to variable binds
//In loop prepare notification variable bind information
for(int fCount=0; fCount < tInfo->numOfFields; fCount++)
{
//Set the OID for each of the variable
Oid *vOidPtr = new Oid(tInfo->tVar[fCount].vOid);
vb[fCount].set_oid(*vOidPtr);
bufPtr = payload+tInfo->tVar[fCount].memStartPos;
//Set the Value for each of the variable
switch(tInfo->tVar[fCount].type)
{
case ASN_INTEGER: //(0x02) or Integer32
{
long lVal;
memcpy(&lVal, bufPtr, sizeof(long));
SnmpInt32 *int32Ptr = new SnmpInt32(lVal);
vb[fCount].set_value(*int32Ptr);
}
break;
case ASN_OCTET_STR: //(0x04)
{
OctetStr *octetPtr = new OctetStr((unsigned char *)bufPtr,
(unsigned long) tInfo->tVar[fCount].dimension);
vb[fCount].set_value(*octetPtr);
}
break;
case ASN_OBJECT_ID: //(0x06)
{
Oid *oidPtr = new Oid((const char *)bufPtr);
vb[fCount].set_value(*oidPtr);
}
break;
//Send the notification
_notifOriginator.generate(vb, tInfo.numOfFields, notifOid, "", "");
//Delete memory
delete[] vb;
Thanks in advance.
With Best Regards,
Bala
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.agentpp.org/pipermail/agentpp/attachments/20030912/de1145c3/attachment.htm
More information about the AGENTPP
mailing list