[cl-net-snmp-cvs] r57 - in trunk: . asn.1 mib smi snmp

ctian at common-lisp.net ctian at common-lisp.net
Tue Sep 25 16:51:54 UTC 2007


Author: ctian
Date: Tue Sep 25 12:51:51 2007
New Revision: 57

Added:
   trunk/mib/tree.lisp
      - copied, changed from r54, trunk/asn.1/mib.lisp
   trunk/smi/integer.lisp
   trunk/smi/oid.lisp
      - copied, changed from r54, trunk/asn.1/oid.lisp
   trunk/smi/package.lisp
   trunk/smi/sequence.lisp
      - copied, changed from r54, trunk/asn.1/smi.lisp
   trunk/smi/string.lisp
   trunk/snmp/
   trunk/snmp/package.lisp
Removed:
   trunk/asn.1/mib.lisp
   trunk/asn.1/oid.lisp
   trunk/asn.1/smi.lisp
Modified:
   trunk/asn.1/package.lisp
   trunk/mib/browser.lisp
   trunk/mib/build.lisp
   trunk/mib/package.lisp
   trunk/net-snmp.asd
Log:
Split success

Modified: trunk/asn.1/package.lisp
==============================================================================
--- trunk/asn.1/package.lisp	(original)
+++ trunk/asn.1/package.lisp	Tue Sep 25 12:51:51 2007
@@ -1,11 +1,28 @@
-(in-package :cl-user)
+(in-package :snmp.system)
 
 (defpackage com.netease.asn.1
   (:nicknames asn.1)
   (:use :common-lisp
         #+lispworks :stream #+sbcl :sb-gray #+clisp :gray
         :zebu)
-  (:export *mib-tree* *mib-index* build-mib-tree update-syntax
-           ber-encode ber-decode mbrowse install-asn.1-type))
+  (:export update-syntax
+           ber-encode
+           ber-decode
+           ber-encode-type
+           ber-encode-length
+           ber-decode-type
+           ber-decode-length
+           install-asn.1-type
+           ;;; Symbols from ASN.1 Syntax
+           Obj-Id-Component-p
+           Obj-Id-Component-name
+           Obj-Id-Component-value
+           Module-Body-Assignment-list
+           Value-Assignment-name
+           Value-Assignment-value
+           Module-Definition-body
+           Assignment-type
+           Assignment-value
+           Object-Identifier-Value-value))
 
 (in-package :asn.1)

Modified: trunk/mib/browser.lisp
==============================================================================
--- trunk/mib/browser.lisp	(original)
+++ trunk/mib/browser.lisp	Tue Sep 25 12:51:51 2007
@@ -1,4 +1,4 @@
-(in-package :asn.1)
+(in-package :mib)
 
 (defun children-function (x)
   (let ((children (tree-nodes x)))
@@ -57,6 +57,6 @@
             (capi:display-pane-text display-pane-oid)
             (format nil "~A~{.~A~}" (car oid) (cdr oid))))))
 
-(defun mbrowse ()
+(defun browser ()
   (capi:display (make-instance 'mib-browser)))
 

Modified: trunk/mib/build.lisp
==============================================================================
--- trunk/mib/build.lisp	(original)
+++ trunk/mib/build.lisp	Tue Sep 25 12:51:51 2007
@@ -1,4 +1,4 @@
-(in-package :asn.1)
+(in-package :mib)
 
 (defparameter *mib-list*
   '("SNMPv2-SMI"
@@ -58,7 +58,7 @@
 
 (defparameter *mib-pathname-base*
   (merge-pathnames
-   (make-pathname :directory '(:relative "mibs"))
+   (make-pathname :directory '(:relative "mib" "mibs"))
    (asdf:component-pathname (asdf:find-system :net-snmp))))
 
 (defun mib-pathname (name &optional (base *mib-pathname-base*))

Modified: trunk/mib/package.lisp
==============================================================================
--- trunk/mib/package.lisp	(original)
+++ trunk/mib/package.lisp	Tue Sep 25 12:51:51 2007
@@ -1,10 +1,14 @@
-(in-package :cl-user)
+(in-package :snmp.system)
 
 (defpackage :com.netease.mib
   (:nicknames mib)
   (:use :common-lisp
-        :zebu)
-  (:export))
+        :asn.1 :smi :zebu)
+  (:export *mib-tree* *mib-index*
+           tree-id tree-name tree-object tree-node
+           insert-node resolve
+           reset-mib-tree build-mib-tree
+           #+lispworks browser))
 
 (in-package :mib)
 

Copied: trunk/mib/tree.lisp (from r54, trunk/asn.1/mib.lisp)
==============================================================================
--- trunk/asn.1/mib.lisp	(original)
+++ trunk/mib/tree.lisp	Tue Sep 25 12:51:51 2007
@@ -2,7 +2,7 @@
 ;;;; MIB Base Support ;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(in-package :asn.1)
+(in-package :mib)
 
 #|
 MIB Tree Structure:
@@ -96,10 +96,10 @@
                 (cdr part-2))))))
 
 (defun parse-mib (file &key (verbose nil))
-  (let ((zb:*comment-start* "--")
-        (zb:*comment-brackets* '(("/*" . "*/")))
-        (zb:*preserve-case* t))
-    (zb:file-parser file :grammar (find-grammar "ASN.1") :verbose verbose)))
+  (let ((*comment-start* "--")
+        (*comment-brackets* '(("/*" . "*/")))
+        (*preserve-case* t))
+    (file-parser file :grammar (find-grammar "ASN.1") :verbose verbose)))
 
 (defun kb-sequence->list (kseq)
   (labels ((iter (kb-seq acc)

Modified: trunk/net-snmp.asd
==============================================================================
--- trunk/net-snmp.asd	(original)
+++ trunk/net-snmp.asd	Tue Sep 25 12:51:51 2007
@@ -9,28 +9,41 @@
 (in-package :snmp.system)
 
 (defsystem net-snmp
-  :description "Common Lisp interface for Net-SNMP"
-  :version "0.6"
+  :description "Simple Network Manangement Protocol"
+  :version "0.7"
   :author "Chun Tian (binghe) <binghe.lisp at gmail.com>"
-  :depends-on (:cl-fad ; for directory and file
-               :cl-ppcre ; for oid resolve
-               :ironclad ; for v3 support
+  :depends-on (:cl-fad          ; for directory and file
+               :cl-ppcre        ; for oid resolve
+               :ironclad        ; for v3 support
                :net-telent-date ; for time conv
-               :iolib ; for network
-               :zebu ; for asn.1 parse
-               :zebu-compiler)
-  :components ((:module asn.1
+               :iolib           ; for network
+               :zebu            ; for mib parse
+               :zebu-compiler)  ; for asn.1 syntax compile
+  :components (;; ASN.1
+	       (:module asn.1
                 :components ((:file "package")
-                             (:file "syntax" :depends-on ("package"))
-                             (:file "ber" :depends-on ("package"))
-                             (:file "smi" :depends-on ("ber"))
-                             (:file "oid" :depends-on ("syntax" "ber"))
-                             (:file "mib" :depends-on ("syntax" "oid"))
-                             (:file "parse" :depends-on ("mib"))
-                             #+lispworks
-                             (:file "mib-browse" :depends-on ("mib"))))
+                             (:file "syntax"   :depends-on ("package"))
+                             (:file "ber"      :depends-on ("package"))))
+	       ;; SMI
+	       (:module smi
+		:components ((:file "package")
+			     (:file "integer"  :depends-on ("package"))
+			     (:file "string"   :depends-on ("package"))
+			     (:file "sequence" :depends-on ("package"))
+			     (:file "oid"      :depends-on ("package")))
+		:depends-on (asn.1))
+	       ;; MIB
                (:module mib
-                :components ((:file "package")))))
+                :components ((:file "package")
+			     (:file "tree"     :depends-on ("package"))
+			     (:file "build"    :depends-on ("tree"))
+			     #+lispworks
+			     (:file "browser"  :depends-on ("tree")))
+		:depends-on (smi))
+	       ;; SNMP
+	       (:module snmp
+		:components ((:file "package"))
+		:depends-on (asn.1 smi mib))))
 
 ;;               (:file "package")
 ;;               (:file "constants" :depends-on ("package"))

Added: trunk/smi/integer.lisp
==============================================================================
--- (empty file)
+++ trunk/smi/integer.lisp	Tue Sep 25 12:51:51 2007
@@ -0,0 +1,24 @@
+(in-package :smi)
+
+(defmethod ber-encode ((value integer))
+  (assert (<= 0 value))
+  (labels ((iter (n acc l)
+             (if (zerop n) (values acc l)
+               (multiple-value-bind (q r) (floor n 256)
+                 (iter q (cons r acc) (1+ l))))))
+    (multiple-value-bind (v l) (iter value nil 0)
+      (nconc (ber-encode-type 0 0 2)
+             (ber-encode-length l)
+             v))))
+
+(defmethod ber-decode-value ((stream stream) (type (eql :integer)) length)
+  (declare (type stream stream)
+           (type fixnum length)
+           (ignore type))
+  (labels ((iter (i acc)
+             (if (= i length) acc
+               (iter (1+ i) (logior (ash acc 8) (read-byte stream))))))
+    (iter 0 0)))
+
+(eval-when (:load-toplevel :execute)
+  (install-asn.1-type :integer 0 0 2))

Copied: trunk/smi/oid.lisp (from r54, trunk/asn.1/oid.lisp)
==============================================================================
--- trunk/asn.1/oid.lisp	(original)
+++ trunk/smi/oid.lisp	Tue Sep 25 12:51:51 2007
@@ -2,7 +2,7 @@
 ;;;; Object ID Base Support ;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(in-package :asn.1)
+(in-package :smi)
 
 (defclass object-id ()
   ((rev-ids :initform nil :type list :initarg :id)

Added: trunk/smi/package.lisp
==============================================================================
--- (empty file)
+++ trunk/smi/package.lisp	Tue Sep 25 12:51:51 2007
@@ -0,0 +1,9 @@
+(in-package :snmp.system)
+
+(defpackage com.netease.smi
+  (:nicknames smi)
+  (:use :common-lisp :asn.1)
+  (:export object-id oid make-object-id))
+
+(in-package :smi)
+

Copied: trunk/smi/sequence.lisp (from r54, trunk/asn.1/smi.lisp)
==============================================================================
--- trunk/asn.1/smi.lisp	(original)
+++ trunk/smi/sequence.lisp	Tue Sep 25 12:51:51 2007
@@ -1,45 +1,9 @@
-(in-package :asn.1)
+(in-package :smi)
 
 ;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Special Types ;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;
 
-;;; Integer (:integer)
-
-(defmethod ber-encode ((value integer))
-  (assert (<= 0 value))
-  (labels ((iter (n acc l)
-             (if (zerop n) (values acc l)
-               (multiple-value-bind (q r) (floor n 256)
-                 (iter q (cons r acc) (1+ l))))))
-    (multiple-value-bind (v l) (iter value nil 0)
-      (nconc (ber-encode-type 0 0 2)
-             (ber-encode-length l)
-             v))))
-
-(defmethod ber-decode-value ((stream stream) (type (eql :integer)) length)
-  (declare (type stream stream)
-           (type fixnum length)
-           (ignore type))
-  (labels ((iter (i acc)
-             (if (= i length) acc
-               (iter (1+ i) (logior (ash acc 8) (read-byte stream))))))
-    (iter 0 0)))
-
-;;; OCTET STRING (:octet-string)
-
-(defmethod ber-encode ((value simple-base-string))
-  (nconc (ber-encode-type 0 0 4)
-         (ber-encode-length (length value))
-         (map 'list #'char-code value)))
-
-(defmethod ber-decode-value ((stream stream) (type (eql :octet-string)) length)
-  (declare (type stream stream)
-           (type fixnum length)
-           (ignore type))
-  (let ((str (make-string length)))
-    (map-into str #'(lambda () (code-char (read-byte stream))))))
-
 ;;; SEQUENCE (:sequence)
 
 (defmethod ber-encode ((value sequence))
@@ -81,7 +45,5 @@
   nil)
 
 (eval-when (:load-toplevel :execute)
-  (install-asn.1-type :integer 0 0 2)
-  (install-asn.1-type :octet-string 0 0 4)
   (install-asn.1-type :null 0 0 5)
   (install-asn.1-type :sequence 0 1 16))

Added: trunk/smi/string.lisp
==============================================================================
--- (empty file)
+++ trunk/smi/string.lisp	Tue Sep 25 12:51:51 2007
@@ -0,0 +1,18 @@
+(in-package :smi)
+
+;;; OCTET STRING (:octet-string)
+
+(defmethod ber-encode ((value simple-base-string))
+  (nconc (ber-encode-type 0 0 4)
+         (ber-encode-length (length value))
+         (map 'list #'char-code value)))
+
+(defmethod ber-decode-value ((stream stream) (type (eql :octet-string)) length)
+  (declare (type stream stream)
+           (type fixnum length)
+           (ignore type))
+  (let ((str (make-string length)))
+    (map-into str #'(lambda () (code-char (read-byte stream))))))
+
+(eval-when (:load-toplevel :execute)
+  (install-asn.1-type :octet-string 0 0 4))

Added: trunk/snmp/package.lisp
==============================================================================
--- (empty file)
+++ trunk/snmp/package.lisp	Tue Sep 25 12:51:51 2007
@@ -0,0 +1,8 @@
+(in-package :snmp.system)
+
+(defpackage :com.netease.snmp
+  (:nicknames snmp)
+  (:use :common-lisp)
+  (:export ))
+
+(in-package :snmp)



More information about the Cl-net-snmp-cvs mailing list