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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
/* -- DO NOT EDIT --
* Generated by smidump version 0.4.3:
* smidump -f scli SNMP-FRAMEWORK-MIB
*
* Derived from SNMP-FRAMEWORK-MIB:
* The SNMP Management Architecture MIB
*
* Copyright (C) The Internet Society (2002). This
* version of this MIB module is part of RFC 3411;
* see the RFC itself for full legal notices.
*
* Revision 2002-10-14 00:00:
* Changes in this revision:
* - Updated various administrative information.
* - Corrected some typos.
* - Corrected typo in description of SnmpEngineID
* that led to range overlap for 127.
* - Changed '255a' to '255t' in definition of
* SnmpAdminString to align with current SMI.
* - Reworded 'reserved' for value zero in
* DESCRIPTION of SnmpSecurityModel.
* - The algorithm for allocating security models
* should give 256 per enterprise block, rather
* than 255.
* - The example engine ID of 'abcd' is not
* legal. Replaced with '800002b804616263'H based
* on example enterprise 696, string 'abc'.
* - Added clarification that engineID should
* persist across re-initializations.
* This revision published as RFC 3411.
*
* Revision 1999-01-19 00:00:
* Updated editors' addresses, fixed typos.
* Published as RFC 2571.
*
* Revision 1997-11-20 00:00:
* The initial version, published in RFC 2271.
*
* $Id: snmp-framework-mib.c 1788 2006-02-21 20:47:18Z schoenw $
*/
#include "snmp-framework-mib.h"
GNetSnmpEnum const snmp_framework_mib_enums_SnmpSecurityLevel[] = {
{ SNMP_FRAMEWORK_MIB_SNMPSECURITYLEVEL_NOAUTHNOPRIV, "noAuthNoPriv" },
{ SNMP_FRAMEWORK_MIB_SNMPSECURITYLEVEL_AUTHNOPRIV, "authNoPriv" },
{ SNMP_FRAMEWORK_MIB_SNMPSECURITYLEVEL_AUTHPRIV, "authPriv" },
{ 0, NULL }
};
static guint32 const snmpAuthProtocols[]
= { SNMP_FRAMEWORK_MIB_SNMPAUTHPROTOCOLS };
static guint32 const snmpPrivProtocols[]
= { SNMP_FRAMEWORK_MIB_SNMPPRIVPROTOCOLS };
GNetSnmpIdentity const snmp_framework_mib_identities[] = {
{ snmpAuthProtocols,
G_N_ELEMENTS(snmpAuthProtocols),
"snmpAuthProtocols" },
{ snmpPrivProtocols,
G_N_ELEMENTS(snmpPrivProtocols),
"snmpPrivProtocols" },
{ 0, 0, NULL }
};
static guint16 snmpEngineID_constraints[] = {5U, 32U, 0, 0};
static gint32 snmpEngineBoots_constraints[] = {1L, 2147483647L, 0, 0};
static gint32 snmpEngineTime_constraints[] = {0L, 2147483647L, 0, 0};
static gint32 snmpEngineMaxMessageSize_constraints[] = {484L, 2147483647L, 0, 0};
static guint32 const snmpEngine_oid[] = {1, 3, 6, 1, 6, 3, 10, 2, 1};
static GNetSnmpAttribute snmpEngine_attr[] = {
{ 1, GNET_SNMP_VARBIND_TYPE_OCTETSTRING,
SNMP_FRAMEWORK_MIB_SNMPENGINEID, "snmpEngineID",
snmpEngineID_constraints,
G_STRUCT_OFFSET(snmp_framework_mib_snmpEngine_t, snmpEngineID),
G_STRUCT_OFFSET(snmp_framework_mib_snmpEngine_t, _snmpEngineIDLength),
0 },
{ 2, GNET_SNMP_VARBIND_TYPE_INTEGER32,
SNMP_FRAMEWORK_MIB_SNMPENGINEBOOTS, "snmpEngineBoots",
snmpEngineBoots_constraints,
G_STRUCT_OFFSET(snmp_framework_mib_snmpEngine_t, snmpEngineBoots),
0,
0 },
{ 3, GNET_SNMP_VARBIND_TYPE_INTEGER32,
SNMP_FRAMEWORK_MIB_SNMPENGINETIME, "snmpEngineTime",
snmpEngineTime_constraints,
G_STRUCT_OFFSET(snmp_framework_mib_snmpEngine_t, snmpEngineTime),
0,
0 },
{ 4, GNET_SNMP_VARBIND_TYPE_INTEGER32,
SNMP_FRAMEWORK_MIB_SNMPENGINEMAXMESSAGESIZE, "snmpEngineMaxMessageSize",
snmpEngineMaxMessageSize_constraints,
G_STRUCT_OFFSET(snmp_framework_mib_snmpEngine_t, snmpEngineMaxMessageSize),
0,
0 },
{ 0, 0, 0, NULL }
};
snmp_framework_mib_snmpEngine_t *
snmp_framework_mib_new_snmpEngine()
{
snmp_framework_mib_snmpEngine_t *snmpEngine;
snmpEngine = (snmp_framework_mib_snmpEngine_t *) g_malloc0(sizeof(snmp_framework_mib_snmpEngine_t) + sizeof(gpointer));
return snmpEngine;
}
static inline snmp_framework_mib_snmpEngine_t *
assign_snmpEngine(GList *vbl)
{
snmp_framework_mib_snmpEngine_t *snmpEngine;
char *p;
snmpEngine = snmp_framework_mib_new_snmpEngine();
p = (char *) snmpEngine + sizeof(snmp_framework_mib_snmpEngine_t);
* (GList **) p = vbl;
gnet_snmp_attr_assign(vbl, snmpEngine_oid, G_N_ELEMENTS(snmpEngine_oid),
snmpEngine_attr, snmpEngine);
return snmpEngine;
}
void
snmp_framework_mib_get_snmpEngine(GNetSnmp *s, snmp_framework_mib_snmpEngine_t **snmpEngine, gint64 mask)
{
GList *in = NULL, *out = NULL;
static guint32 base[] = {1, 3, 6, 1, 6, 3, 10, 2, 1, 0};
*snmpEngine = NULL;
gnet_snmp_attr_get(s, &in, base, 10, 9, snmpEngine_attr, mask);
out = gnet_snmp_sync_getnext(s, in);
g_list_foreach(in, (GFunc) gnet_snmp_varbind_delete, NULL);
g_list_free(in);
if (out) {
if (s->error_status != GNET_SNMP_PDU_ERR_NOERROR) {
g_list_foreach(out, (GFunc) gnet_snmp_varbind_delete, NULL);
g_list_free(out);
return;
}
*snmpEngine = assign_snmpEngine(out);
}
}
void
snmp_framework_mib_free_snmpEngine(snmp_framework_mib_snmpEngine_t *snmpEngine)
{
GList *vbl;
char *p;
if (snmpEngine) {
p = (char *) snmpEngine + sizeof(snmp_framework_mib_snmpEngine_t);
vbl = * (GList **) p;
g_list_foreach(vbl, (GFunc) gnet_snmp_varbind_delete, NULL);
g_list_free(vbl);
g_free(snmpEngine);
}
}
|