Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 与开发SNMP扩展代理DLL相关?_C++_Windows_Snmp - Fatal编程技术网

C++ 与开发SNMP扩展代理DLL相关?

C++ 与开发SNMP扩展代理DLL相关?,c++,windows,snmp,C++,Windows,Snmp,我按照下面的教程创建扩展代理DLL。我将遵循以下教程: 根据本教程,我至少需要使用以下1种方法签名: BOOL SNMP_FUNC_TYPE SnmpExtensionQuery(BYTE bPduType, SnmpVarBindList *pVarBindList, AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex) 问题在于Snm

我按照下面的教程创建扩展代理DLL。我将遵循以下教程:

根据本教程,我至少需要使用以下1种方法签名:

BOOL SNMP_FUNC_TYPE SnmpExtensionQuery(BYTE bPduType, 
                SnmpVarBindList *pVarBindList, 
                AsnInteger32 *pErrorStatus, 
                AsnInteger32 *pErrorIndex)
问题在于SnmpVarBindList*pVarBindList参数。我被支持在SnmpVarBindList数据类型中插入以下数据,例如(“关于”、“姓名”、“年龄”),然后将其传递到上面的方法中

但我不确定如何创建SnmpVarBindList数据类型列表,并将以下数据插入列表中,例如(“关于”、“姓名”、“年龄”)。

MIB_ENTRY g_MyMibTable[] = {
{   
    {OID_SIZEOF(g_unAboutOid),g_unAboutOid},
    &g_szAbout,
    "About",
    ASN_OCTETSTRING,
    SNMP_ACCESS_READ_ONLY,
    &g_MyMibTable[1]
},
{
    {OID_SIZEOF(g_unNameOid),g_unNameOid},
    &g_szName,
    "Name",
    ASN_OCTETSTRING,
    SNMP_ACCESS_READ_WRITE,
    &g_MyMibTable[2]
},
{
    {OID_SIZEOF(g_unAgeOid),g_unAgeOid},
    &g_asnIntAge,
    "Age",
    ASN_INTEGER,
    SNMP_ACCESS_READ_WRITE,
    NULL
}
})

========================================================================================== //结构定义供您参考:

typedef struct {
AsnObjectName    name;
AsnObjectSyntax  value;
}SnmpVarBind

typedef struct {
SnmpVarBind * list;
UINT          len;
}SnmpVarBindList

非常感谢您提供的任何指导或代码示例,我是C++新手。

真诚地说,

这是您需要的

/* Définitions of vars leaves.
    Terminal zero is needed
*/       
UINT MIB_About[]     = { 2, 1, 0 };
UINT MIB_Name[]      = { 2, 2, 0 };
UINT MIB_Age[]       = { 2, 3, 0 };

/* Physical (Har-coded) data of the MIB
*/
char       MIB_AboutStor[]     = "The about text";
char       MIB_NameStor[]      = "The Name text";
AsnInteger MIB_AgeStor         = 20;
extern MIB_ENTRY Mib[];
extern UINT      MIB_num_variables;

/* initialisation du modèle d'accès aux variables de la MIB 
*/
MIB_ENTRY Mib[] = {
      { { OID_SIZEOF(MIB_About), MIB_About },
        &MIB_AboutStor, ASN_RFC1213_DISPSTRING,
        MIB_ACCESS_READ, MIB_leaf_func, &Mib[1] },

      { { OID_SIZEOF(MIB_Name), MIB_Name },
        &MIB_NameStor, ASN_RFC1213_DISPSTRING,
        MIB_ACCESS_READ, MIB_leaf_func, &Mib[2] },

      { { OID_SIZEOF(MIB_Age), MIB_Age },
        &MIB_AgeStor, ASN_INTEGER,
        MIB_ACCESS_READWRITE, MIB_control_func, NULL }
      };

UINT MIB_num_variables = sizeof Mib / sizeof( MIB_ENTRY );
您可以在Microsoft示例中查找
MIB\u leaf\u func
MIB\u control\u func

以下是您需要的

/* Définitions of vars leaves.
    Terminal zero is needed
*/       
UINT MIB_About[]     = { 2, 1, 0 };
UINT MIB_Name[]      = { 2, 2, 0 };
UINT MIB_Age[]       = { 2, 3, 0 };

/* Physical (Har-coded) data of the MIB
*/
char       MIB_AboutStor[]     = "The about text";
char       MIB_NameStor[]      = "The Name text";
AsnInteger MIB_AgeStor         = 20;
extern MIB_ENTRY Mib[];
extern UINT      MIB_num_variables;

/* initialisation du modèle d'accès aux variables de la MIB 
*/
MIB_ENTRY Mib[] = {
      { { OID_SIZEOF(MIB_About), MIB_About },
        &MIB_AboutStor, ASN_RFC1213_DISPSTRING,
        MIB_ACCESS_READ, MIB_leaf_func, &Mib[1] },

      { { OID_SIZEOF(MIB_Name), MIB_Name },
        &MIB_NameStor, ASN_RFC1213_DISPSTRING,
        MIB_ACCESS_READ, MIB_leaf_func, &Mib[2] },

      { { OID_SIZEOF(MIB_Age), MIB_Age },
        &MIB_AgeStor, ASN_INTEGER,
        MIB_ACCESS_READWRITE, MIB_control_func, NULL }
      };

UINT MIB_num_variables = sizeof Mib / sizeof( MIB_ENTRY );

您可以在Microsoft示例中查找
MIB\u leaf\u func
MIB\u control\u func

谢谢JP。另外,我需要如何在SnmpExtensionInit方法中调用BOOL SNMP_FUNC_TYPE SnmpExtensionQuery(BYTE bPduType、SnmpVarBindList*pVarBindList、AsnInteger32*pErrorStatus、AsnInteger32*pErrorIndex)来代替硬编码的值,这是正确的??谢谢JP。还有,我需要如何在SnmpExtensionInit方法中调用BOOL SNMP_FUNC_TYPE SnmpExtensionQuery(BYTE bPduType、SnmpVarBindList*pVarBindList、AsnInteger32*pErrorStatus、AsnInteger32*pErrorIndex)来代替硬编码的值??