/* -- DO NOT EDIT -- * Generated by smidump version 0.4.3: * smidump -f scli NOTIFICATION-LOG-MIB * * Derived from NOTIFICATION-LOG-MIB: * The MIB module for logging SNMP Notifications, that is, Traps * * * and Informs. * * Revision 2000-11-27 00:00: * This is the initial version of this MIB. * Published as RFC 3014 * * $Id: notification-log-mib.c 1788 2006-02-21 20:47:18Z schoenw $ */ #include "notification-log-mib.h" GNetSnmpEnum const notification_log_mib_enums_nlmConfigLogAdminStatus[] = { { NOTIFICATION_LOG_MIB_NLMCONFIGLOGADMINSTATUS_ENABLED, "enabled" }, { NOTIFICATION_LOG_MIB_NLMCONFIGLOGADMINSTATUS_DISABLED, "disabled" }, { 0, NULL } }; GNetSnmpEnum const notification_log_mib_enums_nlmConfigLogOperStatus[] = { { NOTIFICATION_LOG_MIB_NLMCONFIGLOGOPERSTATUS_DISABLED, "disabled" }, { NOTIFICATION_LOG_MIB_NLMCONFIGLOGOPERSTATUS_OPERATIONAL, "operational" }, { NOTIFICATION_LOG_MIB_NLMCONFIGLOGOPERSTATUS_NOFILTER, "noFilter" }, { 0, NULL } }; GNetSnmpEnum const notification_log_mib_enums_nlmLogVariableValueType[] = { { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_COUNTER32, "counter32" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_UNSIGNED32, "unsigned32" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_TIMETICKS, "timeTicks" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_INTEGER32, "integer32" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_IPADDRESS, "ipAddress" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_OCTETSTRING, "octetString" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_OBJECTID, "objectId" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_COUNTER64, "counter64" }, { NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE_OPAQUE, "opaque" }, { 0, NULL } }; static guint16 nlmConfigLogFilterName_constraints[] = {0U, 32U, 0, 0}; static guint16 nlmLogDateAndTime_constraints[] = {8U, 8U, 11, 11, 0, 0}; static guint16 nlmLogEngineID_constraints[] = {5U, 32U, 0, 0}; static guint16 nlmLogEngineTAddress_constraints[] = {1U, 255U, 0, 0}; static guint16 nlmLogContextEngineID_constraints[] = {5U, 32U, 0, 0}; static guint16 nlmLogContextName_constraints[] = {0U, 255U, 0, 0}; static guint16 nlmLogVariableIpAddressVal_constraints[] = {4U, 4U, 0, 0}; static guint32 const nlmConfig_oid[] = {1, 3, 6, 1, 2, 1, 92, 1, 1}; static GNetSnmpAttribute nlmConfig_attr[] = { { 1, GNET_SNMP_VARBIND_TYPE_UNSIGNED32, NOTIFICATION_LOG_MIB_NLMCONFIGGLOBALENTRYLIMIT, "nlmConfigGlobalEntryLimit", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmConfig_t, nlmConfigGlobalEntryLimit), 0, GSNMP_ATTR_FLAG_WRITABLE }, { 2, GNET_SNMP_VARBIND_TYPE_UNSIGNED32, NOTIFICATION_LOG_MIB_NLMCONFIGGLOBALAGEOUT, "nlmConfigGlobalAgeOut", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmConfig_t, nlmConfigGlobalAgeOut), 0, GSNMP_ATTR_FLAG_WRITABLE }, { 0, 0, 0, NULL } }; static guint32 const nlmConfigLogEntry_oid[] = {1, 3, 6, 1, 2, 1, 92, 1, 1, 3, 1}; static GNetSnmpAttribute nlmConfigLogEntry_attr[] = { { 2, GNET_SNMP_VARBIND_TYPE_OCTETSTRING, NOTIFICATION_LOG_MIB_NLMCONFIGLOGFILTERNAME, "nlmConfigLogFilterName", nlmConfigLogFilterName_constraints, G_STRUCT_OFFSET(notification_log_mib_nlmConfigLogEntry_t, nlmConfigLogFilterName), G_STRUCT_OFFSET(notification_log_mib_nlmConfigLogEntry_t, _nlmConfigLogFilterNameLength), GSNMP_ATTR_FLAG_WRITABLE }, { 3, GNET_SNMP_VARBIND_TYPE_UNSIGNED32, NOTIFICATION_LOG_MIB_NLMCONFIGLOGENTRYLIMIT, "nlmConfigLogEntryLimit", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmConfigLogEntry_t, nlmConfigLogEntryLimit), 0, GSNMP_ATTR_FLAG_WRITABLE }, { 4, GNET_SNMP_VARBIND_TYPE_INTEGER32, NOTIFICATION_LOG_MIB_NLMCONFIGLOGADMINSTATUS, "nlmConfigLogAdminStatus", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmConfigLogEntry_t, nlmConfigLogAdminStatus), 0, GSNMP_ATTR_FLAG_WRITABLE }, { 5, GNET_SNMP_VARBIND_TYPE_INTEGER32, NOTIFICATION_LOG_MIB_NLMCONFIGLOGOPERSTATUS, "nlmConfigLogOperStatus", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmConfigLogEntry_t, nlmConfigLogOperStatus), 0, 0 }, { 6, GNET_SNMP_VARBIND_TYPE_INTEGER32, NOTIFICATION_LOG_MIB_NLMCONFIGLOGSTORAGETYPE, "nlmConfigLogStorageType", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmConfigLogEntry_t, nlmConfigLogStorageType), 0, GSNMP_ATTR_FLAG_WRITABLE }, { 7, GNET_SNMP_VARBIND_TYPE_INTEGER32, NOTIFICATION_LOG_MIB_NLMCONFIGLOGENTRYSTATUS, "nlmConfigLogEntryStatus", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmConfigLogEntry_t, nlmConfigLogEntryStatus), 0, GSNMP_ATTR_FLAG_WRITABLE }, { 0, 0, 0, NULL } }; static guint32 const nlmStats_oid[] = {1, 3, 6, 1, 2, 1, 92, 1, 2}; static GNetSnmpAttribute nlmStats_attr[] = { { 1, GNET_SNMP_VARBIND_TYPE_COUNTER32, NOTIFICATION_LOG_MIB_NLMSTATSGLOBALNOTIFICATIONSLOGGED, "nlmStatsGlobalNotificationsLogged", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmStats_t, nlmStatsGlobalNotificationsLogged), 0, 0 }, { 2, GNET_SNMP_VARBIND_TYPE_COUNTER32, NOTIFICATION_LOG_MIB_NLMSTATSGLOBALNOTIFICATIONSBUMPED, "nlmStatsGlobalNotificationsBumped", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmStats_t, nlmStatsGlobalNotificationsBumped), 0, 0 }, { 0, 0, 0, NULL } }; static guint32 const nlmStatsLogEntry_oid[] = {1, 3, 6, 1, 2, 1, 92, 1, 2, 3, 1}; static GNetSnmpAttribute nlmStatsLogEntry_attr[] = { { 1, GNET_SNMP_VARBIND_TYPE_COUNTER32, NOTIFICATION_LOG_MIB_NLMSTATSLOGNOTIFICATIONSLOGGED, "nlmStatsLogNotificationsLogged", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmStatsLogEntry_t, nlmStatsLogNotificationsLogged), 0, 0 }, { 2, GNET_SNMP_VARBIND_TYPE_COUNTER32, NOTIFICATION_LOG_MIB_NLMSTATSLOGNOTIFICATIONSBUMPED, "nlmStatsLogNotificationsBumped", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmStatsLogEntry_t, nlmStatsLogNotificationsBumped), 0, 0 }, { 0, 0, 0, NULL } }; static guint32 const nlmLogEntry_oid[] = {1, 3, 6, 1, 2, 1, 92, 1, 3, 1, 1}; static GNetSnmpAttribute nlmLogEntry_attr[] = { { 2, GNET_SNMP_VARBIND_TYPE_TIMETICKS, NOTIFICATION_LOG_MIB_NLMLOGTIME, "nlmLogTime", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogTime), 0, 0 }, { 3, GNET_SNMP_VARBIND_TYPE_OCTETSTRING, NOTIFICATION_LOG_MIB_NLMLOGDATEANDTIME, "nlmLogDateAndTime", nlmLogDateAndTime_constraints, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogDateAndTime), G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, _nlmLogDateAndTimeLength), 0 }, { 4, GNET_SNMP_VARBIND_TYPE_OCTETSTRING, NOTIFICATION_LOG_MIB_NLMLOGENGINEID, "nlmLogEngineID", nlmLogEngineID_constraints, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogEngineID), G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, _nlmLogEngineIDLength), 0 }, { 5, GNET_SNMP_VARBIND_TYPE_OCTETSTRING, NOTIFICATION_LOG_MIB_NLMLOGENGINETADDRESS, "nlmLogEngineTAddress", nlmLogEngineTAddress_constraints, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogEngineTAddress), G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, _nlmLogEngineTAddressLength), 0 }, { 6, GNET_SNMP_VARBIND_TYPE_OBJECTID, NOTIFICATION_LOG_MIB_NLMLOGENGINETDOMAIN, "nlmLogEngineTDomain", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogEngineTDomain), G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, _nlmLogEngineTDomainLength), 0 }, { 7, GNET_SNMP_VARBIND_TYPE_OCTETSTRING, NOTIFICATION_LOG_MIB_NLMLOGCONTEXTENGINEID, "nlmLogContextEngineID", nlmLogContextEngineID_constraints, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogContextEngineID), G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, _nlmLogContextEngineIDLength), 0 }, { 8, GNET_SNMP_VARBIND_TYPE_OCTETSTRING, NOTIFICATION_LOG_MIB_NLMLOGCONTEXTNAME, "nlmLogContextName", nlmLogContextName_constraints, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogContextName), G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, _nlmLogContextNameLength), 0 }, { 9, GNET_SNMP_VARBIND_TYPE_OBJECTID, NOTIFICATION_LOG_MIB_NLMLOGNOTIFICATIONID, "nlmLogNotificationID", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, nlmLogNotificationID), G_STRUCT_OFFSET(notification_log_mib_nlmLogEntry_t, _nlmLogNotificationIDLength), 0 }, { 0, 0, 0, NULL } }; static guint32 const nlmLogVariableEntry_oid[] = {1, 3, 6, 1, 2, 1, 92, 1, 3, 2, 1}; static GNetSnmpAttribute nlmLogVariableEntry_attr[] = { { 2, GNET_SNMP_VARBIND_TYPE_OBJECTID, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEID, "nlmLogVariableID", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableID), G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, _nlmLogVariableIDLength), 0 }, { 3, GNET_SNMP_VARBIND_TYPE_INTEGER32, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEVALUETYPE, "nlmLogVariableValueType", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableValueType), 0, 0 }, { 4, GNET_SNMP_VARBIND_TYPE_COUNTER32, NOTIFICATION_LOG_MIB_NLMLOGVARIABLECOUNTER32VAL, "nlmLogVariableCounter32Val", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableCounter32Val), 0, 0 }, { 5, GNET_SNMP_VARBIND_TYPE_UNSIGNED32, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEUNSIGNED32VAL, "nlmLogVariableUnsigned32Val", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableUnsigned32Val), 0, 0 }, { 6, GNET_SNMP_VARBIND_TYPE_TIMETICKS, NOTIFICATION_LOG_MIB_NLMLOGVARIABLETIMETICKSVAL, "nlmLogVariableTimeTicksVal", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableTimeTicksVal), 0, 0 }, { 7, GNET_SNMP_VARBIND_TYPE_INTEGER32, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEINTEGER32VAL, "nlmLogVariableInteger32Val", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableInteger32Val), 0, 0 }, { 8, GNET_SNMP_VARBIND_TYPE_OCTETSTRING, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEOCTETSTRINGVAL, "nlmLogVariableOctetStringVal", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableOctetStringVal), G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, _nlmLogVariableOctetStringValLength), 0 }, { 9, GNET_SNMP_VARBIND_TYPE_IPADDRESS, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEIPADDRESSVAL, "nlmLogVariableIpAddressVal", nlmLogVariableIpAddressVal_constraints, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableIpAddressVal), 0, 0 }, { 10, GNET_SNMP_VARBIND_TYPE_OBJECTID, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEOIDVAL, "nlmLogVariableOidVal", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableOidVal), G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, _nlmLogVariableOidValLength), 0 }, { 11, GNET_SNMP_VARBIND_TYPE_COUNTER64, NOTIFICATION_LOG_MIB_NLMLOGVARIABLECOUNTER64VAL, "nlmLogVariableCounter64Val", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableCounter64Val), 0, 0 }, { 12, GNET_SNMP_VARBIND_TYPE_OPAQUE, NOTIFICATION_LOG_MIB_NLMLOGVARIABLEOPAQUEVAL, "nlmLogVariableOpaqueVal", NULL, G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, nlmLogVariableOpaqueVal), G_STRUCT_OFFSET(notification_log_mib_nlmLogVariableEntry_t, _nlmLogVariableOpaqueValLength), 0 }, { 0, 0, 0, NULL } }; notification_log_mib_nlmConfig_t * notification_log_mib_new_nlmConfig() { notification_log_mib_nlmConfig_t *nlmConfig; nlmConfig = (notification_log_mib_nlmConfig_t *) g_malloc0(sizeof(notification_log_mib_nlmConfig_t) + sizeof(gpointer)); return nlmConfig; } static inline notification_log_mib_nlmConfig_t * assign_nlmConfig(GList *vbl) { notification_log_mib_nlmConfig_t *nlmConfig; char *p; nlmConfig = notification_log_mib_new_nlmConfig(); p = (char *) nlmConfig + sizeof(notification_log_mib_nlmConfig_t); * (GList **) p = vbl; gnet_snmp_attr_assign(vbl, nlmConfig_oid, G_N_ELEMENTS(nlmConfig_oid), nlmConfig_attr, nlmConfig); return nlmConfig; } void notification_log_mib_get_nlmConfig(GNetSnmp *s, notification_log_mib_nlmConfig_t **nlmConfig, gint64 mask) { GList *in = NULL, *out = NULL; static guint32 base[] = {1, 3, 6, 1, 2, 1, 92, 1, 1, 0}; *nlmConfig = NULL; gnet_snmp_attr_get(s, &in, base, 10, 9, nlmConfig_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; } *nlmConfig = assign_nlmConfig(out); } } void notification_log_mib_set_nlmConfig(GNetSnmp *s, notification_log_mib_nlmConfig_t *nlmConfig, gint64 mask) { GList *in = NULL, *out = NULL; static guint32 base[] = {1, 3, 6, 1, 2, 1, 92, 1, 1, 0, 0}; gnet_snmp_attr_set(s, &in, base, 11, 9, nlmConfig_attr, mask, nlmConfig); out = gnet_snmp_sync_set(s, in); g_list_foreach(in, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(in); if (out) { g_list_foreach(out, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(out); } } void notification_log_mib_free_nlmConfig(notification_log_mib_nlmConfig_t *nlmConfig) { GList *vbl; char *p; if (nlmConfig) { p = (char *) nlmConfig + sizeof(notification_log_mib_nlmConfig_t); vbl = * (GList **) p; g_list_foreach(vbl, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(vbl); g_free(nlmConfig); } } notification_log_mib_nlmConfigLogEntry_t * notification_log_mib_new_nlmConfigLogEntry() { notification_log_mib_nlmConfigLogEntry_t *nlmConfigLogEntry; nlmConfigLogEntry = (notification_log_mib_nlmConfigLogEntry_t *) g_malloc0(sizeof(notification_log_mib_nlmConfigLogEntry_t) + sizeof(gpointer)); return nlmConfigLogEntry; } static inline int unpack_nlmConfigLogEntry(GNetSnmpVarBind *vb, notification_log_mib_nlmConfigLogEntry_t *nlmConfigLogEntry) { guint8 idx = 12; guint16 i, len; if (vb->oid_len < idx) return -1; len = vb->oid[idx++]; if (len > 32) return -1; if (vb->oid_len < idx + len) return -1; for (i = 0; i < len; i++) { nlmConfigLogEntry->nlmLogName[i] = vb->oid[idx++]; } nlmConfigLogEntry->_nlmLogNameLength = len; if (vb->oid_len > idx) return -1; return 0; } static inline gint8 pack_nlmConfigLogEntry(guint32 *base, guchar *nlmLogName, guint16 _nlmLogNameLength) { guint8 idx = 12; guint16 i, len; len = _nlmLogNameLength; base[idx++] = len; if (len > 32) return -1; for (i = 0; i < len; i++) { base[idx++] = nlmLogName[i]; if (idx >= 128) return -1; } return idx; } static inline notification_log_mib_nlmConfigLogEntry_t * assign_nlmConfigLogEntry(GList *vbl) { notification_log_mib_nlmConfigLogEntry_t *nlmConfigLogEntry; char *p; nlmConfigLogEntry = notification_log_mib_new_nlmConfigLogEntry(); p = (char *) nlmConfigLogEntry + sizeof(notification_log_mib_nlmConfigLogEntry_t); * (GList **) p = vbl; if (unpack_nlmConfigLogEntry((GNetSnmpVarBind *) vbl->data, nlmConfigLogEntry) < 0) { g_warning("%s: invalid instance identifier", "nlmConfigLogEntry"); g_free(nlmConfigLogEntry); return NULL; } gnet_snmp_attr_assign(vbl, nlmConfigLogEntry_oid, G_N_ELEMENTS(nlmConfigLogEntry_oid), nlmConfigLogEntry_attr, nlmConfigLogEntry); return nlmConfigLogEntry; } void notification_log_mib_get_nlmConfigLogTable(GNetSnmp *s, notification_log_mib_nlmConfigLogEntry_t ***nlmConfigLogEntry, gint64 mask) { GList *in = NULL, *out = NULL; GList *row; int i; static guint32 base[] = {1, 3, 6, 1, 2, 1, 92, 1, 1, 3, 1, 0}; *nlmConfigLogEntry = NULL; gnet_snmp_attr_get(s, &in, base, 12, 11, nlmConfigLogEntry_attr, mask); out = gnet_snmp_sync_table(s, in); /* gnet_snmp_varbind_list_free(in); */ if (out) { *nlmConfigLogEntry = (notification_log_mib_nlmConfigLogEntry_t **) g_malloc0((g_list_length(out) + 1) * sizeof(notification_log_mib_nlmConfigLogEntry_t *)); for (row = out, i = 0; row; row = g_list_next(row), i++) { (*nlmConfigLogEntry)[i] = assign_nlmConfigLogEntry(row->data); } } } void notification_log_mib_get_nlmConfigLogEntry(GNetSnmp *s, notification_log_mib_nlmConfigLogEntry_t **nlmConfigLogEntry, guchar *nlmLogName, guint16 _nlmLogNameLength, gint64 mask) { GList *in = NULL, *out = NULL; guint32 base[128]; gint8 len; memcpy(base, nlmConfigLogEntry_oid, sizeof(nlmConfigLogEntry_oid)); len = pack_nlmConfigLogEntry(base, nlmLogName, _nlmLogNameLength); if (len < 0) { g_warning("%s: invalid index values", "nlmConfigLogEntry"); s->error_status = GNET_SNMP_PDU_ERR_INTERNAL; return; } *nlmConfigLogEntry = NULL; gnet_snmp_attr_get(s, &in, base, len, 11, nlmConfigLogEntry_attr, mask); out = gnet_snmp_sync_get(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; } *nlmConfigLogEntry = assign_nlmConfigLogEntry(out); } } void notification_log_mib_set_nlmConfigLogEntry(GNetSnmp *s, notification_log_mib_nlmConfigLogEntry_t *nlmConfigLogEntry, gint64 mask) { GList *in = NULL, *out = NULL; guint32 base[128]; gint8 len; memcpy(base, nlmConfigLogEntry_oid, sizeof(nlmConfigLogEntry_oid)); len = pack_nlmConfigLogEntry(base, nlmConfigLogEntry->nlmLogName, nlmConfigLogEntry->_nlmLogNameLength); if (len < 0) { g_warning("%s: invalid index values", "nlmConfigLogEntry"); s->error_status = GNET_SNMP_PDU_ERR_INTERNAL; return; } gnet_snmp_attr_set(s, &in, base, len, 11, nlmConfigLogEntry_attr, mask, nlmConfigLogEntry); out = gnet_snmp_sync_set(s, in); g_list_foreach(in, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(in); if (out) { g_list_foreach(out, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(out); } } void notification_log_mib_free_nlmConfigLogEntry(notification_log_mib_nlmConfigLogEntry_t *nlmConfigLogEntry) { GList *vbl; char *p; if (nlmConfigLogEntry) { p = (char *) nlmConfigLogEntry + sizeof(notification_log_mib_nlmConfigLogEntry_t); vbl = * (GList **) p; g_list_foreach(vbl, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(vbl); g_free(nlmConfigLogEntry); } } void notification_log_mib_free_nlmConfigLogTable(notification_log_mib_nlmConfigLogEntry_t **nlmConfigLogEntry) { int i; if (nlmConfigLogEntry) { for (i = 0; nlmConfigLogEntry[i]; i++) { notification_log_mib_free_nlmConfigLogEntry(nlmConfigLogEntry[i]); } g_free(nlmConfigLogEntry); } } notification_log_mib_nlmStats_t * notification_log_mib_new_nlmStats() { notification_log_mib_nlmStats_t *nlmStats; nlmStats = (notification_log_mib_nlmStats_t *) g_malloc0(sizeof(notification_log_mib_nlmStats_t) + sizeof(gpointer)); return nlmStats; } static inline notification_log_mib_nlmStats_t * assign_nlmStats(GList *vbl) { notification_log_mib_nlmStats_t *nlmStats; char *p; nlmStats = notification_log_mib_new_nlmStats(); p = (char *) nlmStats + sizeof(notification_log_mib_nlmStats_t); * (GList **) p = vbl; gnet_snmp_attr_assign(vbl, nlmStats_oid, G_N_ELEMENTS(nlmStats_oid), nlmStats_attr, nlmStats); return nlmStats; } void notification_log_mib_get_nlmStats(GNetSnmp *s, notification_log_mib_nlmStats_t **nlmStats, gint64 mask) { GList *in = NULL, *out = NULL; static guint32 base[] = {1, 3, 6, 1, 2, 1, 92, 1, 2, 0}; *nlmStats = NULL; gnet_snmp_attr_get(s, &in, base, 10, 9, nlmStats_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; } *nlmStats = assign_nlmStats(out); } } void notification_log_mib_free_nlmStats(notification_log_mib_nlmStats_t *nlmStats) { GList *vbl; char *p; if (nlmStats) { p = (char *) nlmStats + sizeof(notification_log_mib_nlmStats_t); vbl = * (GList **) p; g_list_foreach(vbl, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(vbl); g_free(nlmStats); } } notification_log_mib_nlmStatsLogEntry_t * notification_log_mib_new_nlmStatsLogEntry() { notification_log_mib_nlmStatsLogEntry_t *nlmStatsLogEntry; nlmStatsLogEntry = (notification_log_mib_nlmStatsLogEntry_t *) g_malloc0(sizeof(notification_log_mib_nlmStatsLogEntry_t) + sizeof(gpointer)); return nlmStatsLogEntry; } static inline int unpack_nlmStatsLogEntry(GNetSnmpVarBind *vb, notification_log_mib_nlmStatsLogEntry_t *nlmStatsLogEntry) { guint8 idx = 12; guint16 i, len; if (vb->oid_len < idx) return -1; len = vb->oid[idx++]; if (len > 32) return -1; if (vb->oid_len < idx + len) return -1; for (i = 0; i < len; i++) { nlmStatsLogEntry->nlmLogName[i] = vb->oid[idx++]; } nlmStatsLogEntry->_nlmLogNameLength = len; if (vb->oid_len > idx) return -1; return 0; } static inline gint8 pack_nlmStatsLogEntry(guint32 *base, guchar *nlmLogName, guint16 _nlmLogNameLength) { guint8 idx = 12; guint16 i, len; len = _nlmLogNameLength; base[idx++] = len; if (len > 32) return -1; for (i = 0; i < len; i++) { base[idx++] = nlmLogName[i]; if (idx >= 128) return -1; } return idx; } static inline notification_log_mib_nlmStatsLogEntry_t * assign_nlmStatsLogEntry(GList *vbl) { notification_log_mib_nlmStatsLogEntry_t *nlmStatsLogEntry; char *p; nlmStatsLogEntry = notification_log_mib_new_nlmStatsLogEntry(); p = (char *) nlmStatsLogEntry + sizeof(notification_log_mib_nlmStatsLogEntry_t); * (GList **) p = vbl; if (unpack_nlmStatsLogEntry((GNetSnmpVarBind *) vbl->data, nlmStatsLogEntry) < 0) { g_warning("%s: invalid instance identifier", "nlmStatsLogEntry"); g_free(nlmStatsLogEntry); return NULL; } gnet_snmp_attr_assign(vbl, nlmStatsLogEntry_oid, G_N_ELEMENTS(nlmStatsLogEntry_oid), nlmStatsLogEntry_attr, nlmStatsLogEntry); return nlmStatsLogEntry; } void notification_log_mib_get_nlmStatsLogTable(GNetSnmp *s, notification_log_mib_nlmStatsLogEntry_t ***nlmStatsLogEntry, gint64 mask) { GList *in = NULL, *out = NULL; GList *row; int i; static guint32 base[] = {1, 3, 6, 1, 2, 1, 92, 1, 2, 3, 1, 0}; *nlmStatsLogEntry = NULL; gnet_snmp_attr_get(s, &in, base, 12, 11, nlmStatsLogEntry_attr, mask); out = gnet_snmp_sync_table(s, in); /* gnet_snmp_varbind_list_free(in); */ if (out) { *nlmStatsLogEntry = (notification_log_mib_nlmStatsLogEntry_t **) g_malloc0((g_list_length(out) + 1) * sizeof(notification_log_mib_nlmStatsLogEntry_t *)); for (row = out, i = 0; row; row = g_list_next(row), i++) { (*nlmStatsLogEntry)[i] = assign_nlmStatsLogEntry(row->data); } } } void notification_log_mib_get_nlmStatsLogEntry(GNetSnmp *s, notification_log_mib_nlmStatsLogEntry_t **nlmStatsLogEntry, guchar *nlmLogName, guint16 _nlmLogNameLength, gint64 mask) { GList *in = NULL, *out = NULL; guint32 base[128]; gint8 len; memcpy(base, nlmStatsLogEntry_oid, sizeof(nlmStatsLogEntry_oid)); len = pack_nlmStatsLogEntry(base, nlmLogName, _nlmLogNameLength); if (len < 0) { g_warning("%s: invalid index values", "nlmStatsLogEntry"); s->error_status = GNET_SNMP_PDU_ERR_INTERNAL; return; } *nlmStatsLogEntry = NULL; gnet_snmp_attr_get(s, &in, base, len, 11, nlmStatsLogEntry_attr, mask); out = gnet_snmp_sync_get(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; } *nlmStatsLogEntry = assign_nlmStatsLogEntry(out); } } void notification_log_mib_free_nlmStatsLogEntry(notification_log_mib_nlmStatsLogEntry_t *nlmStatsLogEntry) { GList *vbl; char *p; if (nlmStatsLogEntry) { p = (char *) nlmStatsLogEntry + sizeof(notification_log_mib_nlmStatsLogEntry_t); vbl = * (GList **) p; g_list_foreach(vbl, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(vbl); g_free(nlmStatsLogEntry); } } void notification_log_mib_free_nlmStatsLogTable(notification_log_mib_nlmStatsLogEntry_t **nlmStatsLogEntry) { int i; if (nlmStatsLogEntry) { for (i = 0; nlmStatsLogEntry[i]; i++) { notification_log_mib_free_nlmStatsLogEntry(nlmStatsLogEntry[i]); } g_free(nlmStatsLogEntry); } } notification_log_mib_nlmLogEntry_t * notification_log_mib_new_nlmLogEntry() { notification_log_mib_nlmLogEntry_t *nlmLogEntry; nlmLogEntry = (notification_log_mib_nlmLogEntry_t *) g_malloc0(sizeof(notification_log_mib_nlmLogEntry_t) + sizeof(gpointer)); return nlmLogEntry; } static inline int unpack_nlmLogEntry(GNetSnmpVarBind *vb, notification_log_mib_nlmLogEntry_t *nlmLogEntry) { guint8 idx = 12; guint16 i, len; if (vb->oid_len < idx) return -1; len = vb->oid[idx++]; if (len > 32) return -1; if (vb->oid_len < idx + len) return -1; for (i = 0; i < len; i++) { nlmLogEntry->nlmLogName[i] = vb->oid[idx++]; } nlmLogEntry->_nlmLogNameLength = len; if (vb->oid_len < idx) return -1; nlmLogEntry->nlmLogIndex = vb->oid[idx++]; if ((nlmLogEntry->nlmLogIndex < 1)) { return -1; } if (vb->oid_len > idx) return -1; return 0; } static inline gint8 pack_nlmLogEntry(guint32 *base, guchar *nlmLogName, guint16 _nlmLogNameLength, guint32 nlmLogIndex) { guint8 idx = 12; guint16 i, len; len = _nlmLogNameLength; base[idx++] = len; if (len > 32) return -1; for (i = 0; i < len; i++) { base[idx++] = nlmLogName[i]; if (idx >= 128) return -1; } base[idx++] = nlmLogIndex; return idx; } static inline notification_log_mib_nlmLogEntry_t * assign_nlmLogEntry(GList *vbl) { notification_log_mib_nlmLogEntry_t *nlmLogEntry; char *p; nlmLogEntry = notification_log_mib_new_nlmLogEntry(); p = (char *) nlmLogEntry + sizeof(notification_log_mib_nlmLogEntry_t); * (GList **) p = vbl; if (unpack_nlmLogEntry((GNetSnmpVarBind *) vbl->data, nlmLogEntry) < 0) { g_warning("%s: invalid instance identifier", "nlmLogEntry"); g_free(nlmLogEntry); return NULL; } gnet_snmp_attr_assign(vbl, nlmLogEntry_oid, G_N_ELEMENTS(nlmLogEntry_oid), nlmLogEntry_attr, nlmLogEntry); return nlmLogEntry; } void notification_log_mib_get_nlmLogTable(GNetSnmp *s, notification_log_mib_nlmLogEntry_t ***nlmLogEntry, gint64 mask) { GList *in = NULL, *out = NULL; GList *row; int i; static guint32 base[] = {1, 3, 6, 1, 2, 1, 92, 1, 3, 1, 1, 0}; *nlmLogEntry = NULL; gnet_snmp_attr_get(s, &in, base, 12, 11, nlmLogEntry_attr, mask); out = gnet_snmp_sync_table(s, in); /* gnet_snmp_varbind_list_free(in); */ if (out) { *nlmLogEntry = (notification_log_mib_nlmLogEntry_t **) g_malloc0((g_list_length(out) + 1) * sizeof(notification_log_mib_nlmLogEntry_t *)); for (row = out, i = 0; row; row = g_list_next(row), i++) { (*nlmLogEntry)[i] = assign_nlmLogEntry(row->data); } } } void notification_log_mib_get_nlmLogEntry(GNetSnmp *s, notification_log_mib_nlmLogEntry_t **nlmLogEntry, guchar *nlmLogName, guint16 _nlmLogNameLength, guint32 nlmLogIndex, gint64 mask) { GList *in = NULL, *out = NULL; guint32 base[128]; gint8 len; memcpy(base, nlmLogEntry_oid, sizeof(nlmLogEntry_oid)); len = pack_nlmLogEntry(base, nlmLogName, _nlmLogNameLength, nlmLogIndex); if (len < 0) { g_warning("%s: invalid index values", "nlmLogEntry"); s->error_status = GNET_SNMP_PDU_ERR_INTERNAL; return; } *nlmLogEntry = NULL; gnet_snmp_attr_get(s, &in, base, len, 11, nlmLogEntry_attr, mask); out = gnet_snmp_sync_get(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; } *nlmLogEntry = assign_nlmLogEntry(out); } } void notification_log_mib_free_nlmLogEntry(notification_log_mib_nlmLogEntry_t *nlmLogEntry) { GList *vbl; char *p; if (nlmLogEntry) { p = (char *) nlmLogEntry + sizeof(notification_log_mib_nlmLogEntry_t); vbl = * (GList **) p; g_list_foreach(vbl, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(vbl); g_free(nlmLogEntry); } } void notification_log_mib_free_nlmLogTable(notification_log_mib_nlmLogEntry_t **nlmLogEntry) { int i; if (nlmLogEntry) { for (i = 0; nlmLogEntry[i]; i++) { notification_log_mib_free_nlmLogEntry(nlmLogEntry[i]); } g_free(nlmLogEntry); } } notification_log_mib_nlmLogVariableEntry_t * notification_log_mib_new_nlmLogVariableEntry() { notification_log_mib_nlmLogVariableEntry_t *nlmLogVariableEntry; nlmLogVariableEntry = (notification_log_mib_nlmLogVariableEntry_t *) g_malloc0(sizeof(notification_log_mib_nlmLogVariableEntry_t) + sizeof(gpointer)); return nlmLogVariableEntry; } static inline int unpack_nlmLogVariableEntry(GNetSnmpVarBind *vb, notification_log_mib_nlmLogVariableEntry_t *nlmLogVariableEntry) { guint8 idx = 12; guint16 i, len; if (vb->oid_len < idx) return -1; len = vb->oid[idx++]; if (len > 32) return -1; if (vb->oid_len < idx + len) return -1; for (i = 0; i < len; i++) { nlmLogVariableEntry->nlmLogName[i] = vb->oid[idx++]; } nlmLogVariableEntry->_nlmLogNameLength = len; if (vb->oid_len < idx) return -1; nlmLogVariableEntry->nlmLogIndex = vb->oid[idx++]; if ((nlmLogVariableEntry->nlmLogIndex < 1)) { return -1; } if (vb->oid_len < idx) return -1; nlmLogVariableEntry->nlmLogVariableIndex = vb->oid[idx++]; if ((nlmLogVariableEntry->nlmLogVariableIndex < 1)) { return -1; } if (vb->oid_len > idx) return -1; return 0; } static inline gint8 pack_nlmLogVariableEntry(guint32 *base, guchar *nlmLogName, guint16 _nlmLogNameLength, guint32 nlmLogIndex, guint32 nlmLogVariableIndex) { guint8 idx = 12; guint16 i, len; len = _nlmLogNameLength; base[idx++] = len; if (len > 32) return -1; for (i = 0; i < len; i++) { base[idx++] = nlmLogName[i]; if (idx >= 128) return -1; } base[idx++] = nlmLogIndex; base[idx++] = nlmLogVariableIndex; return idx; } static inline notification_log_mib_nlmLogVariableEntry_t * assign_nlmLogVariableEntry(GList *vbl) { notification_log_mib_nlmLogVariableEntry_t *nlmLogVariableEntry; char *p; nlmLogVariableEntry = notification_log_mib_new_nlmLogVariableEntry(); p = (char *) nlmLogVariableEntry + sizeof(notification_log_mib_nlmLogVariableEntry_t); * (GList **) p = vbl; if (unpack_nlmLogVariableEntry((GNetSnmpVarBind *) vbl->data, nlmLogVariableEntry) < 0) { g_warning("%s: invalid instance identifier", "nlmLogVariableEntry"); g_free(nlmLogVariableEntry); return NULL; } gnet_snmp_attr_assign(vbl, nlmLogVariableEntry_oid, G_N_ELEMENTS(nlmLogVariableEntry_oid), nlmLogVariableEntry_attr, nlmLogVariableEntry); return nlmLogVariableEntry; } void notification_log_mib_get_nlmLogVariableTable(GNetSnmp *s, notification_log_mib_nlmLogVariableEntry_t ***nlmLogVariableEntry, gint64 mask) { GList *in = NULL, *out = NULL; GList *row; int i; static guint32 base[] = {1, 3, 6, 1, 2, 1, 92, 1, 3, 2, 1, 0}; *nlmLogVariableEntry = NULL; gnet_snmp_attr_get(s, &in, base, 12, 11, nlmLogVariableEntry_attr, mask); out = gnet_snmp_sync_table(s, in); /* gnet_snmp_varbind_list_free(in); */ if (out) { *nlmLogVariableEntry = (notification_log_mib_nlmLogVariableEntry_t **) g_malloc0((g_list_length(out) + 1) * sizeof(notification_log_mib_nlmLogVariableEntry_t *)); for (row = out, i = 0; row; row = g_list_next(row), i++) { (*nlmLogVariableEntry)[i] = assign_nlmLogVariableEntry(row->data); } } } void notification_log_mib_get_nlmLogVariableEntry(GNetSnmp *s, notification_log_mib_nlmLogVariableEntry_t **nlmLogVariableEntry, guchar *nlmLogName, guint16 _nlmLogNameLength, guint32 nlmLogIndex, guint32 nlmLogVariableIndex, gint64 mask) { GList *in = NULL, *out = NULL; guint32 base[128]; gint8 len; memcpy(base, nlmLogVariableEntry_oid, sizeof(nlmLogVariableEntry_oid)); len = pack_nlmLogVariableEntry(base, nlmLogName, _nlmLogNameLength, nlmLogIndex, nlmLogVariableIndex); if (len < 0) { g_warning("%s: invalid index values", "nlmLogVariableEntry"); s->error_status = GNET_SNMP_PDU_ERR_INTERNAL; return; } *nlmLogVariableEntry = NULL; gnet_snmp_attr_get(s, &in, base, len, 11, nlmLogVariableEntry_attr, mask); out = gnet_snmp_sync_get(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; } *nlmLogVariableEntry = assign_nlmLogVariableEntry(out); } } void notification_log_mib_free_nlmLogVariableEntry(notification_log_mib_nlmLogVariableEntry_t *nlmLogVariableEntry) { GList *vbl; char *p; if (nlmLogVariableEntry) { p = (char *) nlmLogVariableEntry + sizeof(notification_log_mib_nlmLogVariableEntry_t); vbl = * (GList **) p; g_list_foreach(vbl, (GFunc) gnet_snmp_varbind_delete, NULL); g_list_free(vbl); g_free(nlmLogVariableEntry); } } void notification_log_mib_free_nlmLogVariableTable(notification_log_mib_nlmLogVariableEntry_t **nlmLogVariableEntry) { int i; if (nlmLogVariableEntry) { for (i = 0; nlmLogVariableEntry[i]; i++) { notification_log_mib_free_nlmLogVariableEntry(nlmLogVariableEntry[i]); } g_free(nlmLogVariableEntry); } }