Bonjour,
Je suis actuellement en stage et je dois créer une extension d'agent SNMP. J'ai donc suivi le tutoriel du msdn sur ce sujet que voici:
https://msdn.microsoft.com/en-us/library/ms927008.aspx
Je me suis également servis du lien suivant pour créer mon propre header correspondant dans le tutoriel à "testmib.h":
https://msdn.microsoft.com/en-us/library/ms894548.aspx
Travaillant avec VisualStudio2012 j'ai rencontré quelques erreurs que j'ai vite corrigées (4 erreurs dont 3 étaient des lnk2019 que j'ai corrigées en ajoutant la lib snmpAPI.lib et une lnk2001 que j'ai fixée).
En revanche, il me reste une erreur m’empêchant de générer ma solution que voici:
Erreur 1 error LNK2019: symbole externe non résolu "unsigned int __cdecl ResolveVarBind(struct SnmpVarBind *,unsigned int)" (?ResolveVarBind@@YAIPAUSnmpVarBind@@I@Z) référencé dans la fonction _SnmpExtensionQuery@16"
J'ai beau avoir cherché dans des dizaines de forums et des dizaines de sujets que ça soit en Anglais ou en Français, je ne trouve pas la solution à cette erreur.
Pour vous aider voici le code qui plante (*.cpp):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| BOOL WINAPI SnmpExtensionQuery (
IN BYTE requestType,
IN OUT RFC1157VarBindList *variableBindings ,
OUT AsnInteger *errorStatus,
OUT AsnInteger *errorIndex)
{
UINT I;
static unsigned long requestCount = 0;// Supports the trap simulation
// Iterate through the list of variable bindings to resolve individual
// variable bindings.
for (I=0; I < variableBindings->len; I++)
{
*errorStatus = ResolveVarBind (&variableBindings->list[I],
requestType);
// Test and handle the case where Get Next past end of the MIB view that
// is supported by this Extension Agent occurs. Special processing is
// required to communicate this situation to the Extendible Agent,
// so that it can take the appropriate action, possibly querying other
// Extension Agents.
if (*errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME &&
requestType == MIB_ACTION_GETNEXT)
{
*errorStatus = SNMP_ERRORSTATUS_NOERROR;
// Modify variable binding of such variables so the OID points
// just outside the MIB view that is supported by this Extension Agent.
// The Extendible Agent tests for this and takes appropriate
// action.
SnmpUtilOidFree (&variableBindings->list[I].name);
SnmpUtilOidCpy (&variableBindings->list[I].name, &MIB_OidPrefix);
variableBindings->list[I].name.ids[MIB_PREFIX_LEN-1] ++;
}
// If an error was indicated, communicate error status and error
// index to the Extendible Agent. The Extendible Agent will ensure
// that the original variable bindings are returned in the response
// packet.
if (*errorStatus != SNMP_ERRORSTATUS_NOERROR)
{
*errorIndex = I + 1;
goto Exit;
}
} |
si je commente les lignes suivante, je peux générer ma solution sans soucis:
1 2
| *errorStatus = ResolveVarBind (&variableBindings->list[I],
requestType); |
Ça n'est bien évidemment pas la réponse à mon problème mais peut être que ça vous mettra la puce à l'oreille...
et pour la déclarations des fonctions voici un extrait de mon header:
1 2 3 4 5
| // Function Prototypes.
UINT ResolveVarBind (
IN OUT RFC1157VarBind *VarBind, // Variable Binding to resolve
IN UINT PduAction // Action that is specified in PDU
); |
Merci de bien vouloir m'apporter de l'aide,
Cordialement,
MattGran
Partager