Author: ctian Date: Thu Oct 18 07:11:29 2007 New Revision: 80
Modified: trunk/net-snmp.asd trunk/smi/ipaddress.lisp Log: Add ipaddress support and fix for win32 load
Modified: trunk/net-snmp.asd ============================================================================== --- trunk/net-snmp.asd (original) +++ trunk/net-snmp.asd Thu Oct 18 07:11:29 2007 @@ -30,7 +30,7 @@ (:file "integer" :depends-on ("package")) (:file "string" :depends-on ("package")) (:file "sequence" :depends-on ("package")) - (:file "ipaddress" :depends-on ("package")) + #-win32 (:file "ipaddress" :depends-on ("package")) (:file "oid" :depends-on ("package")) (:file "timeticks" :depends-on ("package")) (:file "pdu" :depends-on ("package")) @@ -50,6 +50,7 @@ (:file "browser" :depends-on ("tree"))) :depends-on (smi)) ;; SNMP + #-win32 (:module snmp :components ((:file "package") (:file "constants" :depends-on ("package"))
Modified: trunk/smi/ipaddress.lisp ============================================================================== --- trunk/smi/ipaddress.lisp (original) +++ trunk/smi/ipaddress.lisp Thu Oct 18 07:11:29 2007 @@ -1,3 +1,26 @@ (in-package :smi)
-;;; We use net.sockets:sockaddr class as ipaddr type. +;; IP Address Type, use IOLIB's ipv4addr class + +(defmethod plain-value ((address ipv4addr)) + (vector-to-dotted (name address))) + +(defmethod ber-encode ((value ipv4addr)) + (declare (ignore value)) + (nconc (ber-encode-type 1 0 0) + (ber-encode-length 4) + (coerce (name value) 'list))) + +(defmethod ber-decode-value ((stream stream) (type (eql :ipaddress)) length) + (declare (type stream stream) + (type fixnum length) + (ignore type)) + (assert (= 4 length)) + (let ((part-1 (read-byte stream)) + (part-2 (read-byte stream)) + (part-3 (read-byte stream)) + (part-4 (read-byte stream))) + (make-instance 'ipv4addr :name (vector part-1 part-2 part-3 part-4)))) + +(eval-when (:load-toplevel :execute) + (install-asn.1-type :ipaddress 1 0 0))