mailman3.common-lisp.net
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
List overview
Download
cl-net-snmp-cvs
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
cl-net-snmp-cvs@common-lisp.net
164 discussions
Start a n
N
ew thread
[cl-net-snmp-cvs] r4 - www
by ctian@common-lisp.net
29 Mar '07
29 Mar '07
Author: ctian Date: Thu Mar 29 11:45:47 2007 New Revision: 4 Modified: www/index.shtml Log: [www] Add a no release yet area. Modified: www/index.shtml ============================================================================== --- www/index.shtml (original) +++ www/index.shtml Thu Mar 29 11:45:47 2007 @@ -6,9 +6,9 @@ href="
http://www.style.org/css/style.org-blue.css
"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> - <basefont face="Georgia" size="2"> </head> <body> +<basefont face="Georgia" size="2"> <div class="header"><br> </div> <div class="shadow1"> </div> @@ -20,7 +20,7 @@ src="
http://www.net-snmp.org/images/logos/logo1_50.jpg
" alt="Net-SNMP Logo" class="titleimage" style="margin-top: 10px; margin-right: 0px;" border="0"></a> -<h1>Introduction</h1> +<h1>About</h1> <div class="deck">cl-net-snmp is a Common Lisp package, an interface to Net-SNMP project: the famous open source implementation of Simple Network @@ -34,6 +34,11 @@ href="
http://corp.netease.com/
">
NetEase.com
, Inc.</a>) </div> <div class="rule"> </div> +<h1>Release<br> +</h1> +<div class="deck">No release at current...<br> +</div> +<div class="rule"> </div> <h1>Source Code</h1> <div class="deck">Click <a href="
http://common-lisp.net/websvn/listing.php?repname=cl-net-snmp&path=%2F&…
">here</a>
1
0
0
0
[cl-net-snmp-cvs] r3 - www
by ctian@common-lisp.net
29 Mar '07
29 Mar '07
Author: ctian Date: Thu Mar 29 11:38:02 2007 New Revision: 3 Modified: www/index.shtml Log: Update Project Web Page Modified: www/index.shtml ============================================================================== --- www/index.shtml (original) +++ www/index.shtml Thu Mar 29 11:38:02 2007 @@ -1,25 +1,74 @@ -<?xml version="1.0"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
"> <html xmlns="
http://www.w3.org/1999/xhtml
" xml:lang="en" lang="en"> <head> - <title><!--#include virtual="project-name" --></title> - <link rel="stylesheet" type="text/css" href="style.css"/> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> + <title>cl-net-snmp</title> + <link rel="stylesheet" type="text/css" + href="
http://www.style.org/css/style.org-blue.css
"> + <meta http-equiv="Content-Type" + content="text/html; charset=ISO-8859-1"> + <basefont face="Georgia" size="2"> </head> - <body> - <div class="header"> - <h1><!--#include virtual="project-name" --></h1> - </div> - - <p><em>This is an automatically generated placeholder page: this project - has not yet created a website.</em></p> - - <p>Back to <a href="
http://common-lisp.net/
">
Common-lisp.net
</a>.</p> - - <div class="check"> - <a href="
http://validator.w3.org/check/referer
">Valid XHTML 1.0 Strict</a> - </div> +<div class="header"><br> +</div> +<div class="shadow1"> </div> +<div class="shadow2"> </div> +<div class="content"> +<h1>Common Lisp Interface of Net-SNMP (cl-net-snmp)</h1> +<div class="rule"> </div> +<a href="
http://www.net-snmp.org
"><img + src="
http://www.net-snmp.org/images/logos/logo1_50.jpg
" + alt="Net-SNMP Logo" class="titleimage" + style="margin-top: 10px; margin-right: 0px;" border="0"></a> +<h1>Introduction</h1> +<div class="deck">cl-net-snmp is a Common Lisp package, an +interface to Net-SNMP project: the famous open source implementation of +Simple Network +Management Protocol (SNMP). With this package, It's possible to build a +network nanagement system in common lisp, the most advance computer +programming language in the world.<br> +<br> +This package is still in early development stage, lots of work for me +to do, but I'll continue coding, because I use it for managing my +servers. (I'm a Unix System Administrator of <a + href="
http://corp.netease.com/
">
NetEase.com
, Inc.</a>) +</div> +<div class="rule"> </div> +<h1>Source Code</h1> +<div class="deck">Click <a + href="
http://common-lisp.net/websvn/listing.php?repname=cl-net-snmp&path=%2F&…
">here</a> +to view the source code on
common-lisp.net
's Web-SVN interface, and use +follow command to check out the code:<br> +<br> +<div class="dateline">svn checkout +svn://common-lisp.net/project/cl-net-snmp/svn/trunk cl-net-snmp<br> +</div> +</div> +<br> +<div class="rule"> </div> +<h1>Mailing List</h1> +<div class="deck"> +<ul> + <li><a + href="
http://common-lisp.net/cgi-bin/mailman/listinfo/cl-net-snmp-announce
">cl-net-snmp-announce</a></li> + <li><a + href="
http://common-lisp.net/cgi-bin/mailman/listinfo/cl-net-snmp-devel
">cl-net-snmp-devel</a></li> + <li><a + href="
http://common-lisp.net/cgi-bin/mailman/listinfo/cl-net-snmp-cvs
">cl-net-snmp-cvs</a><br> + </li> +</ul> +</div> +<div class="rule"> </div> +<h1>Maintainer<br> +</h1> +<div class="deck">Chun Tian (binghe) <ctian at common-lisp dot +net>, Lisp Programmer, Unix Administrator.<br> +Welcome to his chinese <a href="
http://tianchunbinghe.blog.163.com/
">BLOG</a> +on NetEase blog system.^_^<br> +</div> +</div> +<div class="footer"> +<address>Powered by
Common-Lisp.net
</address> +</div> </body> </html>
1
0
0
0
[cl-net-snmp-cvs] r2 - www
by ctian@common-lisp.net
29 Mar '07
29 Mar '07
Author: ctian Date: Thu Mar 29 10:24:29 2007 New Revision: 2 Added: www/ www/index.shtml www/project-name www/style.css Log: Use SVN to manage Web Pages Added: www/index.shtml ============================================================================== --- (empty file) +++ www/index.shtml Thu Mar 29 10:24:29 2007 @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
"> +<html xmlns="
http://www.w3.org/1999/xhtml
" xml:lang="en" lang="en"> +<head> + <title><!--#include virtual="project-name" --></title> + <link rel="stylesheet" type="text/css" href="style.css"/> + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +</head> + +<body> + <div class="header"> + <h1><!--#include virtual="project-name" --></h1> + </div> + + <p><em>This is an automatically generated placeholder page: this project + has not yet created a website.</em></p> + + <p>Back to <a href="
http://common-lisp.net/
">
Common-lisp.net
</a>.</p> + + <div class="check"> + <a href="
http://validator.w3.org/check/referer
">Valid XHTML 1.0 Strict</a> + </div> +</body> +</html> Added: www/project-name ============================================================================== --- (empty file) +++ www/project-name Thu Mar 29 10:24:29 2007 @@ -0,0 +1 @@ +cl-net-snmp Added: www/style.css ============================================================================== --- (empty file) +++ www/style.css Thu Mar 29 10:24:29 2007 @@ -0,0 +1,54 @@ + +.header { + font-size: medium; + background-color:#336699; + color:#ffffff; + border-style:solid; + border-width: 5px; + border-color:#002244; + padding: 1mm 1mm 1mm 5mm; +} + +.footer { + font-size: small; + font-style: italic; + text-align: right; + background-color:#336699; + color:#ffffff; + border-style:solid; + border-width: 2px; + border-color:#002244; + padding: 1mm 1mm 1mm 1mm; +} + +.footer a:link { + font-weight:bold; + color:#ffffff; + text-decoration:underline; +} + +.footer a:visited { + font-weight:bold; + color:#ffffff; + text-decoration:underline; +} + +.footer a:hover { + font-weight:bold; + color:#002244; + text-decoration:underline; } + +.check {font-size: x-small; + text-align:right;} + +.check a:link { font-weight:bold; + color:#a0a0ff; + text-decoration:underline; } + +.check a:visited { font-weight:bold; + color:#a0a0ff; + text-decoration:underline; } + +.check a:hover { font-weight:bold; + color:#000000; + text-decoration:underline; }
1
0
0
0
[cl-net-snmp-cvs] r1 - branches tags trunk
by ctian@common-lisp.net
29 Mar '07
29 Mar '07
Author: ctian Date: Thu Mar 29 09:51:13 2007 New Revision: 1 Added: branches/ tags/ trunk/ trunk/README trunk/classes.lisp trunk/constants.lisp trunk/copyright trunk/net-snmp.asd trunk/package.lisp trunk/snmp-api.lisp trunk/typedefs.lisp Log: Initial commit into
common-lisp.net
SVN repository. Added: trunk/README ============================================================================== --- (empty file) +++ trunk/README Thu Mar 29 09:51:13 2007 @@ -0,0 +1,24 @@ +;;; -*- Mode: Lisp -*- + +;;; Common Lisp Interface for Net-SNMP (cl-net-snmp) + +;;; Author: Chun Tian (binghe) <binghe.lisp(a)gmail.com> +;;;
NetEase.com
, Inc. (
http://corp.netease.com
) + +;;; This package only support: +;;; * Version: SNMPv1, SNMPv2c +;;; * PDU Type: GET +;;; * Just print the result to stdout... + +;;; I use the CFFI for portable CL support, see
http://common-lisp.net/project/cffi/
+;;; Known work on: SBCL and CLISP + +;;; Sample usage: + +(defun test () + (let ((s (make-instance 'snmp:snmp-session + :peername "localhost" + :community "public" + :version snmp:+snmp-version-2c+))) + (snmp:snmp-msg-get s "sysDescr.0") + (snmp:snmp-msg-get "localhost" ".1.3.6.1.2.1.1.1.0"))) Added: trunk/classes.lisp ============================================================================== --- (empty file) +++ trunk/classes.lisp Thu Mar 29 09:51:13 2007 @@ -0,0 +1,75 @@ +(in-package :org.net-snmp) + +(defclass snmp-session () + ((peername :reader snmp-peername + :initarg :peername + :type string + :initform "localhost") + (version :reader snmp-version + :initarg :version + :type integer + :initform +snmp-version-2c+) + (community :reader snmp-community + :initarg :community + :type string + :initform "public") + c-session)) + +(defmethod shared-initialize :after ((instance snmp-session) slot-names &rest initargs) + (declare (ignore slot-names initargs)) + (with-slots (peername version community c-session) instance + (progn + (setf c-session (foreign-alloc 'c-snmp-session)) + (c-snmp-session-init c-session) + (with-foreign-slots ((c-peername c-version c-community c-community-len) + c-session c-snmp-session) + (setf c-peername (foreign-string-alloc peername) + c-version version + c-community (foreign-string-alloc community) + c-community-len (length community)))))) + +(defclass oid () + ((name :type string :reader oid-name :initarg :name) + (length :type integer :reader oid-length) + c-oids + c-oid-len)) + +(defmethod shared-initialize :after ((instance oid) slot-names &rest initargs) + (declare (ignore slot-names initargs)) + (with-slots (name length c-oids c-oid-len) instance + (progn + (setf c-oids (foreign-alloc 'c-oid :count +max-oid-len+) + c-oid-len (foreign-alloc 'c-size-type :initial-element +max-oid-len+)) + (if (eq (elt name 0) #\.) + (c-read-objid name c-oids c-oid-len) + (c-get-node name c-oids c-oid-len)) + (setf length (mem-ref c-oid-len 'c-size-type))))) + +(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)))) + (progn + (c-snmp-add-null-var pdu + (slot-value o 'c-oids) + (mem-ref (slot-value o 'c-oid-len) 'c-size-type)) + (let ((status (c-snmp-synch-response ss pdu response))) + (if (and (= status +snmp-stat-success+) + (= (foreign-slot-value (mem-aref response :pointer) 'c-snmp-pdu 'c-errstat) + +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)) + (c-snmp-pdu-free (mem-aref response :pointer)) + (c-snmp-close ss) + nil))) + +(defmethod snmp-msg-get ((s snmp-session) (o string)) + (snmp-msg-get s (make-instance 'oid :name o))) + +(defmethod snmp-msg-get ((s string) (o string)) + (snmp-msg-get (make-instance 'snmp-session :peername s) o)) + Added: trunk/constants.lisp ============================================================================== --- (empty file) +++ trunk/constants.lisp Thu Mar 29 09:51:13 2007 @@ -0,0 +1,83 @@ +(in-package :org.net-snmp) + +(eval-when (:compile-toplevel :load-toplevel :execute) + ;;; from asn1.h + (defconstant +min-oid-len+ 2) + (defconstant +max-oid-len+ 128) + ;;; from snmp_api.h + (defconstant +usm-auth-ku-len+ 32) + (defconstant +usm-priv-ku-len+ 32)) + +(defconstant +asn-boolean+ #x01) +(defconstant +asn-integer+ #x02) +(defconstant +asn-bit-str+ #x03) +(defconstant +asn-octet-str+ #x04) +(defconstant +asn-null+ #x05) +(defconstant +asn-object-id+ #x06) +(defconstant +asn-sequence+ #x10) +(defconstant +asn-set+ #x11) + +(defconstant +asn-universal+ #b00000000) +(defconstant +asn-application+ #b01000000) +(defconstant +asn-context+ #b10000000) +(defconstant +asn-private+ #b11000000) + +(defconstant +asn-primitive+ #b00000000) +(defconstant +asn-constructor+ #b00100000) + +;;; from snmp.h +(defconstant +snmp-version-1+ 0) +(defconstant +snmp-version-2c+ 1) +(defconstant +snmp-version-3+ 3) + +(defconstant +snmp-sec-model-any+ 0) +(defconstant +snmp-sec-model-snmpv1+ 1) +(defconstant +snmp-sec-model-snmpv2c+ 2) +(defconstant +snmp-sec-model-usm+ 3) + +(defconstant +snmp-sec-level-noauth+ 1) +(defconstant +snmp-sec-level-authnopriv+ 2) +(defconstant +snmp-sec-level-authpriv+ 3) + +;; PDU types in SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 +(defconstant +snmp-msg-get+ + (logior +asn-context+ +asn-constructor+ 0)) + +(defconstant +snmp-msg-getnext+ + (logior +asn-context+ +asn-constructor+ 1)) + +(defconstant +snmp-msg-response+ + (logior +asn-context+ +asn-constructor+ 2)) + +(defconstant +snmp-msg-set+ + (logior +asn-context+ +asn-constructor+ 3)) + +;; PDU types in SNMPv1 and SNMPsec +(defconstant +snmp-msg-trap+ + (logior +asn-context+ +asn-constructor+ 4)) + +;; PDU types in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 +(defconstant +snmp-msg-getbulk+ + (logior +asn-context+ +asn-constructor+ 5)) + +(defconstant +snmp-msg-inform+ + (logior +asn-context+ +asn-constructor+ 6)) + +(defconstant +snmp-msg-trap2+ + (logior +asn-context+ +asn-constructor+ 7)) + +;; PDU types in SNMPv2u, SNMPv2*, and SNMPv3 +(defconstant +snmp-msg-report+ + (logior +asn-context+ +asn-constructor+ 8)) + +;;; from snmp_client.h +(defconstant +snmp-stat-success+ 0) +(defconstant +snmp-stat-error+ 1) +(defconstant +snmp-stat-timeout+ 2) + +(defconstant +snmp-err-noerror+ 0) +(defconstant +snmp-err-toobig+ 1) +(defconstant +snmp-err-nosuchname+ 2) +(defconstant +snmp-err-badvalue+ 3) +(defconstant +snmp-err-readonly+ 4) +(defconstant +snmp-err-generr+ 5) Added: trunk/copyright ============================================================================== --- (empty file) +++ trunk/copyright Thu Mar 29 09:51:13 2007 @@ -0,0 +1,25 @@ +;;; Copyright (c) 2007, Chun Tian (binghe). All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Added: trunk/net-snmp.asd ============================================================================== --- (empty file) +++ trunk/net-snmp.asd Thu Mar 29 09:51:13 2007 @@ -0,0 +1,17 @@ +;;;; -*- Mode: Lisp -*- + +(defpackage :net-snmp-system + (:use :cl :asdf)) + +(in-package :net-snmp-system) + +(defsystem net-snmp + :description "Common Lisp interface for Net-SNMP" + :version "0.01" + :author "Chun Tian (binghe)" + :depends-on (:cffi) + :components ((:file "package") + (:file "constants" :depends-on ("package")) + (:file "typedefs" :depends-on ("package")) + (:file "snmp-api" :depends-on ("constants" "typedefs")) + (:file "classes" :depends-on ("snmp-api")))) Added: trunk/package.lisp ============================================================================== --- (empty file) +++ trunk/package.lisp Thu Mar 29 09:51:13 2007 @@ -0,0 +1,27 @@ +(in-package :net-snmp-system) + +(defpackage :org.net-snmp + (:nicknames :snmp) + (:use :cl :cffi) + (:export + ;; class + snmp-session oid + ;; method + snmp-msg-get + ;; constants + +snmp-version-1+ + +snmp-version-2c+)) + +(in-package :org.net-snmp) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (define-foreign-library libssl + (:unix (:or "libssl.so.0.9.8" "libssl.so")) + (t (:default "libssl"))) + + (define-foreign-library libsnmp + (:unix (:or "libsnmp.so.15" "libsnmp.so")) + (t (:default "libsnmp"))) + + (use-foreign-library libssl) + (use-foreign-library libsnmp)) Added: trunk/snmp-api.lisp ============================================================================== --- (empty file) +++ trunk/snmp-api.lisp Thu Mar 29 09:51:13 2007 @@ -0,0 +1,77 @@ +(in-package :org.net-snmp) + +;;(defcvar ("usmHMACMD5AuthProtocol" *c-usm-hmac-md5-auth-protocol*) :pointer) + +(eval-when (:compile-toplevel :load-toplevel) + (defcfun ("init_snmp" c-snmp-init) :void (type :string))) + +(eval-when (:load-toplevel :execute) + (progn (c-snmp-init "snmpapp") + (format t "c-snmp-init called.~%"))) + +;;; +;;; Initializes the session structure. +;;; May perform one time minimal library initialization. +;;; No MIB file processing is done via this call. +;;; +(defcfun ("snmp_sess_init" c-snmp-session-init) :void (session :pointer)) + +;;; +;;; netsnmp_session *snmp_open(session) +;;; netsnmp_session *session; +;;; +;;; Sets up the session with the snmp_session information provided +;;; by the user. Then opens and binds the necessary UDP port. +;;; A handle to the created session is returned (this is different than +;;; the pointer passed to snmp_open()). On any error, NULL is returned +;;; and snmp_errno is set to the appropriate error code. +;;; +(defcfun ("snmp_open" c-snmp-open) :pointer (session :pointer)) + +;;; +;;; int snmp_close(session) +;;; netsnmp_session *session; +;;; +;;; Close the input session. Frees all data allocated for the session, +;;; dequeues any pending requests, and closes any sockets allocated for +;;; the session. Returns 0 on error, 1 otherwise. +;;; +;;; snmp_close_sessions() does the same thing for all open sessions +;;; +(defcfun ("snmp_close" c-snmp-close) :int (session :pointer)) +(defcfun ("snmp_close_sessions" c-snmp-close-sessions) :int) + +(defcfun ("snmp_perror" c-snmp-perror) :void (prog-string :string)) +(defcfun ("snmp_errstring" c-snmp-errstring) :string (errstat :int)) +(defcfun ("snmp_sess_perror" c-snmp-session-perror) :void + (prog-string :string) (ss :pointer)) + +(defcfun ("snmp_pdu_create" c-snmp-pdu-create) :pointer (command :int)) +(defcfun ("snmp_free_pdu" c-snmp-pdu-free) :void (pdu :pointer)) +(defcfun ("snmp_pdu_type" c-snmp-pdu-type) :string (type :int)) + +(defcfun ("read_objid" c-read-objid) :int + (str :string) + (oid :pointer) + (size :pointer)) + +(defcfun ("get_node" c-get-node) :int + (str :string) + (oid :pointer) + (size :pointer)) + +(defcfun ("snmp_add_null_var" c-snmp-add-null-var) :pointer + (pdu :pointer) + (oid :pointer) + (size :ulong)) + +(defcfun ("snmp_synch_response" c-snmp-synch-response) :int + (session :pointer) + (pdu :pointer) + (pdu* :pointer)) + +(defcfun ("print_variable" c-print-variable) :void + (objid :pointer) + (objidlen :ulong) + (variable :pointer)) + Added: trunk/typedefs.lisp ============================================================================== --- (empty file) +++ trunk/typedefs.lisp Thu Mar 29 09:51:13 2007 @@ -0,0 +1,252 @@ +(in-package :org.net-snmp) + +(defctype c-size-type :long) + +(defcstruct c-snmp-pdu + "The snmp protocol data unit." + ;; + ;; Protocol-version independent fields + ;; + ;; snmp version + (c-version :long) + ;; Type of this PDU + (c-command :int) + ;; Request id - note: not incremented on retries + (c-reqid :long) + ;; Message id for V3 messages note: incremented for each retry + (c-msgid :long) + ;; Unique ID for incoming transactions + (c-transid :long) + ;; Session id for AgentX messages + (c-sessid :long) + ;; Error status (non_repeaters in GetBulk) + (c-errstat :long) + ;; Error index (max_repetitions in GetBulk) + (c-errindex :long) + ;; Uptime + (c-time :ulong) + (c-flags :ulong) + + (c-security-model :int) + ;; noAuthNoPriv, authNoPriv, authPriv + (c-security-level :int) + (c-msg-parse-model :int) + + ;; + ;; Transport-specific opaque data. This replaces the IP-centric address + ;; field. + ;; + + (c-transport-data :pointer) + (c-transport-data-length :int) + + ;; + ;; The actual transport domain. This SHOULD NOT BE FREE()D. + ;; + + (c-t-domain :pointer) + (c-t-domain-len c-size-type) + + (c-variables :pointer) + + ;; + ;; SNMPv1 & SNMPv2c fields + ;; + ;; community for outgoing requests. + (c-community :pointer) + ;; length of community name. + (c-community-len c-size-type) + + ;; + ;; Trap information + ;; + ;; System OID + (c-enterprise :pointer) + (c-enterprise-length c-size-type) + ;; trap type + (c-trap-type :long) + ;; specific type + (c-specific-type :long) + ;; This is ONLY used for v1 TRAPs + (c-agent-addr :pointer) + + ;; + ;; SNMPv3 fields + ;; + ;; context snmpEngineID + (c-context-engine-id :pointer) + ;; Length of contextEngineID + (c-context-engine-id-len c-size-type) + ;; authoritative contextName + (c-context-name :string) + ;; Length of contextName + (c-context-name-len c-size-type) + ;; authoritative snmpEngineID for security + (c-security-engine-id :pointer) + ;; Length of securityEngineID + (c-security-engine-id-len c-size-type) + ;; on behalf of this principal + (c-security-name :string) + ;; Length of securityName. + (c-security-name-len c-size-type) + + ;; + ;; AgentX fields + ;; (also uses SNMPv1 community field) + ;; + (c-priority :int) + (c-range-subid :int) + + (c-security-state-ref :pointer)) + +(defctype c-netsnmp-pdu c-snmp-pdu) +(defctype c-netsnmp-callback :pointer) +(defctype c-authenticator :pointer) + +(defmacro def-snmp-session () + `(defcstruct c-snmp-session + "The snmp session structure." + ;; + ;; Protocol-version independent fields + ;; + ;; snmp version + (c-version :long) + ;; Number of retries before timeout. + (c-retries :int) + ;; Number of uS until first timeout, then exponential backoff + (c-timeout :long) + (c-flags :ulong) + (c-subsession :pointer) + (c-next :pointer) + ;; Domain name or dotted IP address of default peer + (c-peername :string) + ;; UDP port number of peer. + (c-remote-port :ushort) + ;; My Domain name or dotted IP address, 0 for default + (c-localname :string) + ;; My UDP port number, 0 for default, picked randomly + (c-local-port :ushort) + ;; + ;; Authentication function or NULL if null authentication is used + ;; + (c-authenticator c-authenticator) + ;; Function to interpret incoming data + (c-callback c-netsnmp-callback) + ;; + ;; Pointer to data that the callback function may consider important + ;; + (c-callback-magic :pointer) + ;; copy of system errno + (c-system-errno :int) + ;; copy of library errno + (c-system-snmp-errno :int) + ;; Session id - AgentX only + (c-sessid :long) + ;; + ;; SNMPv1 & SNMPv2c fields + ;; + ;; community for outgoing requests. + (c-community :pointer) + ;; Length of community name. + (c-community-len c-size-type) + ;; Largest message to try to receive. + (c-rcv-msg-max-size c-size-type) + ;; Largest message to try to send. + (c-snd-msg-max-size c-size-type) + ;; + ;; SNMPv3 fields + ;; + ;; are we the authoritative engine? + (c-is-authoritative :uchar) + ;; authoritative snmpEngineID + (c-context-engine-id :pointer) + ;; Length of contextEngineID + (c-context-engine-id-len c-size-type) + ;; initial engineBoots for remote engine + (c-engine-boots :uint) + ;; initial engineTime for remote engine + (c-engine-time :uint) + ;; authoritative contextName + (c-context-name :string) + ;; Length of contextName + (c-context-name-len c-size-type) + ;; authoritative snmpEngineID + (c-security-engine-id :pointer) + ;; Length of contextEngineID + (c-security-engine-id-len c-size-type) + ;; on behalf of this principal + (c-security-name :string) + ;; Length of securityName. + (c-security-name-len c-size-type) + ;; auth protocol oid + (c-security-auth-proto :pointer) + ;; Length of auth protocol oid + (c-security-auth-proto-len c-size-type) + ;; Ku for auth protocol XXX + (c-security-auth-key :uchar :count ,+usm-auth-ku-len+) + ;; Length of Ku for auth protocol + (c-security-auth-key-len c-size-type) + ;; Kul for auth protocol + (c-security-auth-local-key :pointer) + ;; Length of Kul for auth protocol XXX + (c-security-auth-local-key-len c-size-type) + ;; priv protocol oid + (c-security-priv-proto :pointer) + ;; Length of priv protocol oid + (c-security-priv-proto-len c-size-type) + ;; Ku for privacy protocol XXX + (c-security-priv-key :uchar :count ,+usm-priv-ku-len+) + ;; Length of Ku for priv protocol + (c-security-priv-key-len c-size-type) + ;; Kul for priv protocol + (c-security-priv-local-key :pointer) + ;; Length of Kul for priv protocol XXX + (c-security-priv-local-key-len c-size-type) + ;; snmp security model, v1, v2c, usm + (c-security-model :int) + ;; noAuthNoPriv, authNoPriv, authPriv + (c-security-level :int) + ;; target param name + (c-param-name :string) + ;; + ;; security module specific + ;; + (c-security-info :pointer) + ;; + ;; use as you want data + ;; + (c-myvoid :pointer))) + +(defctype c-oid :ulong) + +(defctype c-netsnmp-vardata :pointer) + +(defmacro def-variable-list () + `(defcstruct c-variable-list + ;; NULL for last variable + (c-next-variable :pointer) + ;; Object identifier of variable + (c-name :pointer) + ;; number of subid's in name + (c-name-length c-size-type) + ;; ASN type of variable + (c-type :uchar) + ;; value of variable + (c-val c-netsnmp-vardata) + ;; the length of the value to be copied into buf + (c-val-len c-size-type) + ;; 90 percentile < 24. + (c-name-loc c-oid :count ,+max-oid-len+) + ;; 90 percentile < 40. + (c-buf :uchar :count 40) + ;; (Opaque) hook for additional data + (c-data :pointer) + ;; callback to free above + (c-data-free-hook :pointer) + (c-index :int))) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (def-snmp-session) + (def-variable-list)) + +(defctype c-netsnmp-session c-snmp-session)
1
0
0
0
← Newer
1
...
14
15
16
17
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Results per page:
10
25
50
100
200