Rev 151 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 151 | Rev 154 | ||
---|---|---|---|
Line 125... | Line 125... | ||
125 | 125 | ||
126 | static SnmpObject snmpCommunityName[MaxCommunities]; |
126 | static SnmpObject snmpCommunityName[MaxCommunities]; |
127 | 127 | ||
128 | //static double snmpSetDouble(HSNMP session, const SnmpObject &object, double value); |
128 | //static double snmpSetDouble(HSNMP session, const SnmpObject &object, double value); |
129 | static double snmpSetDouble(HSNMP session, const SnmpObject *object, double value); |
129 | static double snmpSetDouble(HSNMP session, const SnmpObject *object, double value); |
130 |
|
130 | double snmpGetDouble(HSNMP session, const SnmpObject *object); |
131 | static int snmpSetInt(HSNMP session, const SnmpObject *object, int value); |
131 | static int snmpSetInt(HSNMP session, const SnmpObject *object, int value); |
132 |
|
132 | int snmpGetInt(HSNMP session, const SnmpObject *object); |
133 | static char *snmpGetString(HSNMP session, const SnmpObject *object); |
133 | static char *snmpGetString(HSNMP session, const SnmpObject *object); |
134 | 134 | ||
135 | char snmpStringBuffer[1024]; |
135 | char snmpStringBuffer[1024]; |
136 | char snmpLastErrorBuffer[1024]; |
136 | char snmpLastErrorBuffer[1024]; |
137 | 137 | ||
Line 181... | Line 181... | ||
181 | * @internal |
181 | * @internal |
182 | * @param node e.g. "sysMainSwitch" |
182 | * @param node e.g. "sysMainSwitch" |
183 | * @param object the resolved OID |
183 | * @param object the resolved OID |
184 | * @return true on success, false otherwise |
184 | * @return true on success, false otherwise |
185 | */ |
185 | */ |
186 |
|
186 | //static int getNode(const char * const node, SnmpObject *object) |
- | 187 | int getNode(const char * const node, SnmpObject *object) |
|
187 | { |
188 | { |
188 | object->len = MAX_OID_LEN; |
189 | object->len = MAX_OID_LEN; |
189 | if (!get_node(node, object->id, &object->len)) { |
190 | if (!get_node(node, object->id, &object->len)) { |
190 | snmp_log(LOG_ERR, "OID %s not found!\n", node); |
191 | snmp_log(LOG_ERR, "OID %s not found!\n", node); |
191 | return false; |
192 | return false; |
Line 1741... | Line 1742... | ||
1741 | struct snmp_pdu *pdu = snmp_pdu_create(SNMP_MSG_GET); |
1742 | struct snmp_pdu *pdu = snmp_pdu_create(SNMP_MSG_GET); |
1742 | 1743 | ||
1743 | return pdu; |
1744 | return pdu; |
1744 | } |
1745 | } |
1745 | 1746 | ||
1746 |
|
1747 | int snmpGetInt(HSNMP session, const SnmpObject *object) |
1747 | { |
1748 | { |
1748 | int value = 0; |
1749 | int value = 0; |
1749 | 1750 | ||
1750 | struct snmp_pdu *pdu = prepareGetRequestPdu(); |
1751 | struct snmp_pdu *pdu = prepareGetRequestPdu(); |
1751 | 1752 | ||
Line 1787... | Line 1788... | ||
1787 | 1788 | ||
1788 | snmp_free_pdu(response); |
1789 | snmp_free_pdu(response); |
1789 | return result; |
1790 | return result; |
1790 | } |
1791 | } |
1791 | 1792 | ||
1792 |
|
1793 | double snmpGetDouble(HSNMP session, const SnmpObject *object) |
1793 | { |
1794 | { |
1794 | double value = 0.0; |
1795 | double value = 0.0; |
1795 | 1796 | ||
1796 | struct snmp_pdu *pdu = prepareGetRequestPdu(); |
1797 | struct snmp_pdu *pdu = prepareGetRequestPdu(); |
1797 | 1798 |