1 ;; Copyright (c) 2009, 2010 Vitaly Mayatskikh <v.mayatskih@gmail.com>
3 ;; This file is part of CL-ZMQ.
5 ;; Vitaly Mayatskikh grants you the rights to distribute
6 ;; and use this software as governed by the terms
7 ;; of the Lisp Lesser GNU Public License
8 ;; (http://opensource.franz.com/preamble.html),
13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 (defconstant hausnumero
156384712)
19 ;; Native 0MQ error codes.
20 (defconstant emthread
(+ hausnumero
50))
21 (defconstant efsm
(+ hausnumero
51))
22 (defconstant enocompatproto
(+ hausnumero
52))
24 (defcfun ("zmq_strerror" %strerror
) :pointer
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;; 0MQ message definition.
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
31 (defconstant max-vsm-size
30)
33 ;; Message types. These integers may be stored in 'content' member of the
34 ;; message instead of regular pointer to the data.
35 (defconstant delimiter
31)
38 ;; Message flags. ZMQ_MSG_SHARED is strictly speaking not a message flag
39 ;; (it has no equivalent in the wire format), however, making it a flag
40 ;; allows us to pack the stucture tigher and thus improve performance.
41 (defconstant msg-more
1)
42 (defconstant msg-shared
128)
48 (vsm-data :uchar
:count
30)) ;; FIXME max-vsm-size
50 (defcfun ("zmq_msg_init" msg-init
) :int
53 (defcfun* ("zmq_msg_init_size" %msg-init-size
) :int
57 (defcallback zmq-free
:void
((ptr :pointer
) (hint :pointer
))
58 (declare (ignorable hint
))
61 (defcfun ("zmq_msg_init_data" msg-init-data
) :int
65 (ffn :pointer
) ; zmq_free_fn
68 (defcfun* ("zmq_msg_close" %msg-close
) :int
71 (defcfun ("zmq_msg_move" %msg-move
) :int
75 (defcfun ("zmq_msg_copy" %msg-copy
) :int
79 (defcfun ("zmq_msg_data" %msg-data
) :pointer
82 (defcfun ("zmq_msg_size" %msg-size
) :int
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
86 ;; 0MQ infrastructure (a.k.a. context) initialisation & termination.
87 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
89 (defcfun* ("zmq_init" init
) :pointer
92 (defcfun ("zmq_term" term
) :int
95 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
96 ;; 0MQ socket definition.
97 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
108 (defconstant upstream pull
)
109 (defconstant downstream push
)
113 (defconstant affinity
4)
114 (defconstant identity
5)
115 (defconstant subscribe
6)
116 (defconstant unsubscribe
7)
118 (defconstant recovery-ivl
9)
119 (defconstant mcast-loop
10)
120 (defconstant sndbuf
11)
121 (defconstant rcvbuf
12)
122 (defconstant rcvmore
13)
124 (defconstant noblock
1)
125 (defconstant sndmore
2)
127 (defcfun* ("zmq_socket" socket
) :pointer
131 (defcfun ("zmq_close" close
) :int
134 (defcfun* ("zmq_setsockopt" %setsockopt
) :int
140 (defcfun* ("zmq_getsockopt" %getsockopt
) :int
144 (optvallen :pointer
))
146 (defcfun* ("zmq_bind" %bind
) :int
148 (addr :pointer
:char
))
150 (defcfun* ("zmq_connect" %connect
) :int
152 (addr :pointer
:char
))
155 (defcfun* ("zmq_send" %send
) :int
161 (defcfun* ("zmq_recv" %recv
) :int
167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
169 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
171 (defconstant pollin
1)
172 (defconstant pollout
2)
173 (defconstant pollerr
4)
181 (defcfun ("zmq_poll" %poll
) :int
186 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
188 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
190 (defcfun ("zmq_version" %version
) :void
195 (defcfun ("zmq_errno" errno
) :int
)
197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
199 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
201 (defconstant streamer
1)
202 (defconstant forwarder
2)
203 (defconstant queue
3)
205 (defcfun* ("zmq_device" %device
) :int
208 (outsocket :pointer
))