--===============1318271697==
Content-Type: multipart/alternative; boundary="0-128320997-1210152893=:20609"

--0-128320997-1210152893=:20609
Content-Type: text/plain; charset=us-ascii

Hi guys,

I'm trying to write a C++ application using net-snmp library. it works well with snmp version 2, but with version 3, visual studio linker reports errors.

TclSNMP error LNK2001: unresolved external symbol _usmDESPrivProtocol
TclSNMP error LNK2001: unresolved external symbol _usmHMACMD5AuthProtocol

I installed an net-snmp binary version and used netsnmp.lib found in the installation's lib directory. I also installed win32OpenSSL and tried its lib files, but it didn't work.

Anyone can help me out? Thanks a lot!


netsnmp_session* GetSnmpSession(char* address) {

map ::iterator it = snmpSessionMap.find(address);
if (it != snmpSessionMap.end()){
return it->second;
}

netsnmp_session session, *ss;

snmp_sess_init( &session );
session.peername = address;

/*
session.version = SNMP_VERSION_2c;
char* communityName = "private";

session.community = (u_char *)communityName;
session.community_len = strlen(communityName);
*/

session.version = SNMP_VERSION_3;
session.securityLevel = SNMP_SEC_LEVEL_AUTHPRIV;
session.securityName = "regTester";
session.securityNameLen = strlen(session.securityName);
session.securityAuthProto = usmHMACMD5AuthProtocol;
session.securityAuthProtoLen = sizeof(usmHMACMD5AuthProtocol)/sizeof(oid);
session.securityPrivProto = usmDESPrivProtocol;
session.securityPrivProtoLen = sizeof(usmDESPrivProtocol)/sizeof(oid);
// session.securityAuthKey = (u_char*)"regAuthPasswd";
session.securityAuthKeyLen = USM_AUTH_KU_LEN;
//session.securityPrivKey = (u_char*)"regPrivPasswd";
//session.securityPrivKeyLen = strlen(session.securityPrivKey);

generate_Ku(session.securityAuthProto,
session.securityAuthProtoLen,
(u_char *) "regAuthPasswd", strlen("regAuthPasswd"),
session.securityAuthKey,
&session.securityAuthKeyLen);

ss = snmp_open(&session); /* establish the session */

if(ss) {
snmpSessionMap.insert(SessionPair(address, ss));
}

return ss;
}



__________________________________________________ __________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i...Dypao8Wcj9tAcJ
--0-128320997-1210152893=:20609
Content-Type: text/html; charset=us-ascii

Hi guys,

I'm trying to write a C++ application using net-snmp library. it works well with snmp version 2, but with version 3, visual studio linker reports errors.

TclSNMP error LNK2001: unresolved external symbol _usmDESPrivProtocol
TclSNMP error LNK2001: unresolved external symbol _usmHMACMD5AuthProtocol

I installed an net-snmp binary version and used netsnmp.lib found in the installation's lib directory. I also installed win32OpenSSL and tried its lib files, but it didn't work.

Anyone can help me out? Thanks a lot!


netsnmp_session* GetSnmpSession(char* address) {

    map <char*, netsnmp_session*> ::iterator it = snmpSessionMap.find(address);
    if (it != snmpSessionMap.end()){
   
    return it->second;
    }

    netsnmp_session session, *ss;

    snmp_sess_init( &session );
    session.peername = address;

/*
    session.version = SNMP_VERSION_2c;
    char* communityName = "private";

    session.community = (u_char *)communityName;
    session.community_len = strlen(communityName);
*/

    session.version = SNMP_VERSION_3;
    session.securityLevel = SNMP_SEC_LEVEL_AUTHPRIV;
    session.securityName = "regTester";
    session.securityNameLen = strlen(session.securityName);
    session.securityAuthProto = usmHMACMD5AuthProtocol;
    session.securityAuthProtoLen = sizeof(usmHMACMD5AuthProtocol)/sizeof(oid);
   
session.securityPrivProto = usmDESPrivProtocol;
    session.securityPrivProtoLen = sizeof(usmDESPrivProtocol)/sizeof(oid);
//    session.securityAuthKey = (u_char*)"regAuthPasswd";
    session.securityAuthKeyLen = USM_AUTH_KU_LEN;
    //session.securityPrivKey = (u_char*)"regPrivPasswd";
    //session.securityPrivKeyLen = strlen(session.securityPrivKey);

    generate_Ku(session.securityAuthProto,
                       session.securityAuthProtoLen,
                       (u_char *) "regAuthPasswd", strlen("regAuthPasswd"),
                      
session.securityAuthKey,
                       &session.securityAuthKeyLen);

    ss = snmp_open(&session);                     /* establish the session */

    if(ss) {
        snmpSessionMap.insert(SessionPair(address, ss));
    }

    return ss;
}






Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. http://mobile.yahoo.com/;_ylt=Ahu06i...Dypao8Wcj9tAcJ "> Try it now.
--0-128320997-1210152893=:20609--


--===============1318271697==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757...un.com/javaone
--===============1318271697==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders

--===============1318271697==--