Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 70 lines (62 sloc) 3.04 kB
6a7b76a @lisp external build, take 1
authored
1 ;;; -*- Package: de.setf.amqp.implementation; -*-
2
3 (in-package :de.setf.amqp.implementation)
4
c2728ca @lisp renaming protocol directories, phase one
authored
5 (:documentation "This file defines the state model for AMQP classes for the 'de.setf.amqp' library."
6a7b76a @lisp external build, take 1
authored
6 (copyright
7 "Copyright 2010 [james anderson](mailto:james.anderson@setf.de) All Rights Reserved"
8 "'de.setf.amqp' is free software: you can redistribute it and/or modify it under the terms of version 3
9 of the GNU Affero General Public License as published by the Free Software Foundation.
10
11 'setf.amqp' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the Affero General Public License for more details.
14
15 A copy of the GNU Affero General Public License should be included with 'de.setf.amqp' as `AMQP:agpl.txt`.
16 If not, see the GNU [site](http://www.gnu.org/licenses/)."))
17
18
19 ;;;
20 ;;; states
21
22 (macrolet ((defstate (name supers slots &rest options)
23 (setf name (intern (string name) :de.setf.amqp-state))
24 (setf supers (or (mapcar #'(lambda (s) (intern (string s) :de.setf.amqp-state)) supers)
25 (unless (eq name 'amqp.s:state) '(de.setf.amqp-state:state))))
26 `(prog1 (defclass ,name ,supers ,slots ,@options)
27 (eval-when (:compile-toplevel :load-toplevel :execute)
28 (export ',name :de.setf.amqp-state))
29 (defparameter ,name (make-instance ',name))))
30 (defstates (&rest states)
31 `(progn ,@(loop for state in states
32 collect (etypecase state
33 (symbol
34 `(defstate ,state () ()))
35 (cons
36 (destructuring-bind (name supers &optional slots &rest options) state
37 `(defstate ,name ,supers ,slots ,@options ))))))))
38 (defstates
39 state
40 connection-state
41 channel-state
42 open
43 (open-connection (open connection-state))
44 (open-connection.start (open-connection))
45 (open-connection.secure (open-connection))
46 (open-connection.tune (open-connection))
47 (open-connection.host (open-connection))
48 (open-channel (open channel-state))
49 use
50 (use-connection (use connection-state))
51 (use-channel (use channel-state))
52 body
53 input
54 output
55 chunked
56 (use-channel.body (use-channel body))
57 (use-channel.body.input (use-channel.body input))
58 (use-channel.body.input.chunked (chunked use-channel.body.input))
59 (use-channel.body.output (use-channel.body output))
60 (use-channel.body.output.chunked (chunked use-channel.body.output))
61 method
62 (use-channel.method (use-channel method))
63 header
64 (use-channel.header (use-channel header))
65 heartbeat
66 (use-channel.heartbeat (use-channel heartbeat))
67 close
68 (close-connection (close connection-state))
69 (close-channel (close channel-state))))
Something went wrong with that request. Please try again.