Author: ctian
Date: Fri Mar 30 11:18:00 2007
New Revision: 6
Modified:
trunk/classes.lisp
Log:
fix: snmp-msg-get now return results as a string
Modified: trunk/classes.lisp
==============================================================================
--- trunk/classes.lisp (original)
+++ trunk/classes.lisp Fri Mar 30 11:18:00 2007
@@ -48,7 +48,8 @@
(defmethod snmp-msg-get ((s snmp-session) (o oid))
(let ((ss (c-snmp-open (slot-value s 'c-session)))
(pdu (c-snmp-pdu-create +snmp-msg-get+))
- (response (foreign-alloc :pointer :initial-element (null-pointer))))
+ (response (foreign-alloc :pointer :initial-element (null-pointer)))
+ value)
(progn
(c-snmp-add-null-var pdu
(slot-value o 'c-oids)
@@ -59,13 +60,14 @@
+snmp-err-noerror+))
(let ((vars (foreign-slot-value (mem-aref response :pointer)
'c-snmp-pdu 'c-variables)))
- (c-print-variable (foreign-slot-value vars 'c-variable-list 'c-name)
- (foreign-slot-value vars 'c-variable-list 'c-name-length)
- vars))
- nil))
+ (if (= (foreign-slot-value vars 'c-variable-list 'c-type) +asn-octet-str+)
+ (setf value (foreign-string-to-lisp
+ (foreign-slot-value vars 'c-variable-list 'c-val)
+ (foreign-slot-value vars 'c-variable-list 'c-val-len)))
+ (setf value "(not a string, unsupport yet..)")))))
(c-snmp-pdu-free (mem-aref response :pointer))
(c-snmp-close ss)
- nil)))
+ value)))
(defmethod snmp-msg-get ((s snmp-session) (o string))
(snmp-msg-get s (make-instance 'oid :name o)))