diff options
author | Martin Lucina <mato@kotelna.sk> | 2010-02-10 16:18:46 +0100 |
---|---|---|
committer | Martin Lucina <mato@kotelna.sk> | 2010-02-10 16:18:46 +0100 |
commit | 354efc513fdb4096f8830e6c2e3e8f1311303e61 (patch) | |
tree | c8dec6949c70e6f41832e42326594ebb889b1ee2 /doc | |
parent | 2d44bf3644c8e12aa86c48e9da4df19bfa9ea703 (diff) |
Convert documentation to AsciiDoc
Diffstat (limited to 'doc')
34 files changed, 2201 insertions, 0 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..07dfb02 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,41 @@ +MAN1 = zmq_forwarder.1 zmq_streamer.1 zmq_queue.1 +MAN3 = zmq_bind.3 zmq_close.3 zmq_connect.3 zmq_flush.3 zmq_init.3 \ + zmq_msg_close.3 zmq_msg_copy.3 zmq_msg_data.3 zmq_msg_init.3 \ + zmq_msg_init_data.3 zmq_msg_init_size.3 zmq_msg_move.3 zmq_msg_size.3 \ + zmq_poll.3 zmq_recv.3 zmq_send.3 zmq_setsockopt.3 zmq_socket.3 zmq_strerror.3 \ + zmq_term.3 +MAN7 = zmq.7 zmq_tcp.7 zmq_udp.7 zmq_pgm.7 zmq_inproc.7 zmq_ipc.7 \ + zmq_cpp.7 zmq_java.7 zmq_python.7 +MAN_DOC = $(MAN1) $(MAN3) $(MAN7) + +MAN_TXT = $(MAN1:%.1=%.txt) +MAN_TXT += $(MAN3:%.3=%.txt) +MAN_TXT += $(MAN7:%.7=%.txt) +MAN_HTML = $(MAN_TXT:%.txt=%.html) + +if INSTALL_MAN +dist_man_MANS = $(MAN_DOC) +endif + +EXTRA_DIST = $(MAN_TXT) +if BUILD_DOC +EXTRA_DIST += $(MAN_HTML) +endif + +MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML) + +dist-hook : $(MAN_DOC) $(MAN_HTML) + +SUFFIXES=.html .txt .xml .1 .3 .7 + +.txt.html: + asciidoc -d manpage -b xhtml11 -f asciidoc.conf $< +.txt.xml: + asciidoc -d manpage -b docbook -f asciidoc.conf $< +.xml.1: + xmlto man $< +.xml.3: + xmlto man $< +.xml.7: + xmlto man $< + diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf new file mode 100644 index 0000000..d1dac78 --- /dev/null +++ b/doc/asciidoc.conf @@ -0,0 +1,34 @@ +[macros] +(?su)[\\]?(?P<name>linkzmq):(?P<target>\S*?)\[(?P<attrlist>.*?)\]= + +ifdef::backend-docbook[] +[linkzmq-inlinemacro] +{0%{target}} +{0#<citerefentry>} +{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>} +{0#</citerefentry>} +endif::backend-docbook[] + +ifdef::backend-xhtml11[] +[linkzmq-inlinemacro] +<a href="{target}.html">{target}{0?({0})}</a> +endif::backend-xhtml11[] + +ifdef::doctype-manpage[] +ifdef::backend-docbook[] +[header] +template::[header-declarations] +<refentry> +<refmeta> +<refentrytitle>{mantitle}</refentrytitle> +<manvolnum>{manvolnum}</manvolnum> +<refmiscinfo class="source">0MQ</refmiscinfo> +<refmiscinfo class="version">2.0.0</refmiscinfo> +<refmiscinfo class="manual">0MQ Manual</refmiscinfo> +</refmeta> +<refnamediv> + <refname>{manname}</refname> + <refpurpose>{manpurpose}</refpurpose> +</refnamediv> +endif::backend-docbook[] +endif::doctype-manpage[] diff --git a/doc/zmq.txt b/doc/zmq.txt new file mode 100644 index 0000000..0c911c3 --- /dev/null +++ b/doc/zmq.txt @@ -0,0 +1,175 @@ +zmq(7) +====== + + +NAME +---- +zmq - 0MQ lightweight messaging kernel + + +SYNOPSIS +-------- +0MQ is an extension of POSIX sockets. It is a library that augments standard +networking sockets by special capabilities that you can otherwise get only +by using specialised "messaging middleware" products, such as automated +handling of connections and disconnections, delivery of a message to multiple +destinations, load balancing messages, sophisticated message filtering etc. + +0MQ is designed to be extremely fast. Expected end-to-end latencies for +messages passed over a LAN are in tens of microseconds. Expected +throughputs are to be measured in millions of messages per second. + +0MQ is designed to be very thin. It requires no more than couple of +pages in resident memory and is thus well suited for any environment ranging +from small embedded devices, routers and cell phones to enterprise-scale +data centers. + +0MQ runs on a wide range of operating systems and supports variety of processor +microarchitectures. + +0MQ is accessible from a large set of programming languages. + +0MQ is fully open sourced LGPL-licensed software. + + +CONTEXT +------- +Each 0MQ socket lives within a specific context. Creating and destroying +context is a counterpart of library initialisation/deinitialisation as used +elsewhere. Ability to create multiple contexts saves the day when an application +happens to link (indirectly and involuntarily) with several instances of 0MQ. + +Initialise 0MQ context:: + linkzmq:zmq_init[3] + +Uninitialise 0MQ context:: + linkzmq:zmq_term[3] + + +MESSAGES +-------- +Message is a discrete unit of data passed between applications or components +of the same application. 0MQ message has no internal structure, it is an opaque +BLOB. When writing data to or reading data from the message, you are free to +use any of the many serialisation libraries available. Alternatively, you can +use your own serialisation code. The latter option is especially useful when +migrating legacy applications to 0MQ - there's no need to break existing +message formats. + +Initialise a message:: + linkzmq:zmq_msg_init[3] + linkzmq:zmq_msg_size[3] + linkzmq:zmq_msg_data[3] + +Uninitialise a message:: + linkzmq:zmq_msg_close[3] + +Access message content:: + linkzmq:zmq_msg_data[3] + linkzmq:zmq_msg_size[3] + +Message manipulation:: + linkzmq:zmq_msg_copy[3] + linkzmq:zmq_msg_move[3] + + +SOCKETS +------- +0MQ sockets are very similar to POSIX sockets. See following manual pages to +understand them in depth. + +Creating a socket:: + linkzmq:zmq_socket[3] + +Closing a socket:: + linkzmq:zmq_close[3] + +Setting socket options:: + linkzmq:zmq_setsockopt[3] + +Establishing a message flow:: + linkzmq:zmq_bind[3] + linkzmq:zmq_connect[3] + +Sending & receiving messages:: + linkzmq:zmq_send[3] + linkzmq:zmq_flush[3] + linkzmq:zmq_recv[3] + + +MULTIPLEXING +------------ +0MQ allows you to handle multiple sockets (0MQ as well as standard POSIX) +in an asynchronous manner. + +Poll for I/O events:: + linkzmq:zmq_poll[3] + + +ERROR HANDLING +-------------- +0MQ defines couple of non-POSIX error codes. Use following functions to handle +them neatly. + +Convert error code into human readable string:: + linkzmq:zmq_strerror[3] + + +TRANSPORTS +---------- +0MQ allows for using different underlying transport mechanisms (even multiple +at once). Each transport mechanism has its own advantages and drawbacks. For +detailed description of individual mechanisms check following manual pages: + +TCP/IP transport:: + linkzmq:zmq_tcp[7] + +UDP reliable multicast transport:: + linkzmq:zmq_udp[7] + +PGM reliable multicast transport:: + linkzmq:zmq_pgm[7] + +Inter-process transport:: + linkzmq:zmq_ipc[7] + +In-process (inter-thread) transport:: + linkzmq:zmq_inproc[7] + + +DEVICES +------- +Aside of the messaging library (a.k.a. messaging kernel) 0MQ provides pre-built +executables - devices - to serve as middle nodes in complex messaging +topologies. For detailed description of individual devices check following +manual pages: + +Forwarder device for PUB/SUB messaging:: + linkzmq:zmq_forwarder[1] + +Streamer device for UPSTREAM/DOWNSTREAM messaging:: + linkzmq:zmq_streamer[1] + +Forwarder device for REQ/REP messaging:: + linkzmq:zmq_queue[1] + + +LANGUAGES +--------- +0MQ manual pages provide info on C API. To find out how the your +favourite language API maps to C API and thus how to find relevant manual pages, +see following articles: + +$$C++$$:: + linkzmq:zmq_cpp[7] + +Java:: + linkzmq:zmq_java[7] + +Python:: + linkzmq:zmq_python[7] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_bind.txt b/doc/zmq_bind.txt new file mode 100644 index 0000000..391238a --- /dev/null +++ b/doc/zmq_bind.txt @@ -0,0 +1,67 @@ +zmq_bind(3) +=========== + + +NAME +---- +zmq_bind - binds the socket to the specified address + + +SYNOPSIS +-------- +'int zmq_bind (void *s, const char *addr);' + + +DESCRIPTION +----------- +The function binds socket 's' to a particular transport. Actual semantics of the +command depend on the underlying transport mechanism, however, in cases where +peers connect in an asymmetric manner, 'zmq_bind' should be called first, +'zmq_connect' afterwards. Actual formats of 'addr' parameter are defined by +individual transports. For a list of supported transports have a look at +linkzmq:zmq[7] manual page. + +Note that single socket can be bound (and connected) to +arbitrary number of peers using different transport mechanisms. + + +RETURN VALUE +------------ +In case of success the function returns zero. Otherwise it returns -1 and +sets 'errno' to the appropriate value. + + +ERRORS +------ +*EPROTONOSUPPORT*:: +unsupported protocol. +*ENOCOMPATPROTO*:: +protocol is not compatible with the socket type. +*EADDRINUSE*:: +the given address is already in use. +*EADDRNOTAVAIL*:: +a nonexistent interface was requested or the requested address was not local. + + +EXAMPLE +------- +---- +void *s = zmq_socket (context, ZMQ_PUB); +assert (s); +int rc = zmq_bind (s, "inproc://my_publisher"); +assert (rc == 0); +rc = zmq_bind (s, "tcp://eth0:5555"); +assert (rc == 0); +---- + + +SEE ALSO +-------- +linkzmq:zmq_connect[3] +linkzmq:zmq_socket[3] +linkzmq:zmq[7] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_close.txt b/doc/zmq_close.txt new file mode 100644 index 0000000..9964d36 --- /dev/null +++ b/doc/zmq_close.txt @@ -0,0 +1,52 @@ +zmq_close(3) +============ + + +NAME +---- +zmq_close - destroys 0MQ socket + + +SYNOPSIS +-------- +'int zmq_close (void *s);' + + +DESCRIPTION +----------- +Destroys 0MQ socket (one created using +'zmq_socket' function). All sockets have to be properly closed before the +application terminates, otherwise memory leaks will occur. Note that any +outbound messages that haven't been psuhed to the network yet and any inbound +messages that haven't been received by the application yet will be dropped on +the socket shutdown. + + +RETURN VALUE +------------ +In case of success the function returns zero. Otherwise it returns -1 and +sets 'errno' to the appropriate value. + + +ERRORS +------ +No errors are defined. + + +EXAMPLE +------- +---- +int rc = zmq_close (s); +assert (rc == 0); +---- + + +SEE ALSO +-------- +linkzmq:zmq_socket[3] +linkzmq:zmq_term[3] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_connect.txt b/doc/zmq_connect.txt new file mode 100644 index 0000000..375873d --- /dev/null +++ b/doc/zmq_connect.txt @@ -0,0 +1,63 @@ +zmq_connect(3) +============== + + +NAME +---- +zmq_connect - connect the socket to the specified peer + + +SYNOPSIS +-------- +'int zmq_connect (void *s, const char *addr);' + + +DESCRIPTION +----------- +The function connect socket 's' to the peer identified by 'addr'. Actual +semantics of the command depend on the underlying transport mechanism, +however, in cases where peers connect in an asymmetric manner, 'zmq_bind' +should be called first, 'zmq_connect' afterwards. Formats of the 'addr' +parameter are defined by individual transports. For a list of supported +transports have a look at linkzmq:zmq[7] manual page. + +Note that single socket can be connected (and bound) to +arbitrary number of peers using different transport mechanisms. + + +RETURN VALUE +------------ +In case of success the function returns zero. Otherwise it returns -1 and +sets 'errno' to the appropriate value. + + +ERRORS +------ +*EPROTONOSUPPORT*:: +unsupported protocol. +*ENOCOMPATPROTO*:: +protocol is not compatible with the socket type. + + +EXAMPLE +------- +---- +void *s = zmq_socket (context, ZMQ_SUB); +assert (s); +int rc = zmq_connect (s, "inproc://my_publisher"); +assert (rc == 0); +rc = zmq_connect (s, "tcp://server001:5555"); +assert (rc == 0); +---- + + +SEE ALSO +-------- +linkzmq:zmq_bind[3] +linkzmq:zmq_socket[3] +linkzmq:zmq[7] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_cpp.txt b/doc/zmq_cpp.txt new file mode 100644 index 0000000..8b58f2d --- /dev/null +++ b/doc/zmq_cpp.txt @@ -0,0 +1,89 @@ +zmq_cpp(7) +========== + + +NAME +---- +zmq_cpp - interface between 0MQ and C++ applications + + +SYNOPSIS +-------- +This manual page explains how C++ API maps to underlying C API. To learn about +individual functions and parameters check appropriate C API manual +pages. + +For example, to understand 'zmq::socket_t::setsockopt' function check +linkzmq:zmq_setsockopt[3]. + +All 0MQ constants defined with C API are available with C++ API. + + +zmq::context_t +-------------- +This class encapsulates the functions dealing with initialisation and +termination of 0MQ context. Constructor of the class invokes +linkzmq:zmq_init[3] while destructor calls linkzmq:zmq_term[3]. + + +zmq::socket_t +------------- +This class encapsulates all the functions to deal with 0MQ sockets. Constructor +calls linkzmq:zmq_socket[3], destructor calls linkzmq:zmq_close[3]. Other +functions of the class are mapped to C functions with corresponding names. +'zmq::socket_t::bind' calls linkzmq:zmq_bind[3] etc. + + +zmq::message_t +-------------- +This class encapsulates 'zmq_msg_t' structure and all the C functions that deal +with 0MQ messages. Constructors of the class invoke corresponding +initialisation functions linkzmq:zmq_msg_init[3], linkzmq:zmq_msg_init_size[3] +and linkzmq:zmq_msg_init_data[3], while destructor invokes +linkzmq:zmq_msg_close[3] function. + +Remaining functions are mapped to C functions with corresponding names. +For instance, 'zmq::message_t::copy' is mapped to linkzmq:zmq_msg_copy[3] +etc. + +C++ provides an additional function not available with C API. +'zmq::message_t::rebuild' is equivalent to calling linkzmq:zmq_close[3] +followed by linkzmq:zmq_msg_init[3], linkzmq:zmq_msg_init_size[3] or +linkzmq:zmq_msg_init_data[3]. It provides a way to reuse existing +'zmq::message_t' instances to store different message content. + + +zmq::error_t +------------ +All the errors reported using 'errno' mechanism in C API are automatically +converted to exceptions in C++ API. 'zmq::error_t' is derived from +'std::exception' and uses linkzmq:zmq_strerror[3] function to convert the error +code to human-readable string. + + +zmq::poll +--------- +'zmq::poll' function is a namespaced equivalent of raw C linkzmq:zmq_poll[3] +function. + + +EXAMPLE +------- +---- +zmq::context_t ctx (1, 1); +zmq::socket_t s (ctx, ZMQ_PUB); +s.connect ("tcp://192.168.0.115:5555"); +zmq::message_t msg (100); +memset (msg.data (), 0, 100); +s.send (msg); +---- + + +SEE ALSO +-------- +linkzmq:zmq[7] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_flush.txt b/doc/zmq_flush.txt new file mode 100644 index 0000000..3a2cd37 --- /dev/null +++ b/doc/zmq_flush.txt @@ -0,0 +1,59 @@ +zmq_flush(3) +============ + + +NAME +---- +zmq_flush - flushes pre-sent messages to the socket + + +SYNOPSIS +-------- +'int zmq_flush (void *s);' + + +DESCRIPTION +----------- +Flushes all the pre-sent messages - i.e. those that have been sent with +ZMQ_NOFLUSH flag - to the socket. This functionality improves performance in +cases where several messages are sent during a single business operation. +It should not be used as a transaction - ACID properties are not guaranteed. +Note that calling 'zmq_send' without ZMQ_NOFLUSH flag automatically flushes all +previously pre-sent messages. + + +RETURN VALUE +------------ +In case of success the function returns zero. Otherwise it returns -1 and +sets 'errno' to the appropriate value. + + +ERRORS +------ +*ENOTSUP*:: +function isn't supported by particular socket type. +*EFSM*:: +function cannot be called at the moment, because socket is not in the +approprite state. + + +EXAMPLE +------- +---- +rc = zmq_send (s, &msg1, ZMQ_NOFLUSH); +assert (rc == 0); +rc = zmq_send (s, &msg2, ZMQ_NOFLUSH); +assert (rc == 0); +rc = zmq_flush (s); +assert (rc == 0); +---- + + +SEE ALSO +-------- +linkzmq:zmq_send[3] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_forwarder.txt b/doc/zmq_forwarder.txt new file mode 100644 index 0000000..17d938b --- /dev/null +++ b/doc/zmq_forwarder.txt @@ -0,0 +1,32 @@ +zmq_forwarder(1) +================ + + +NAME +---- +zmq_forwarder - forwards the stream of PUB/SUB messages + + +SYNOPSIS +-------- +* + + +DESCRIPTION +----------- +* + + +OPTIONS +------- +* + + +SEE ALSO +-------- +* + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_init.txt b/doc/zmq_init.txt new file mode 100644 index 0000000..6683d27 --- /dev/null +++ b/doc/zmq_init.txt @@ -0,0 +1,61 @@ +zmq_init(3) +=========== + + +NAME +---- +zmq_init - initialises 0MQ context + + +SYNOPSIS +-------- +'void *zmq_init (int app_threads, int io_threads, int flags);' + + +DESCRIPTION +----------- +Initialises 0MQ context. 'app_threads' specifies maximal number of application +threads that can own open sockets at the same time. At least one application +thread should be defined. 'io_threads' specifies the size of thread pool to +handle I/O operations. The value shouldn't be negative. Zero can be used in +case only in-process messaging is going to be used, i.e. there will be no I/O +traffic. + +The 'flags' argument is a combination of the flags defined below: + +*ZMQ_POLL*:: + flag specifying that the sockets within this context should be pollable + (see linkzmq:zmq_poll[3]). Pollable sockets may add a little latency to the + message transfer when compared to non-pollable sockets. + + +RETURN VALUE +------------ +Function returns context handle is successful. Otherwise it returns NULL and +sets errno to one of the values below. + + +ERRORS +------ +*EINVAL*:: + there's less than one application thread allocated, or number of I/O + threads is negative. + + +EXAMPLE +------- +---- +void *ctx = zmq_init (1, 1, ZMQ_POLL); +assert (ctx); +---- + + +SEE ALSO +-------- +linkzmq:zmq_term[3] +linkzmq:zmq_socket[3] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_inproc.txt b/doc/zmq_inproc.txt new file mode 100644 index 0000000..7861201 --- /dev/null +++ b/doc/zmq_inproc.txt @@ -0,0 +1,50 @@ +zmq_inproc(7) +============= + + +NAME +---- +zmq_inproc - 0MQ transport to pass messages between threads + + +SYNOPSIS +-------- +In-process transport is optimised for passing messages between threads in the +same process. + +Messages are passed directly from one application thread to +another application thread. There are no intervening I/O threads involved. +Thus, if you are using 0MQ for in-process messaging only, you can initialise +the library (linkzmq:zmq_init[3]) with zero I/O worker threads. + + +CONNECTION STRING +----------------- +Connection string for inproc transport is "inproc://" followed by an arbitrary +string. There are no restrictions on the string format: + +---- + inproc://my_endpoint + inproc://feeds/opra/cboe + inproc://feeds.opra.nasdaq + inproc://!&W#($)_@_123*((^^^ +---- + + +WIRE FORMAT +----------- +In-process transport transfers messages via memory thus there is no need for a +wire format specification. + + +SEE ALSO +-------- +linkzmq:zmq_ipc[7] +linkzmq:zmq_tcp[7] +linkzmq:zmq_udp[7] +linkzmq:zmq_pgm[7] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_ipc.txt b/doc/zmq_ipc.txt new file mode 100644 index 0000000..c3980f6 --- /dev/null +++ b/doc/zmq_ipc.txt @@ -0,0 +1,44 @@ +zmq_ipc(7) +========== + + +NAME +---- +zmq_ipc - 0MQ transport to pass messages between processes + + +SYNOPSIS +-------- +Inter-process transport is optimised for passing messages between processes on +the same physical machine. + + +CONNECTION STRING +----------------- +Connection string for inproc transport is "ipc://" followed by a file name. +The file will be used as placeholder for a message endpoint. (UNIX domain +sockets associate a file with the listening socket in a similar way.) + +---- + ipc:///tmp/my_ipc_endpoint + ipc:///tmp/prices.ipc +---- + + +WIRE FORMAT +----------- +IPC transport doesn't transfer messages across the network thus there is no need +for a wire format specification. + + +SEE ALSO +-------- +linkzmq:zmq_inproc[7] +linkzmq:zmq_tcp[7] +linkzmq:zmq_udp[7] +linkzmq:zmq_pgm[7] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_java.txt b/doc/zmq_java.txt new file mode 100644 index 0000000..c49e589 --- /dev/null +++ b/doc/zmq_java.txt @@ -0,0 +1,27 @@ +zmq_java(7) +=========== + + +NAME +---- +zmq_java - interface between 0MQ and Java applications + + +SYNOPSIS +-------- +* + + +DESCRIPTION +----------- +* + + +SEE ALSO +-------- +* + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_msg_close.txt b/doc/zmq_msg_close.txt new file mode 100644 index 0000000..1b043a2 --- /dev/null +++ b/doc/zmq_msg_close.txt @@ -0,0 +1,53 @@ +zmq_msg_close(3) +================ + + +NAME +---- +zmq_msg_close - destroys 0MQ message + + +SYNOPSIS +-------- +'int zmq_msg_close (zmq_msg_t *msg);' + + +DESCRIPTION +----------- +Deallocates message 'msg' including any associated buffers (unless the buffer +is shared with another message). Not calling this function can result in +memory leaks. + + +RETURN VALUE +------------ +In case of success the function returns zero. Otherwise it returns -1 and sets +'errno' to the appropriate value. + + +ERRORS +------ +No errors are defined. + + +EXAMPLE +------- +---- +zmq_msg_t msg; +rc = zmq_msg_init_size (&msg, 1000000); +assert (rc = 0); +rc = zmq_msg_close (&msg); +assert (rc = 0); +---- + + +SEE ALSO +-------- +linkzmq:zmq_msg_init[3] +linkzmq:zmq_msg_init_size[3] +linkzmq:zmq_msg_init_data[3] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> diff --git a/doc/zmq_msg_copy.txt b/doc/zmq_msg_copy.txt new file mode 100644 index 0000000..b31897a --- /dev/null +++ b/doc/zmq_msg_copy.txt @@ -0,0 +1,60 @@ +zmq_msg_copy(3) +=============== + + +NAME +---- +zmq_msg_copy - copies content of a message to another message + + +SYNOPSIS +-------- +'int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);' + + +DESCRIPTION +----------- +Copy the 'src' message to 'dest'. The original content of +'dest' is orderly deallocated. + +CAUTION: The implementation may choose not to physically copy the data, rather +to share the buffer between two messages. Thus avoid modifying message data +after the message was copied. Doing so can modify multiple message instances. +If what you need is actual hard copy, allocate new message using +'zmq_msg_size' and copy the data using 'memcpy'. + + +RETURN VALUE +------------ +In case of success the function returns zero. Otherwise it returns -1 and +sets 'errno' to the appropriate value. + + +ERRORS +------ +No errors are defined. + + +EXAMPLE +------- +---- +zmq_msg_t dest; +rc = zmq_msg_init (&dest); +assert (rc == 0); +rc = zmq_msg_copy (&dest, &src); +assert (rc == 0); +---- + + +SEE ALSO +-------- +linkzmq:zmq_msg_move[3] +linkzmq:zmq_msg_init[3] +linkzmq:zmq_msg_init_size[3] +linkzmq:zmq_msg_init_data[3] +linkzmq:zmq_msg_close[3] + + +AUTHOR +------ +Martin Sustrik <sustrik at 250bpm dot com> |