| 12
 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
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 
 |  
 
#include <QtCore/QCoreApplication>
 
#define SYSDESCR "1.3.6.1.2.1.1.1.0" //Définit l'adresse dans la MIB de l'info que je cherche
 
#include <iostream>
#include <windows.h>
 
/*------------------------LIBRAIRIE PROPRE A SNMP++--------------*/
#include <snmp_pp.h>
#include <snmp.h>
#include <oid.h>
#include <vb.h>
#include <target.h>
#include <pdu.h>
#include <address.h>
/*-----------------------------------------------------------------*/
using namespace std;
 
/*---------------------------DECLARATION-------------------------*/
void get_system_descriptor()
{
    int status;
    CTarget ctarget((IpAddress) "10.4.8.5");
    Vb vb (SYSDESCR);
    Pdu pdu;
/*-----------------------------------------------------------------*/
 
 
 
/*-----------------CREATION DE LA SESSION SNMP-----------------*/
Snmp snmp(status);
 
if (status != SNMP_CLASS_SUCCESS)
{
    cout << snmp.error_msg (status);
    return;
}
/*----------------------------------------------------------------*/
 
 
 
/*---------------------------REQUETE----------------------------*/
pdu += vb;
 
if ((status = snmp.get (pdu, ctarget)) != SNMP_CLASS_SUCCESS)
    cout << snmp.error_msg (status);
else
{
    pdu.get_vb (vb, 0);
    cout << "System Descriptor = "<< vb.get_printable_value();
}
/*----------------------------------------------------------------*/
 
 
//INT MAIN EN COMMENTAIRE PARCE CE QUE JE NE SAIS PAS QUOI EN FAIRE //!!!!
/*int main(int argc, char *argv[])
{
 
    QCoreApplication a(argc, argv);
 
    return a.exec();
}*/
} | 
Partager