ATSLIB/contrib/zeromq/zmq
This package contains an API for programming zeromq in ATS.
Synopsis
fun zmq_ctx_new (): zmqctx0 = "mac#%"
Synopsis
fun zmq_ctx_destroy
{l:agz} (
ctx: !zmqctx (l) >> zmqctxopt (l, i < 0)
) : #[i:int | i <= 0] int (i) = "mac#%"
Synopsis
fun zmq_ctx_destroy_exn (ctx: zmqctx1): void
Synopsis
fun zmq_ctx_get
(ctx: !zmqctx1, name: int): int = "mac#%"
Description
If successful, this function returns the value of the context option
named by its second argument.Return Value
The function returns a non-negative integer if successful, or it returns -1.
Synopsis
fun zmq_ctx_set
(ctx: !zmqctx1, name: int, value: int): int = "mac#%"
Description
If successful, this function sets the context option named to by its second
argument with the value given as its third argument. Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun zmq_socket
(ctx: !zmqctx1, type: int): zmqsock0 = "mac#%"
Description
This function creates a zeromq socket within the specified context and
returns an opaque handle to the newly created socket. Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun zmq_socket_exn (ctx: !zmqctx1, type: int): zmqsock1
Description
This function is the exit version of zmq_socket. After calling
zmq_socket, it returns if there is no error, or it exits
abnormally.
Synopsis
fun
zmq_getsockopt
{a:t@ype} (
sock: !zmqsock1
, name: zmqsockopt(a), value: ptr, len: &size_t >> _
) : interr = "mac#%"
Description
This function gets the value of a zmq-socket option.Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun
zmq_getsockopt2
{a:t@ype} (
sock: !zmqsock1
, name: zmqsockopt(a), value: &(a)? >> a, len: &sizeof_t(a) >> _
) : interr = "mac#%"
Description
This function does the same as zmq_getsockopt but is given a
more accurate type. Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun
zmq_setsockopt
{a:t@ype} (
sock: !zmqsock1, name: zmqsockopt(a), value: ptr, len: size_t
) : interr = "mac#%"
Description
This function sets a zmq-socket option with a given value.Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun zmq_bind (
sock: !zmqsock1, endpt: NSH(string)
) : interr = "mac#%"
Synopsis
fun zmq_bind_exn
(sock: !zmqsock1, endpt: NSH(string)): void
Description
This function is the exit version of zmq_bind. After
calling zmq_bind, it returns if there is no error, or it
exits abnormally.
Synopsis
fun zmq_close
(sock: zmqsock1): interr = "mac#%"
Synopsis
fun
zmq_send
{m:int}{n:int | n <= m}
(
sock: !zmqsock1, buf: &(@[byte][m]), len: size_t (n), flags: int
) : int = "mac#%"
Synopsis
fun
zmq_recv
{m:int}{n:int | n <= m}
(
sock: !zmqsock1, buf: &(@[byte][m]), len: size_t (n), flags: int
) : int = "mac#%"
Synopsis
fun
zmq_connect
(
sock: !zmqsock1, endpt: NSH(string)
) : interr = "mac#%"
Description
This function creates an outgoing connection from a given socket by
connecting the socket to a given endpoint and then accepts incoming
connections on that endpoint. Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun
zmq_connect_exn
(sock: !zmqsock1, endpt: NSH(string)): void
Description
This function is the exit version of zmq_connect. After
calling zmq_connect, it returns if there is no error, or it
exits abnormally.
Synopsis
fun
zmq_disconnect
(
sock: !zmqsock1, endpt: NSH(string)
) : interr = "mac#%"
Description
This function disconnects a given socket from a given endpoint. Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun
zmq_disconnect_exn
(sock: !zmqsock1, endpt: NSH(string)): void
Description
This function is the exit version of zmq_disconnect. After
calling zmq_disconnect, it returns if there is no error, or it
exits abnormally.
Synopsis
fun zmq_msg_size (msg: &zmqmsg):<> size_t = "mac#%"
Synopsis
fun zmq_msg_data (msg: &zmqmsg):<> Ptr1 = "mac#%"
Synopsis
fun zmq_msg_more (msg: &zmqmsg):<> natLt(2) = "mac#%"
Description
This function returns an integer indicating whether the given message is
part of a multi-part message or there are further parts to receive.
Synopsis
fun zmq_msg_get
(msg: &zmqmsg, property: int): int = "mac#%"
Description
If successful, this function returns the value of the message property
referred to by its second argument.Return Value
The function returns a non-negative integer if successful, or it returns -1.
Synopsis
fun
zmq_msg_set
(
msg: &zmqmsg >> _, property: int, value: int
) : interr = "mac#%"
Description
If successful, this function sets the message property referred to by its
second argument with the value given as its third argument. Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun zmq_msg_init
(
msg: &zmqmsg? >> opt (zmqmsg, i==0)
) : #[i:int | i <= 0] int (i) = "mac#%"
Synopsis
fun zmq_msg_init_exn (msg: &zmqmsg? >> _): void
Description
This function is the exit version of zmq_msg_init.
Synopsis
fun
zmq_msg_init_size
(
msg: &zmqmsg? >> opt (zmqmsg, i==0), n: size_t
) : #[i:int | i <= 0] int (i) = "mac#%"
Synopsis
fun
zmq_msg_init_size_exn (msg: &zmqmsg? >> _, n: size_t): void
Description
This function is the exit version of zmq_msg_init_size.
Synopsis
fun
zmq_msg_init_data
(
msg: &zmqmsg? >> opt (zmqmsg, i==0)
, data: ptr, size: size_t, ffn: zmq_free_fn, hint: ptr
) : #[i:int | i <= 0] int (i) = "mac#%"
Synopsis
fun
zmq_msg_init_data_exn
(
msg: &zmqmsg? >> _
, data: ptr, size: size_t, ffn: zmq_free_fn, hint: ptr
) : void
Description
This function is the exit version of zmq_msg_init_data.
Synopsis
fun zmq_msg_close
(
msg: &zmqmsg >> opt(zmqmsg, i < 0)
) : #[i:int | i <= 0] int (i) = "mac#%"
Description
This function releases the resource held in a zmq-message.
Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun zmq_msg_close_exn (msg: &zmqmsg >> _?): void
Description
This function is the exit version of zmq_msg_close.
Synopsis
fun
zmq_msg_copy
(dst: &zmqmsg >> _, src: &zmqmsg): interr = "mac#%"
Synopsis
fun
zmq_msg_copy_exn (dst: &zmqmsg >> _, src: &zmqmsg): void
Description
This function is the exit version of zmq_msg_copy.
Synopsis
fun zmq_msg_move
(dst: &zmqmsg >> _, src: &zmqmsg): interr = "mac#%"
Synopsis
fun zmq_msg_move_exn (dst: &zmqmsg >> _, src: &zmqmsg): void
Description
This function is the exit version of zmq_msg_move.
Synopsis
fun zmq_msg_send (
msg: &zmqmsg, sock: !zmqsock1, flags: int
) : interr = "mac#%"
Description
This function sends a massage part from a given socket and returns the
number of bytes of the massage sent if successful or -1 instead.
Synopsis
fun zmq_msg_send_exn
(msg: &zmqmsg, sock: !zmqsock1, flags: int): intGte(0)
Description
This function is the exit version of zmq_msg_send.Return Value
The function returns a nonnegative integer indicating the size of the
sent message.
Synopsis
fun
zmq_msg_recv
(
msg: &zmqmsg >> _, sock: !zmqsock1, flags: int
) : interr = "mac#%"
Description
This function recieves a massage part from a given socket and returns the
number of bytes of the received massage if successful or -1 instead.
Synopsis
fun
zmq_msg_recv_exn
(
msg: &zmqmsg >> _, sock: !zmqsock1, flags: int
) : intGte(0)
Description
This function is the exit version of zmq_msg_recv.Return Value
The function returns a nonnegative integer indicating the size of the
received message.
Synopsis
fun
zmq_term
{l:agz}
(
ctx: !zmqctx (l) >> zmqctxopt (l, i < 0)
) : #[i:int | i <= 0] int (i) = "mac#%"
Description
This function terminates a given zmq-context. Note that it has been
deprecated, and zmq_ctx_destroy should be called
instead. Return Value
The function returns 0 if successful, or it returns -1.
Synopsis
fun zmq_term_exn (ctx: zmqctx1): void
Description
This function is the exit version of zmq_term.
Synopsis
fun
zmq_sendmsg
(
sock: !zmqsock1, msg: &zmqmsg, flags: int
) : interr = "mac#%"
Description
This function is identical to zmq_msg_send except its first two
arguments being given in the opposite order. It has been
deprecated.
Synopsis
fun
zmq_recvmsg
(
sock: !zmqsock1, msg: &zmqmsg >> _, flags: int
) : interr = "mac#%"
Description
This function is identical to zmq_msg_recv except its first two
arguments being given in the opposite order. It has been
deprecated.