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 (defcfun ("memcpy" %memcpy
) :pointer
22 (defcfun ("zmq_version" %version
) :void
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
31 (defcfun ("zmq_errno" %errno
) :int
)
33 (defcfun ("zmq_strerror" %strerror
) :pointer
36 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 ;; 0MQ data structures
38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40 (defctype c-context
:pointer
)
42 (defctype c-socket
:pointer
)
47 (defcstruct c-pollitem
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57 (defcfun ("zmq_ctx_new" ctx-new
) c-context
)
59 (defcfun ("zmq_ctx_get" %ctx-get
) :int
63 (defcfun ("zmq_ctx_set" %ctx-set
) :int
68 (defcfun ("zmq_ctx_destroy" ctx-destroy
) :int
71 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
75 (defcfun ("zmq_socket" socket
) c-socket
79 (defcfun ("zmq_close" close
) :int
82 (defcfun ("zmq_getsockopt" %getsockopt
) :int
85 (option-value :pointer
)
86 (option-len :pointer
))
88 (defcfun ("zmq_setsockopt" %setsockopt
) :int
91 (option-value :pointer
)
94 (defcfun ("zmq_bind" %bind
) :int
96 (endpoint :pointer
:char
))
98 (defcfun ("zmq_unbind" %unbind
) :int
100 (endpoint :pointer
:char
))
102 (defcfun ("zmq_connect" %connect
) :int
104 (endpoint :pointer
:char
))
106 (defcfun ("zmq_disconnect" %disconnect
) :int
108 (endpoint :pointer
:char
))
110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
111 ;; 0MQ message definition.
112 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
114 (defcfun ("zmq_msg_init" %msg-init
) :int
117 (defcfun ("zmq_msg_init_size" %msg-init-size
) :int
121 ;; This currently won't work properly for the reasons defined here
122 ;; http://13-49.blogspot.fi/2010/06/why-zero-copy-is-missing-in-cl-zmq.html
123 ;; Don't use it unless you know what you are doing.
124 (defcallback zmq-free
:void
((ptr :pointer
) (hint :pointer
))
125 (declare (ignorable hint
))
128 (defcfun ("zmq_msg_init_data" %%msg-init-data
) :int
135 (defun %zmq-init-data
(msg data size
)
136 (%%msg-init-data msg data size
'zmq-free
))
137 ;; End of non-functional code
139 (defcfun ("zmq_msg_close" %msg-close
) :int
142 (defcfun ("zmq_msg_move" %msg-move
) :int
146 (defcfun ("zmq_msg_copy" %msg-copy
) :int
150 (defcfun ("zmq_msg_data" %msg-data
) :pointer
153 (defcfun ("zmq_msg_size" %msg-size
) :int
156 (defcfun ("zmq_msg_get" %msg-get
) :int
160 (defcfun ("zmq_msg_set" %msg-set
) :int
165 (defcfun ("zmq_msg_more" %msg-more
) :int
168 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
170 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
172 (defcfun ("zmq_send" %send
) :int
178 (defcfun ("zmq_recv" %recv
) :int
184 (defcfun ("zmq_msg_send" %msg-send
) :int
189 (defcfun ("zmq_msg_recv" %msg-recv
) :int
194 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
196 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
198 (defcfun ("zmq_poll" %poll
) :int
203 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
205 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
207 (defcfun ("zmq_proxy" proxy
) :int