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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106 (defconstant upstream
7)
107 (defconstant downstream
8)
111 (defconstant affinity
4)
112 (defconstant identity
5)
113 (defconstant subscribe
6)
114 (defconstant unsubscribe
7)
116 (defconstant recovery-ivl
9)
117 (defconstant mcast-loop
10)
118 (defconstant sndbuf
11)
119 (defconstant rcvbuf
12)
120 (defconstant rcvmore
13)
122 (defconstant noblock
1)
123 (defconstant sndmore
2)
125 (defcfun* ("zmq_socket" socket
) :pointer
129 (defcfun ("zmq_close" close
) :int
132 (defcfun* ("zmq_setsockopt" %setsockopt
) :int
138 (defcfun* ("zmq_getsockopt" %getsockopt
) :int
142 (optvallen :pointer
))
144 (defcfun* ("zmq_bind" %bind
) :int
146 (addr :pointer
:char
))
148 (defcfun* ("zmq_connect" %connect
) :int
150 (addr :pointer
:char
))
153 (defcfun* ("zmq_send" %send
) :int
159 (defcfun* ("zmq_recv" %recv
) :int
165 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
169 (defconstant pollin
1)
170 (defconstant pollout
2)
171 (defconstant pollerr
4)
179 (defcfun ("zmq_poll" %poll
) :int
184 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
186 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
188 (defcfun ("zmq_version" %version
) :void
193 (defcfun ("zmq_errno" errno
) :int
)
195 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
199 (defconstant streamer
1)
200 (defconstant forwarder
2)
201 (defconstant queue
3)
203 (defcfun* ("zmq_device" %device
) :int
206 (outsocket :pointer
))