Programming Issues with Win SNMP

  • Thread starter Thread starter Subodh Kumar
  • Start date Start date
S

Subodh Kumar

Hi,
Looking at the WinSNMP (v2.0) Manual Pages (for VC++) i
found the support for an API "SnmpSetPort(...)". But when
i try to use this API in my application to configure the
remote/self port i get an error
"Ordinal Not Found - The ordinal 310 could not be located
in the dynamic link library WSNMP32.dll".
just removing the "SnmpSetPort(..)" allows me to work
ahead.

pls refer to my API below. Suggest me any correction if
required.

--------------------------------------------------------
void APIENTRY InitiliseSNMP(HINSTANCE hInstance, HWND hWnd)
{
smiOID sfnEnterprise;
UINT Result;
CHAR TempStr[MAX_IP_SIZE] = {0};

unsigned long sfnEnterpriseTemp
[SFN_ENTERPRISE_OID_LENGTH] =
{SFN_ENTERPRISE_NOTIFICATION_OID};

g_u32TrapReqDeviceCount = 0;
/*SNMP Start-up*/
Result = SnmpStartup((smiLPUINT32)&gnMajorVersion, \

(smiLPUINT32)&gnMinorVersion, \

(smiLPUINT32)&gnLevel, \

(smiLPUINT32)&gnTranslateMode, \

(smiLPUINT32)&gnRetransmitMode );



// SnmpSetRetransmitMode(SNMPAPI_ON);
//SnmpSetTranslateMode(SNMPAPI_UNTRANSLATED_V2);
SnmpSetTranslateMode(SNMPAPI_TRANSLATED);

ghSession = SnmpCreateSession(hWnd, 0, \

ProcessTrapMessage,NULL);

Result = SnmpGetLastError(ghSession);

if (Result != SNMPAPI_SUCCESS )
{
MessageBox(0,"WinSNMP Application Session
Creation Failure\n Press Ok Exit","Waiting",0);
PostQuitMessage (0);
return;
}

sfnEnterprise.len = SFN_ENTERPRISE_OID_LENGTH;
sfnEnterprise.ptr = sfnEnterpriseTemp;

if(memcmp(SRC_AGENT_IP, TempStr, MAX_IP_SIZE))
{
hSrcSNMPManager = SnmpStrToEntity
(ghSession, SRC_AGENT_IP);
SnmpSetPort(hSrcSNMPManager, 512);
//if(SNMPAPI_SUCCESS != SnmpRegister
(ghSession, hSrcSNMPManager,NULL,NULL,
&sfnEnterprise,SNMPAPI_ON))
if(SNMPAPI_SUCCESS != SnmpRegister
(ghSession, hSrcSNMPManager,NULL,NULL, NULL,SNMPAPI_ON))
{
MessageBox(0,"WinSNMP Application
Session Creation Failure\n Press Ok Exit","Waiting",0);
PostQuitMessage (0);
return;
}
}
else
{
//if(SNMPAPI_SUCCESS != SnmpRegister
(ghSession, NULL,NULL,NULL, &sfnEnterprise,SNMPAPI_ON))
if(SNMPAPI_SUCCESS != SnmpRegister
(ghSession, NULL,NULL,NULL, NULL,SNMPAPI_ON))
{
MessageBox(0,"WinSNMP Application
Session Creation Failure\n Press Ok Exit","Waiting",0);
PostQuitMessage (0);
return;
}
}

hDstSNMPManager = SnmpStrToEntity(ghSession,
DST_MANAGER_IP);
SnmpSetPort(hDstSNMPManager, 10000);

return;
}

--------------------------------------------------------

Your response will be of great help to me.

Thanx
Subodh
 
Back
Top