Permalink
Browse files

external build, take 1

  • Loading branch information...
1 parent 9e93b21 commit 6a7b76a590419bcf493bb22eaf006e8373f78306 @lisp committed Feb 14, 2010
Showing with 37,577 additions and 10 deletions.
  1. +37 −0 AMQP-1-1-0-8-0/AMQP-1-1-0-8-0.asd
  2. +160 −0 AMQP-1-1-0-8-0/abstract-classes.lisp
  3. +3,594 −0 AMQP-1-1-0-8-0/classes.lisp
  4. +61 −0 AMQP-1-1-0-8-0/data-wire-coding.lisp
  5. +33 −0 AMQP-1-1-0-8-0/package.lisp
  6. +45 −0 AMQP-1-1-0-9-1/AMQP-1-1-0-9-1.asd
  7. +157 −0 AMQP-1-1-0-9-1/abstract-classes.lisp
  8. +2,057 −0 AMQP-1-1-0-9-1/classes.lisp
  9. +71 −0 AMQP-1-1-0-9-1/data-wire-coding.lisp
  10. +34 −0 AMQP-1-1-0-9-1/package.lisp
  11. +137 −10 README.md
  12. +661 −0 agpl.txt
  13. +350 −0 amqp-device.lisp
  14. +89 −0 amqp-uri.lisp
  15. +128 −0 amqp.asd
  16. +1,516 −0 classes.lisp
  17. +839 −0 commands.lisp
  18. +304 −0 conditions.lisp
  19. +1,310 −0 data-wire-coding.lisp
  20. +998 −0 device-level.lisp
  21. +62 −0 examples/examples.lisp
  22. +187 −0 extremely-simple-stream.lisp
  23. +325 −0 frames.lisp
  24. +760 −0 macros.lisp
  25. +424 −0 package.lisp
  26. +139 −0 parameters.lisp
  27. +792 −0 processing.lisp
  28. +246 −0 specification/amqp.0-10.dtd
  29. +6,652 −0 specification/amqp.0-10.xml
  30. 0 specification/amqp.dtd
  31. +3,908 −0 specification/amqp0-8.xml
  32. +2,843 −0 specification/amqp0-9-1.xml
  33. +5,185 −0 specification/amqp0-9.xml
  34. +70 −0 states.lisp
  35. +446 −0 stream.lisp
  36. +246 −0 test/AMQP-1-1-0-8-0/test.lisp
  37. +390 −0 test/AMQP-1-1-0-9-1/test.lisp
  38. +34 −0 test/amqp-uri.lisp
  39. +167 −0 test/classes.lisp
  40. +143 −0 test/data-wire-coding.lisp
  41. +166 −0 test/device-level.lisp
  42. +46 −0 test/test.asd
  43. +639 −0 test/test.lisp
  44. +585 −0 tools/spec.lisp
  45. +10 −0 tools/tools.asd
  46. +531 −0 utilities.lisp
@@ -0,0 +1,37 @@
+;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: common-lisp-user; -*-
+
+(in-package :common-lisp-user)
+
+;;; This file is the system definition for the AMQP version 0.8 elements of the 'de.setf.amqp'
+;;; library.
+;;;
+;;; Copyright 2010 [james anderson](mailto:james.anderson@setf.de) All Rights Reserved
+;;; 'de.setf.amqp' is free software: you can redistribute it and/or modify it under the terms of version 3
+;;; of the GNU Affero General Public License as published by the Free Software Foundation.
+;;;
+;;; 'setf.amqp' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
+;;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+;;; See the Affero General Public License for more details.
+;;;
+;;; A copy of the GNU Affero General Public License should be included with 'de.setf.amqp' as `AMQP:agpl.txt`.
+;;; If not, see the GNU [site](http://www.gnu.org/licenses/).
+;;;
+;;; In order to use the library, obtain its required libraries (see `../amqp.asd`), and load it as
+;;;
+;;; (asdf:operate 'asdf:load-op :de.setf.amqp.AMQP-1-1-0-8-0)
+;;;
+
+
+(asdf:defsystem :de.setf.amqp.AMQP-1-1-0-8-0
+ :serial t
+ :version 20100111.1
+ :depends-on (:de.setf.amqp)
+ :components ((:file "package")
+ (:file "data-wire-coding")
+ (:file "abstract-classes")
+ (:file "classes"))
+
+ :description
+ "This is the sub-library for AMQP/TCP 0.8r0.")
+
+
@@ -0,0 +1,160 @@
+;;; -*- Package: de.setf.amqp.implementation; -*-
+
+(in-package :de.setf.amqp.implementation)
+
+(document :file
+ (description "This file defines abstract protocol classes for AMPQ version 0.8 components of the
+ `de.setf.amqp` library.")
+ (copyright
+ "Copyright 2010 [james anderson](mailto:james.anderson@setf.de) All Rights Reserved"
+ "'de.setf.amqp' is free software: you can redistribute it and/or modify it under the terms of version 3
+ of the GNU Affero General Public License as published by the Free Software Foundation.
+
+ 'setf.amqp' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the Affero General Public License for more details.
+
+ A copy of the GNU Affero General Public License should be included with 'de.setf.amqp' as `AMQP:agpl.txt`.
+ If not, see the GNU [site](http://www.gnu.org/licenses/)."))
+
+
+(defvar amqp-1-1-0-8-0::+protocol-version+
+ '(:amqp 1 1 0 8 0)
+ "Specifies the protocol header for the highest supported version.")
+
+
+
+(defclass amqp-1-1-0-8-0::frame (amqp::frame)
+ ((input-buffer :type (simple-array (unsigned-byte 8) 8))))
+
+(defclass amqp-1-1-0-8-0::input-frame (amqp-1-1-0-8-0::frame amqp::input-frame) ())
+(defclass amqp-1-1-0-8-0::output-frame (amqp-1-1-0-8-0::frame amqp::output-frame) ())
+
+(defmethod initialize-instance ((instance amqp-1-1-0-8-0::frame)
+ &rest initargs
+ &key
+ connection
+ ;; maximum payload is frame max net both the header
+ ;; _and_ the end byte (cf. http://dev.rabbitmq.com/wiki/Amqp08To091)
+ ;; in this case, 8 byte header + 1 end byte
+ (header (make-array 8 :element-type '(unsigned-byte 8)))
+ (data (make-array (- (connection-frame-size connection) 9)
+ :element-type '(unsigned-byte 8))))
+ (declare (dynamic-extent initargs))
+ (apply #'call-next-method instance
+ :header header
+ :data data
+ initargs))
+
+
+(defclass amqp-1-1-0-8-0:object (amqp:object)
+ ((version
+ :initform '(1 1 0 8 0)
+ :allocation :class)))
+
+(defclass amqp-1-1-0-8-0:method (amqp:method)
+ ((version
+ :initform '(1 1 0 8 0)
+ :allocation :class)))
+
+(defmethod device-buffer-length ((device amqp-1-1-0-8-0:object))
+ (- (connection-frame-size device) 9))
+
+
+(defmethod device-open ((device amqp-1-1-0-8-0:object) (slot-names t) initargs)
+ (etypecase (device-state device)
+ (amqps:open-channel
+ (if (or (stream-input-handle device)
+ (stream-output-handle device))
+ (call-next-method)
+ (when (call-next-method)
+ (destructuring-bind (&key realm ticket) initargs
+ (cond ((and realm (not ticket))
+ ;; the realm comprises the realm proper + the additions arguments:
+ ;; exclusive passive active write read
+ (apply #'amqp:request-request (amqp:ensure-object device 'amqp:access
+ :realm realm)
+ realm)
+ (command-case (device)
+ (amqp:request-ok ((access amqp:access) &key ticket)
+ (setf (amqp.utility:channel-ticket device) ticket)
+ (return-from command-case device))))
+ (t
+ device))))))
+ (amqps:use-channel
+ (call-next-method))))
+
+
+(defmethod read-frame ((connection amqp-1-1-0-8-0:object) frame &rest args)
+ (declare (dynamic-extent args))
+ (apply #'read-8-byte-header-frame frame (stream-input-handle connection)
+ args))
+
+(defmethod write-frame ((connection amqp-1-1-0-8-0:object) frame &key (start 0) (end nil))
+ (let ((stream (stream-output-handle connection)))
+ (setf end (or end (frame-size frame)))
+ (write-sequence (frame-header frame) stream :start start)
+ (write-sequence (frame-data frame) stream :end end)
+ (write-sequence #(#xCE) stream)
+ (force-output stream)
+ (+ end 1 8))) ; total count
+
+
+
+(defmethod make-input-frame ((connection amqp-1-1-0-8-0:object) &rest args)
+ (declare (dynamic-extent args))
+ (apply #'make-instance 'amqp-1-1-0-8-0::input-frame
+ :connection connection
+ args))
+
+(defmethod make-output-frame ((connection amqp-1-1-0-8-0:object) &rest args)
+ (declare (dynamic-extent args))
+ (apply #'make-instance 'amqp-1-1-0-8-0::output-frame
+ :connection connection
+ args))
+
+
+
+(defmethod frame-type ((frame amqp-1-1-0-8-0::frame))
+ (buffer-unsigned-byte-8 (frame-header frame) 0))
+
+(defmethod frame-type-class-name ((frame amqp-1-1-0-8-0::frame))
+ (ecase (frame-type frame)
+ (1 'amqp:method)
+ (2 'amqp:header)
+ (3 'amqp:body)
+ (4 'amqp:oob-method)
+ (5 'amqp:oob-header)
+ (6 'amqp:oob-body)
+ (7 'amqp:trace)
+ (8 'amqp:heartbeat)))
+
+(defmethod setf-frame-type-class-name (name (frame amqp-1-1-0-8-0::frame))
+ (setf (buffer-unsigned-byte-8 (frame-header frame) 0)
+ (ecase name
+ (amqp:method 1)
+ (amqp:header 2)
+ (amqp:body 3)
+ (amqp:oob-method 4)
+ (amqp:oob-header 5)
+ (amqp:oob-body 6)
+ (amqp:trace 7)
+ (amqp:heartbeat 8))))
+
+(defmethod frame-cycle ((frame amqp-1-1-0-8-0::frame))
+ (buffer-unsigned-byte-8 (frame-header frame) 1))
+
+(defmethod frame-channel ((frame amqp-1-1-0-8-0::frame))
+ (buffer-unsigned-byte-16 (frame-header frame) 2))
+
+(defmethod frame-track ((frame amqp-1-1-0-8-0::frame))
+ 0)
+
+(defmethod frame-size ((frame amqp-1-1-0-8-0::frame))
+ (buffer-unsigned-byte-32 (frame-header frame) 4))
+
+(defmethod frame-class-code ((frame amqp-1-1-0-8-0::frame))
+ (buffer-unsigned-byte-16 (frame-data frame) 0))
+
+(defmethod frame-method-code ((frame amqp-1-1-0-8-0::frame))
+ (buffer-unsigned-byte-16 (frame-data frame) 2))
Oops, something went wrong.

0 comments on commit 6a7b76a

Please sign in to comment.