Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some initial support for various draft options #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 6 additions & 87 deletions c-api.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Report ØMQ library version."
(mapcar (lambda (ptr) (mem-ref ptr :int))
(list major minor patch))))

(defcfun ("zmq_has" has) :boolean
"Report whether a specified capability is available in the library."
(name :string))

;;; Error

(defcfun ("zmq_errno" %errno) :int
Expand Down Expand Up @@ -325,92 +329,6 @@ Low-level API. Consider using @fun{WITH-MESSAGE}."
"Close ØMQ socket."
(socket :pointer))

(defcenum socket-options
(:affinity 4)
(:identity 5) ; deprecated by :routing-id
(:routing-id 5)
(:subscribe 6)
(:unsubscribe 7)
(:rate 8)
(:recovery-ivl 9)
(:sndbuf 11)
(:rcvbuf 12)
(:rcvmore 13)
(:fd 14)
(:events 15)
(:type 16)
(:linger 17)
(:reconnect-ivl 18)
(:backlog 19)
(:reconnect-ivl-max 21)
(:maxmsgsize 22)
(:sndhwm 23)
(:rcvhwm 24)
(:multicast-hops 25)
(:rcvtimeo 27)
(:sndtimeo 28)
(:ipv4only 31) ; deprecated by :ipv6
(:last-endpoint 32)
(:router-behavior 33) ; deprecated by :router-mandatory
(:router-mandatory 33)
(:tcp-keepalive 34)
(:tcp-keepalive-cnt 35)
(:tcp-keepalive-idle 36)
(:tcp-keepalive-intvl 37)
(:tcp-accept-filter 38) ; deprecated
(:delay-attach-on-connect 39) ; deprecated by :immediate
(:immediate 39)
(:xpub-verbose 40)
(:router-raw 41)
(:ipv6 42)
(:mechanism 43)
(:plain-server 44)
(:plain-username 45)
(:plain-password 46)
(:curve-server 47)
(:curve-publickey 48)
(:curve-secretkey 49)
(:curve-serverkey 50)
(:probe-router 51)
(:req-correlate 52)
(:req-relaxed 53)
(:conflate 54)
(:zap-domain 55)
(:router-handover 56)
(:tos 57)
(:ipc-filter-pid 58) ; deprecated
(:ipc-filter-uid 59) ; deprecated
(:ipc-filter-gid 60) ; deprecated
(:connect-routing-id 61)
(:gssapi-server 62)
(:gssapi-principal 63)
(:gssapi-service-principal 64)
(:gssapi-plaintext 65)
(:handshake-ivl 66)
(:socks-proxy 68)
(:xpub-nodrop 69)
(:blocky 70)
(:xpub-manual 71)
(:xpub-welcome-msg 72)
(:stream-notify 73)
(:invert-matching 74)
(:heartbeat-ivl 75)
(:heartbeat-ttl 76)
(:heartbeat-timeout 77)
(:xpub-verboser 78)
(:connect-timeout 79)
(:tcp-maxrt 80)
(:thread-safe 81)
(:multicast-maxtpdu 84)
(:vmci-buffer-size 85)
(:vmci-buffer-min-size 86)
(:vmci-buffer-max-size 87)
(:vmci-connect-timeout 88)
(:use-fd 89)
(:gssapi-principal-nametype 90)
(:gssapi-service-principal-nametype 91)
(:bindtodevice 92))

(defcfun ("zmq_getsockopt" %getsockopt) :int
"Get ØMQ socket options."
(socket :pointer)
Expand Down Expand Up @@ -487,7 +405,8 @@ Binary options are supported either as strings or UB8 vectors."
((:subscribe :unsubscribe :identity :tcp-accept-filter
:plain-username :plain-password
:curve-publickey :curve-secretkey
:curve-serverkey :zap-domain)
:curve-serverkey :zap-domain
:disconnect-msg :hello-msg :hiccup-msg :xpub-welcome-msg)
(etypecase option-value
(null
(call (null-pointer) 0))
Expand Down
225 changes: 225 additions & 0 deletions grovel.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(in-package #:pzmq)
(define "ZMQ_BUILD_DRAFT_API")
(include "zmq.h")
(ctype size "size_t")
(cstruct %msg "zmq_msg_t")
Expand Down Expand Up @@ -31,3 +32,227 @@
((:enotsup "ENOTSUP"))
((:eprotonosupport "EPROTONOSUPPORT"))
((:eterm "ETERM")))

(constantenum
socket-options
((:affinity "ZMQ_AFFINITY")
:documentation "I/O thread affinity")
((:backblock "ZMQ_BACKLOG")
:documentation "Maximum length of the queue of outstanding connections")
((:bindtodevice "ZMQ_BINDTODEVICE")
:documentation "Name of device to bind the socket to")
((:busy-poll "ZMQ_BUSY_POLL")
:documentation "Removes delays caused by the interrupt and the resultant context
switch.")
((:connect-routing-id "ZMQ_CONNECT_ROUTING_ID")
:documentation "Assign the next outbound connection id")
((:conflate "ZMQ_CONFLATE")
:documentation "Keep only last message")
((:connect-timeout "ZMQ_CONNECT_TIMEOUT")
:documentation "Set connect() timeout")
((:curve-publickey "ZMQ_CURVE_PUBLICKEY")
:documentation "CURVE public key")
((:curve-secretkey "ZMQ_CURVE_SECRETKEY")
:documentation "CURVE secret key")
((:curve-server "ZMQ_CURVE_SERVER")
:documentation "CURVE server rol")
((:curve-serverkey "ZMQ_CURVE_SERVERKEY")
:documentation "CURVE server key")
((:events "ZMQ_EVENTS")
:documentation "Socket event state")
((:fd "ZMQ_FD")
:documentation "File descriptor associated with the socket")
((:disconnect-msg "ZMQ_DISCONNECT_MSG")
:documentation "A disconnect message that the socket will generate when accepted peer
disconnect")
((:hiccup-msg "ZMQ_HICCUP_MSG")
:documentation "A hiccup message that the socket will generate when connected peer
temporarily disconnect")
((:gssapi-plaintext "ZMQ_GSSAPI_PLAINTEXT")
:documentation "Disable GSSAPI encryption")
((:gssapi-principal "ZMQ_GSSAPI_PRINCIPAL")
:documentation "Name of GSSAPI principal")
((:gssapi-server "ZMQ_GSSAPI_SERVER")
:documentation "GSSAPI server role")
((:gssapi-service-principal "ZMQ_GSSAPI_SERVICE_PRINCIPAL")
:documentation "Name of GSSAPI service principal")
((:gssapi-service-principal-nametype "ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE")
:documentation "Name type of service principal")
((:gssapi-principal-nametype "ZMQ_GSSAPI_PRINCIPAL_NAMETYPE")
:documentation "Name type of principal")
((:handshake-ivl "ZMQ_HANDSHAKE_IVL")
:documentation "Maximum handshake interval")
((:hello-msg "ZMQ_HELLO_MSG")
:documentation "A hello message that will be sent when a new peer connect")
((:heartbeat-ivl "ZMQ_HEARTBEAT_IVL")
:documentation "Interval between sending ZMTP heartbeats")
((:heartbeat-timeout "ZMQ_HEARTBEAT_TIMEOUT")
:documentation "Timeout for ZMTP heartbeats")
((:heartbeat-ttl "ZMQ_HEARTBEAT_TTL")
:documentation "The TTL value for ZMTP heartbeats")
((:identity "ZMQ_IDENTITY")
:documentation "Socket identity. This option name is now deprecated. Use :ROUTING-ID
instead")
((:immediate "ZMQ_IMMEDIATE")
:documentation "Queue messages only to completed connections")
((:invert-matching "ZMQ_INVERT_MATCHING")
:documentation "Invert message filtering")
((:ipv6 "ZMQ_IPV6")
:documentation "Enable IPv6 on socket")
((:last-endpoint "ZMQ_LAST_ENDPOINT")
:documentation "The last endpoint set")
((:linger "ZMQ_LINGER")
:documentation "Set linger period for socket shutdown")
((:mechanism "ZMQ_MECHANISM")
:documentation "Current security mechanism")
((:maxmsgsize "ZMQ_MAXMSGSIZE")
:documentation "Maximum acceptable inbound message size")
((:metadata "ZMQ_METADATA")
:documentation "Add application metadata properties to a socket")
((:multicast-hops "ZMQ_MULTICAST_HOPS")
:documentation "Maximum network hops for multicast packets")
((:multicast-maxtpdu "ZMQ_MULTICAST_MAXTPDU")
:documentation "Maximum transport data unit size for multicast packets")
((:plain-password "ZMQ_PLAIN_PASSWORD")
:documentation "PLAIN security password")
((:plain-server "ZMQ_PLAIN_SERVER")
:documentation "PLAIN server role")
((:plain-username "ZMQ_PLAIN_USERNAME")
:documentation "PLAIN security username")
((:use-fd "ZMQ_USE_FD")
:documentation "The pre-allocated socket file descriptor")
((:priority "ZMQ_PRIORITY")
:documentation "The Priority on socket")
((:probe-router "ZMQ_PROBE_ROUTER")
:documentation "Bootstrap connections to ROUTER sockets")
((:rate "ZMQ_RATE")
:documentation "Multicast data rate")
((:rcvbuf "ZMQ_RCVBUF")
:documentation "Kernel receive buffer size")
((:rcvhwm "ZMQ_RCVHWM")
:documentation "High water mark for inbound messages")
((:rcvmore "ZMQ_RCVMORE")
:documentation "More message data parts to follow")
((:rcvtimeo "ZMQ_RCVTIMEO")
:documentation "Maximum time before a recv operation returns with EAGAIN")
((:reconnect-ivl "ZMQ_RECONNECT_IVL")
:documentation "Reconnection interval")
((:reconnect-ivl-max "ZMQ_RECONNECT_IVL_MAX")
:documentation "Max reconnection interval")
((:reconnect-stop "ZMQ_RECONNECT_STOP")
:documentation "Condition where reconnection will stop")
((:recovery-ivl "ZMQ_RECOVERY_IVL")
:documentation "Multicast recovery interval")
((:req-correlate "ZMQ_REQ_CORRELATE")
:documentation "match replies with requests")
((:req-relaxed "ZMQ_REQ_RELAXED")
:documentation "relax strict alternation between request and reply")
((:router-handover "ZMQ_ROUTER_HANDOVER")
:documentation "handle duplicate client routing ids on ROUTER")
((:router-mandatory "ZMQ_ROUTER_MANDATORY")
:documentation "accept only routable messages on ROUTER sockets")
((:router-raw "ZMQ_ROUTER_RAW")
:documentation "switch ROUTER socket to raw mode")
((:routing-id "ZMQ_ROUTING_ID")
:documentation "socket routing id")
((:sndbuf "ZMQ_SNDBUF")
:documentation "kernel transmit buffer size")
((:sndhwm "ZMQ_SNDHWM")
:documentation "high water mark for outbound messages")
((:sndtimeo "ZMQ_SNDTIMEO")
:documentation "Maximum time before a send operation returns with EAGAIN")
((:socks-proxy "ZMQ_SOCKS_PROXY")
:documentation "SOCKS5 proxy address")
((:socks-username "ZMQ_SOCKS_USERNAME")
:documentation "SOCKS username and select basic authentication")
((:socks-password "ZMQ_SOCKS_PASSWORD")
:documentation "SOCKS basic authentication password")
((:stream-notify "ZMQ_STREAM_NOTIFY")
:documentation "send connect and disconnect notifications")
((:subscribe "ZMQ_SUBSCRIBE")
:documentation "Establish message filter")
((:tcp-keepalive "ZMQ_TCP_KEEPALIVE")
:documentation "Override SO_KEEPALIVE socket option")
((:tcp-keepalive-cnt "ZMQ_TCP_KEEPALIVE_CNT")
:documentation "Override TCP_KEEPCNT socket option")
((:tcp-keepalive-idle "ZMQ_TCP_KEEPALIVE_IDLE")
:documentation "Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)")
((:tcp-keepalive-intvl "ZMQ_TCP_KEEPALIVE_INTVL")
:documentation "Override TCP_KEEPINTVL socket option")
((:tcp-maxrt "ZMQ_TCP_MAXRT")
:documentation "TCP Maximum Retransmit Timeout")
((:thread-safer "ZMQ_THREAD_SAFE")
:documentation "Socket thread safety")
((:tos "ZMQ_TOS")
:documentation "Type-of-Service on socket")
((:type "ZMQ_TYPE")
:documentation "Socket type")
((:unsubscribe "ZMQ_UNSUBSCRIBE")
:documentation "Remove message filter")
((:xpub-verbose "ZMQ_XPUB_VERBOSE")
:documentation "pass duplicate subscribe messages on XPUB socket")
((:xpub-verboser "ZMQ_XPUB_VERBOSER")
:documentation "pass duplicate subscribe and unsubscribe messages on XPUB socket")
((:xpub-manual "ZMQ_XPUB_MANUAL")
:documentation "change the subscription handling to manual")
((:xpub-manual-last-value "ZMQ_XPUB_MANUAL_LAST_VALUE")
:documentation "change the subscription handling to manual")
((:xpub-nodrop "ZMQ_XPUB_NODROP")
:documentation "do not silently drop messages if SENDHWM is reached")
((:xpub-welcome-msg "ZMQ_XPUB_WELCOME_MSG")
:documentation "set welcome message that will be received by subscriber when
connecting")
((:xsub-verbose-unsubscribe "ZMQ_XSUB_VERBOSE_UNSUBSCRIBE")
:documentation "pass duplicate unsubscribe messages on XSUB socket")
((:only-first-subscribe "ZMQ_ONLY_FIRST_SUBSCRIBE")
:documentation "Process only first subscribe/unsubscribe in a multipart message")
((:zap-domain "ZMQ_ZAP_DOMAIN")
:documentation "RFC 27 authentication domain")
((:zap-enforce-domain "ZMQ_ZAP_ENFORCE_DOMAIN")
:documentation "ZAP domain handling to strictly adhere the RFC")
((:tcp-accept-filter "ZMQ_TCP_ACCEPT_FILTER")
:documentation "Assign filters to allow new TCP connections. This option is
deprecated, please use authentication via the ZAP API and IP address
allowing / blocking.")
((:ipc-filter-gid "ZMQ_IPC_FILTER_GID")
:documentation "Assign group ID filters to allow new IPC connections")
((:ipc-filter-pid "ZMQ_IPC_FILTER_PID")
:documentation "Assign process ID filters to allow new IPC connections")
((:ipc-filter-uid "ZMQ_IPC_FILTER_UID")
:documentation "Assign user ID filters to allow new IPC connections")
((:ipv4only "ZMQ_IPV4ONLY")
:documentation "Use IPv4-only on socket. This option is deprecated. Please use the
:IPV6 option.")
((:vmci-buffer-size "ZMQ_VMCI_BUFFER_SIZE")
:documentation "Set buffer size of the VMCI socket")
((:vmci-buffer-min-size "ZMQ_VMCI_BUFFER_MIN_SIZE")
:documentation "Set min buffer size of the VMCI socket")
((:vmci-buffer-max-size "ZMQ_VMCI_BUFFER_MAX_SIZE")
:documentation "Set max buffer size of the VMCI socket")
((:vmci-connect-timeout "ZMQ_VMCI_CONNECT_TIMEOUT")
:documentation "Set connection timeout of the VMCI socket")
((:multicast-loop "ZMQ_MULTICAST_LOOP")
:documentation "Control multicast local loopback ZMQ_RADIO, when using UDP multicast
transport")
((:router-notify "ZMQ_ROUTER_NOTIFY")
:documentation "Send connect and disconnect notifications")
((:in-batch-size "ZMQ_IN_BATCH_SIZE")
:documentation "Maximal receive batch size")
((:out-batch-size "ZMQ_OUT_BATCH_SIZE")
:documentation "Maximal send batch size")
((:norm-mode "ZMQ_NORM_MODE")
:documentation "NORM Sender Mode")
((:norm-unicast-nack "ZMQ_NORM_UNICAST_NACK")
:documentation "Set NORM Unicast NACK mode")
((:norm-buffer-size "ZMQ_NORM_BUFFER_SIZE")
:documentation "Set NORM buffer size")
((:norm-segment-size "ZMQ_NORM_SEGMENT_SIZE")
:documentation "Set NORM segment size")
((:norm-block-size "ZMQ_NORM_BLOCK_SIZE")
:documentation "Set NORM block size")
((:norm-num-parity "ZMQ_NORM_NUM_PARITY")
:documentation "Set number of NORM parity segments")
((:norm-num-autoparity "ZMQ_NORM_NUM_AUTOPARITY")
:documentation "Set number of proactive NORM parity segments")
((:norm-push "ZMQ_NORM_PUSH")
:documentation "Enable NORM push mode"))
1 change: 1 addition & 0 deletions package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Consult @a[http://api.zeromq.org/4-0:zmq]{official C API reference} first.
;; C API:
;; - misc
#:version
#:has
;; - error
#:errno
#:strerror
Expand Down