text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|> virtual ~i_decoder () ZMQ_DEFAULT;
virtual void get_buffer (unsigned char **data_, size_t *size_) = 0;
virtual void resize_buffer (size_t) = 0;
// Decodes data pointed to by data_.
// When a message is decoded, 1 is returned.
// When the decoder needs more data, 0 is returned.
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> The function returns a batch of binary data. The data
// are filled to a supplied buffer. If no buffer is supplied (data_
// is NULL) encoder will provide buffer of its own.
// Function returns 0 when a new message is required.
virtual size_t encode (unsigned char **data_, size_t size_... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>if
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_I_ENGINE_HPP_INCLUDED__
#define __ZMQ_I_ENGINE_HPP_INCLUDED__
#include "endpoint.hpp"
#include "macros.hpp"
namespace zmq
{
class io_thread_t;
// Abstract interface to be implemented by various engines.
struct i_engine
{
enum ... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_I_MAILBOX_HPP_INCLUDED__
#d<|fim_suffix|>the parent process.
virtual void forked () = 0;
#endif
};
}
#endif
<|fim_middle|>efine __ZMQ_I_MAILBOX_HPP_INCLUDED__
#include "macros.hpp"
#include "stdint.hpp"
namespace zmq
{
// Interface to be implem... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_I_POLL_EVENTS_HPP_<|fim_suffix|>
// Called by I/O thread when file descriptor is ready for writing.
virtual void out_event () = 0;
// Called when timer expires.
virtual void timer_event (int id_) = 0;
};
}
#endif
<|fim_middle|>INCLUD... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>l_timer (this, id_);
}
void zmq::io_object_t::in_event ()
{
zmq_assert (false);
}
void zmq::io_object_t::out_event ()
{
zmq_assert (false);
}
void zmq::io_object_t::timer_event (int)
{
zmq_assert (false);
}
<|fim_prefix|>/*<|fim_middle|> SPDX-License-Identifier: MPL-2.0 */
#include "precom... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>(int id_) ZMQ_OVERRIDE;
private:
poller_t *_poller;
ZMQ_NON_COPYABLE_NOR_MOVABLE (io_object_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_IO_OBJECT_HPP_INCLUDED__
#define __ZMQ_IO_OBJECT_HPP_INCLUDED__
#include <stddef.h>
#include "stdint.hpp"
#include "... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ing for POLLOUT here. This function is never called.
zmq_assert (false);
}
void zmq::io_thread_t::timer_event (int)
{
// No timers here. This function is never called.
zmq_assert (false);
}
zmq::poller_t *zmq::io_thread_t::get_poller () const
{
zmq_assert (_poller);
return _poller;
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_IO_THREAD_HPP_INCLUDED__
#define __ZMQ_IO_THREAD_HPP_INCLUDED__
#include "stdint.hpp"
#include "object.hpp"
#include "poller.hpp"
#include "i_poll_events.hp<|fim_suffix|> // I/O multiplexing is performed using a poller object.
poller_t *_poller... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> errno_assert (rc != -1);
rc = listen (listener, 1);
errno_assert (rc != -1);
*w_ = open_socket (AF_INET, SOCK_STREAM, 0);
errno_assert (*w_ != -1);
rc = setsockopt (*w_, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof on);
errno_assert (rc != -1);
rc = connect (*w_, (stru... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>k_);
// Asserts that:
// - an internal 0MQ error did not occur,
// - and, if a socket error occurred, it can be recovered from.
void assert_success_or_recoverable (fd_t s_, int rc_);
#ifdef ZMQ_HAVE_IPC
// Create an IPC wildcard path address
int create_ipc_wildcard_address (std::string &path_, std::s... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>tem for Linux compatibility
errno = ENODEV;
return -1;
}
errno_assert (rc == 0);
zmq_assert (ifa != NULL);
// Find the corresponding network interface.
bool found = false;
for (const ifaddrs *ifp = ifa; ifp != NULL; ifp = ifp->ifa_next) {
if (ifp->ifa_addr... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_IP_RESOLVER_HPP_INCLUDED__
#define __ZMQ_IP_RESOLVER_HPP_INCLUDED__
#if !defined ZMQ_HAVE_WINDOWS
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#endif
#include "address.hpp"
namespace zmq
{
union ip_addr_t
{
sockaddr generic... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>> (offsetof (sockaddr_un, sun_path) + path_len);
return 0;
}
int zmq::ipc_address_t::to_string (std::string &addr_) const
{
if (_address.sun_family != AF_UNIX) {
addr_.clear ();
return -1;
}
const char prefix[] = "ipc://";
char buf[sizeof prefix + sizeof _address.sun_... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_IPC_ADDRESS_HPP_INCLUDED__
#define __ZMQ_IPC_ADDRESS_HPP_INCLUDED__
#if defined ZMQ_HAVE_IPC
#include <string>
#if defined ZMQ_HAVE_WINDOWS
#include <afunix.h>
#else
#include <sys/socket.h>
#include <sys/un.h>
#endif
#include "m<|fim_suffix|>olve()... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "ipc_connecter.hpp"
#if defined ZMQ_HAVE_IPC
#include <new>
#include <string>
#include "io_thread.hpp"
#include "random.hpp"
#include "err.hpp"
#include "ip.hpp"
#include "address.hpp"
#include "ipc_address.hpp"
#include "sessi... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __IPC_CONNECTER_HPP_INCLUDED__
#define __IPC_CONNECTER_HPP_INCLUDED__
#if defined ZMQ_HAVE_IPC
#include "fd.hpp"
#include "stream_connecter_base.hpp"
namespace zmq
{
class ipc_connecter_t ZMQ_FINAL : public stream_connecter_base_t
{
public:
// If 'delayed_start'... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>HAVE_HPUX || defined ZMQ_HAVE_VXWORKS
int ss_len = sizeof (ss);
#else
socklen_t ss_len = sizeof (ss);
#endif
const fd_t sock =
::accept (_s, reinterpret_cast<struct sockaddr *> (&ss), &ss_len);
#endif
if (sock == retired_fd) {
#if defined ZMQ_HAVE_WINDOWS
const int last_erro... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_IPC_LISTENER_HPP_INCLUDED__
#define __ZMQ_IPC_LISTENER_HPP_INCLUDED__
#if defined ZMQ_HAVE_IPC
#include <string>
#include "fd.hpp"
#include "stream_listener_base.hpp"
namespace zmq
{
class ipc_listener_t ZMQ_FINAL : public stream_listener_base_t
{
public:
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "kqueue.hpp"
#if defined ZMQ_IOTHREAD_POLLER_USE_KQUEUE
#include <sys/time.h>
#include <sys/types.h>
#include <sys/event.h>
#include <stdlib.h>
#include <unistd.h>
#include <algorithm>
#include <new>
#include "macros.hpp"
#inclu... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>riptor referring to the kernel event queue.
fd_t kqueue_fd;
// Adds the event to the kqueue.
void kevent_add (fd_t fd_, short filter_, void *udata_);
// Deletes the event from the kqueue.
void kevent_delete (fd_t fd_, short filter_);
struct poll_entry_t
{
fd_t fd;
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>icity of multi-part messages (in blocking mode
// socket_base just tries again and again to send the same message)
// Note that given dropping mode returns 0, the user will
// never know that the message could not be delivered, but
// can't really fix it wit... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_LB_HPP_INCLUDED__
#define __ZMQ_LB_HPP_INCLUDED__
#include "array.hpp"
namespace zmq
{
class msg_t;
class pipe_t;
// This class manages a set of outbound pipes. On send it load balances
// messages fairly among the pipes.
class lb_t
{
public:
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_LIKELY_HPP_INCLUDED__
#define __ZMQ_LIKELY_HPP_INCLUDED__
#if defined __GNUC__
#define likely(x) __builtin_expect ((x), 1<|fim_suffix|>endif
<|fim_middle|>)
#define unlikely(x) __builtin_expect ((x), 0)
#else
#define likely(x) (x)
#define unlikely(x) ... | fim | zeromq/libzmq | cpp |
/******************************************************************************/
/* 0MQ Internal Use */
/******************************************************************************/
#define LIBZMQ_UNUSED(object) (void) object
#define LIBZMQ_DELETE(p_object)... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "mailbox.hpp"
#include "err.hpp"
zmq::mailbox_t::mailbox_t ()
{
// Get the pipe into passive state. That way, if the users starts by
// polling on the associated file descriptor it will get woken up when
// new command is posted... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> signaler_t _signaler;
// There's only one thread receiving from the mailbox, but there
// is arbitrary number of threads sending. Given that ypipe requires
// synchronised access on both of its endpoints, we have to synchronise
// the sending side.
mutex_t _sync;
// True if... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>the cpipe.
// Work around problem that other threads might still be in our
// send() method, by waiting on the mutex before disappearing.
_sync->lock ();
_sync->unlock ();
}
void zmq::mailbox_safe_t::add_signaler (signaler_t *signaler_)
{
_signalers.push_back (signaler_);
}
void zmq... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_MAILBOX_SAFE_HPP_INCLUDED__
#define __ZMQ_MAILBOX_SAFE_HPP_INCLUDED__
#include <vector>
#include <stddef.h>
#include "signaler.hpp"
#include "fd.hpp"
#include "config.hpp"
#include "command.hpp"
#include "ypipe.hpp"
#include "mutex.hpp"
#include "i_mailbox.hpp"
#i... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include <string.h>
#include <limits.h>
#include "mechanism.hpp"
#include "options.hpp"
#include "msg.hpp"
#include "err.hpp"
#include "wire.hpp"
#include "session_base.hpp"
zmq::mechanism_t::mechanism_t (const options_t &options_) : opt... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_MECHANISM_HPP_INCLUDED__
#define __ZMQ_MECHANISM_HPP_INCLUDED__
#include "stdint.hpp"
#include "options.hpp"
#include "blob.hpp"
#include "metadata.hpp"
namespace zmq
{
class msg_t;
class session_base_t;
// Abstract class representing security mechanism.
// Dif... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>_index] == zero_digit
&& error_reason_[significant_digit_index] >= '3'
&& error_reason_[significant_digit_index] <= '5') {
// it is a ZAP error status code (300, 400 or 500), so emit an authentication failure event
session->get_socket ()->event_handshake_failed_auth (
... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_MECHANISM_BASE_HPP_INCLUDED__
#define __ZMQ_MECHANISM_BASE_HPP_INCLUDED__
#include "mechanism.hpp"
namespace zmq
{
class msg_t;
class mechanism_base_t : public mechanism_t
{
protected:
mechanism_base_t (session_base_t *session_, const options_t &options_);
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>>second.c_str ();
}
void zmq::metadata_t::add_ref ()
{
_ref_cnt.add (1);
}
bool zmq::metadata_t::drop_ref ()
{
return !_ref_cnt.sub (1);
}
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "metadata.hpp"
zmq::metadata_t::metadata_t (const dict_t &dict_) :... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>BLE (metadata_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_METADATA_HPP_INCLUDED__
#define __ZMQ_METADATA_HPP_INCLUDED__
#include <map>
#include <string>
#include "atomic_counter.hpp"
namespace zmq
{
class metadata_t
{
public:
typedef std::map<std::string, s... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "compat.hpp"
#include "macros.hpp"
#include "msg.hpp"
#include <string.h>
#include <stdlib.h>
#include <new>
#include "stdint.hpp"
#include "likely.hpp"
#include "metadata.hpp"
#include "err.hpp"
// Check whether the sizes of ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>4
};
enum
{
max_vsm_size =
msg_t_size - (sizeof (metadata_t *) + 3 + 16 + sizeof (uint32_t))
};
enum
{
ping_cmd_name_size = 5, // 4PING
cancel_cmd_name_size = 7, // 6CANCEL
sub_cmd_name_size = 10 // 9SUBSCRIBE
};
private:
zm... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 <|fim_suffix|>pp"
#include "mtrie.hpp"
#include "generic_mtrie_impl.hpp"
namespace zmq
{
template class generic_mtrie_t<pipe_t>;
}
<|fim_middle|>*/
#include "precompiled.h<|endoftext|> | fim | zeromq/libzmq | cpp |
<|fim_suffix|>_VER > 1600)
#define ZMQ_HAS_EXTERN_TEMPLATE 1
#else
#define ZMQ_HAS_EXTERN_TEMPLATE 0
#endif
namespace zmq
{
class pipe_t;
#if ZMQ_HAS_EXTERN_TEMPLATE
extern template class generic_mtrie_t<pipe_t>;
#endif
typedef generic_mtrie_t<pipe_t> mtrie_t;
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>utex_t *_mutex;
ZMQ_NON_COPYABLE_NOR_MOVABLE (scoped_optional_lock_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_MUTEX_HPP_INCLUDED__
#define __ZMQ_MUTEX_HPP_INCLUDED__
#include "err.hpp"
#include "macros.hpp"
// Mutex class encapsulates OS mutex in a platform... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>_size (inBatchSize),
in_sync (false),
rx_ready (false),
zmq_decoder (NULL),
skip_norm_sync (false),
buffer_ptr (NULL),
buffer_size (0),
buffer_count (0),
prev (NULL),
next (NULL),
list (NULL)
{
}
zmq::norm_engine_t::NormRxStreamState::~NormRxStreamState ()
{
if... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>s List;
List *AccessList () { return list; }
private:
NormObjectHandle norm_stream;
int64_t max_msg_size;
bool zero_copy;
int in_batch_size;
bool in_sync;
bool rx_ready;
v2_decoder_t *zmq_decoder;
bool skip_norm_sync;
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include "err.hpp"
#include "msg.hpp"
#include "session_base.hpp"
#include "null_mechanism.hpp"
const char error_command_name[] = "\5ERROR";
const size_t error_command_name_len... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ol _error_command_received;
bool _zap_request_sent;
bool _zap_reply_received;
int process_ready_command (const unsigned char *cmd_data_,
size_t data_size_);
int process_error_command (const unsigned char *cmd_data_,
size_t data... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include <string.h>
#include <stdarg.h>
#include "object.hpp"
#include "ctx.hpp"
#include "err.hpp"
#include "pipe.hpp"
#include "io_thread.hpp"
#include "session_base.hpp"
#include "socket_base.hpp"
zmq::object_t::object_t (ctx_t *ctx_,... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_OBJECT_HPP_INCLUDED__
#define __ZMQ_OBJECT_HPP_INCLUDED__
#include <string>
#include "endpoint.hpp"
#include "macros.hpp"
#include "stdint.hpp"
namespace zmq
{
struct i_engine;
struct endpoint_t;
struct pending_connection_t;
struct command_t;
class ctx_t;
class p... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include <string.h>
#include <limits.h>
#include <set>
#include "options.hpp"
#include "err.hpp"
#include "macros.hpp"
#ifndef ZMQ_HAVE_WINDOWS
#include <net/if.h>
#endif
#if defined IFNAMSIZ
#define BINDDEVSIZ IFNAMSIZ
#else
#define BINDDEVSIZ 16
#e... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_OPTIONS_HPP_INCLUDED__
#define __ZMQ_OPTIONS_HPP_INCLUDED__
#include <string>
#include <vector>
#include <map>
#include "atomic_ptr.hpp"
#include "stddef.h"
#include "stdint.hpp"
#include "tcp_address.hpp"
#if defined ZMQ_HAVE_SO_PEERCRED || defined... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "own.hpp"
#include "err.hpp"
#include "io_thread.hpp"
zmq::own_t::own_t (class ctx_t *parent_, uint32_t tid_) :
object_t (parent_, tid_),
_terminating (false),
_sent_seqnum (0),
_processed_seqnum (0),
_owner (... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_OWN_HPP_INCLUDED__
#define __ZMQ_OWN_HPP_INCLUDED__
#include <set>
#include "object.hpp"
#include "options.hpp"
#include "atomic_counter.hpp"
#include "stdint.hpp"
namespace zmq
{
class ctx_t;
class io_thread_t;
// Base class for objects forming a... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#in<|fim_suffix|>ose ();
errno_assert (rc == 0);
if (!_pipe || !_pipe->read (msg_)) {
// Initialise the output parameter to be a 0-byte message.
rc = msg_->init ();
errno_assert (rc == 0);
errno = EAGAIN;
return -1;... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>d (zmq::msg_t *msg_);
int xrecv (zmq::msg_t *msg_);
bool xhas_in ();
bool xhas_out ();
void xread_activated (zmq::pipe_t *pipe_);
void xwrite_activated (zmq::pipe_t *pipe_);
void xpipe_terminated (zmq::pipe_t *pipe_);
private:
zmq::pipe_t *_pipe;
ZMQ_NON_COPYABLE_NOR_MO... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#<|fim_suffix|>de "peer.hpp"
#include "pipe.hpp"
#include "wire.hpp"
#include "random.hpp"
#include "likely.hpp"
#include "err.hpp"
zmq::peer_t::peer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
server_t (... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PEER_HPP_INCLUDED__
#define __ZMQ_PEER_HPP_INCLUDED__
#include <map>
#include "socket_base.hpp"
#include "server.hpp"
#include "session_base.hpp"
#include "stdint.hpp"
#include "blob.hpp"
#include "fq.hpp"
namespace zmq
{
class ctx_t;
class msg_t;
class pipe_t;
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#if defined ZMQ_HAVE_OPENPGM
#include <new>
#include "pgm_receiver.hpp"
#include "session_base.hpp"
#include "v1_decoder.hpp"
#include "stdint.hpp"
#include "wire.hpp"
#include "err.hpp"
zmq::pgm_receiver_t::pgm_r... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> int process_input (v1_decoder_t *decoder);
// PGM is not able to move subscriptions upstream. Thus, drop all
// the pending subscriptions.
void drop_subscriptions ();
// RX timeout timer ID.
enum
{
rx_timer_id = 0xa1
};
const endpoint_uri_pair_t _empty_endp... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>t
{
return _empty_endpoint;
}
zmq::pgm_sender_t::~pgm_sender_t ()
{
int rc = msg.close ();
errno_assert (rc == 0);
if (out_buffer) {
free (out_buffer);
out_buffer = NULL;
}
}
void zmq::pgm_sender_t::in_event ()
{
if (has_rx_timer) {
cancel_timer (rx_timer... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PGM_SENDER_HPP_INCLUDED__
#define __ZMQ_PGM_SENDER_HPP_INCLUDED__
#if defined ZMQ_HAVE_OPENPGM
#include "stdint.hpp"
#include "io_object.hpp"
#include "i_engine.hpp"
#include "options.hpp"
#include "pgm_socket.hpp"
#include "v1_encoder.hpp"
#include ... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#ifdef ZMQ_HAVE_OPENPGM
#ifdef ZMQ_HAVE_LINUX
#include <poll.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <string>
#include "options.hpp"
#include "pgm_socket.hpp"
#include "config.hpp"
#include "err.hpp"
#include "random... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>bytes were read from pgm socket.
size_t nbytes_rec;
// How many bytes were processed from last pgm socket read.
size_t nbytes_processed;
// How many messages from pgm_msgv were already sent up.
size_t pgm_msgv_processed;
};
}
#endif
#endif
<|fim_prefix|>/* SPDX-License-Identifier:... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ate == active || _state == waiting_for_delimiter);
if (_state == active)
_state = delimiter_received;
else {
rollback ();
_out_pipe = NULL;
send_pipe_term_ack (_peer);
_state = term_ack_sent;
}
}
void zmq::pipe_t::hiccup ()
{
// If termination is ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> Flush the messages downstream.
void flush ();
// Temporarily disconnects the inbound message stream and drops
// all the messages on the fly. Causes 'hiccuped' event to be generated
// in the peer.
void hiccup ();
// Ensure the pipe won't block on receiving pipe_term.
v... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#include <string>
#include <limits.h>
#include "msg.hpp"
#include "err.hpp"
#include "plain_client.hpp"
#include "session_base.hpp"
#include "plain_common.hpp"
zmq::plain_client_t::plain_client_t (session_base_t *c... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> *cmd_data_, size_t data_size_);
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PLAIN_CLIENT_HPP_INCLUDED__
#define __ZMQ_PLAIN_CLIENT_<|fim_middle|>HPP_INCLUDED__
#include "mechanism_base.hpp"
#include "options.hpp"
namespace zmq
{
class msg_t;
class plain_client_t ZM... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PLAIN_COMMON_HPP_INCLUDED__
#define __ZMQ_PLAIN_COMMON_HPP_INCLUDED__
namespace zmq
{
const char hello_prefix[] = "\x05<|fim_suffix|> 1;
const char initiate_prefix[] = "\x08INITIATE";
const size_t initiate_prefix_len = sizeof (initiate_prefix) - 1;
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include <string>
#include "msg.hpp"
#include "session_base.hpp"
#include "err.hpp"
#include "plain_server.hpp"
#include "wire.hpp"
#include "plain_common.hpp"
zmq::plain_server_t::plain_server_t (session_base_t *session_,
... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PLAIN_SERVER_HPP_INCLUDED__
#define __ZMQ_PLAIN_SERVER_HPP_INCLUDED__
#include "options.hpp"
#include "zap_client.hpp"
namespace zmq
{
class msg_t;
class session_base_t;
class plain_server_t ZMQ_FINAL : public zap_client_common_handshake_t
{
public:
plain_s... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "poll.hpp"
#if defined ZMQ_IOTHREAD_POLLER_USE_POLL
#include <sys/types.h>
#include <sys/time.h>
#include <poll.h>
#include <algorithm>
#include "poll.hpp"
#include "err.hpp"
#include "config.hpp"
#include "i_po<|fim_suffix|>le[... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>d reset_pollin (handle_t handle_);
void set_pollout (handle_t handle_);
void reset_pollout (handle_t handle_);
void stop ();
static int max_fds ();
private:
// Main event loop.
void loop () ZMQ_FINAL;
void cleanup_retired ();
struct fd_entry_t
{
fd_t inde... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>L_BASED_ON_POLL) > 1
#error More than one of the ZMQ_POLL_BASED_ON_* macros defined
#elif (defined ZMQ_POLL_BASED_ON_SELECT + defined ZMQ_POLL_BASED_ON_POLL) == 0
#error None of the ZMQ_POLL_BASED_ON_* macros defined
#endif
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_POLLER... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "poller_base.hpp"
#inc<|fim_suffix|> // Make sure there is no more load on the shutdown.
zmq_assert (get_load () == 0);
}
int zmq::poller_base_t::get_load () const
{
return _load.get ();
}
void zmq::poller_base_t::adjus... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_POLLER_BASE_HPP_INCLUDED__
#define __ZMQ_POLLER_BASE_HPP_INCLUDED__
#include <map>
#include "clock.hpp"
#include "atomic_counter.hpp"
#include "ctx.hpp"
namespace zmq
{
struct i_poll_events;
// A build of libzmq must provide an implementation of th... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> const long timeout_,
const uint64_t now_,
const uint64_t end_)
{
if (first_pass_)
return 0;
if (timeout_ < 0)
return -1;
return static_cast<zmq::timeout_t> (
std::min<uint64_t> (end_ - now_... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_SOCKET_POLLING_UTIL_HPP_INCLUDED__
#define __ZMQ_SOCKET_POLLING_UTIL_HPP_INCLUDED__
#include <stdlib.h>
#include <vector>
#if defined ZMQ_HAVE_WINDOWS
#include <winsock.h>
#else
#include <sys/select.h>
#endif
#include "macros.hpp"
#include "stdint.h... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "pollset.hpp"
#if defined ZMQ_IOTHREAD_POLLER_USE_POLLSET
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>
#include <new>
#include "macros.hpp"
#include "err.hpp"
#include "config.hpp"
#include "i... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>> fd_table_t;
fd_table_t fd_table;
// If true, thread is in the process of shutting down.
bool stopping;
// Handle of the physical thread doing the I/O work.
thread_t worker;
ZMQ_NON_COPYABLE_NOR_MOVABLE (pollset_t)
};
typedef pollset_t poller_t;
}
#endif
#endif
<|fim_prefi... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>
#include "precompiled.hpp"
<|fim_prefix|>/* SPDX-Lice<|fim_middle|>nse-Identifier: MPL-2.0 */<|endoftext|> | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PRECOMPILED_HPP_INCLUDED__
#define __ZMQ_PRECOMPILED_HPP_INCLUDED__
// On AIX platform, poll.h has to be included first to get consistent
// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
// instead of 'events' and 'revents' ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ked;
else if (poller_wait == poller_in)
poller_wait = poller_send_blocked;
}
}
}
}
}
PROXY_CLEANUP ();
return close_and_return (&msg, 0);
}
#else // ZMQ_HAVE_POLLER
int zmq::proxy_ste... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> class socket_base_t *backend_,
class socket_base_t *capture_,
class socket_base_t *control_);
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PROXY_HPP_INCLUDED__
#define __ZMQ_PROXY_HPP_INCLUDED__
namespace zmq
{
int prox... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "pub.h<|fim_suffix|>_all_,
bool locally_initiated_)
{
zmq_assert (pipe_);
// Don't delay pipe termination as there is no one
// to receive the delimiter.
pipe_->set_nodelay ();
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PUB_HPP_INCLUDED__
#define __ZMQ_PUB_HPP_INCLUDED__
#include "xpub.hpp"
namespace zmq
{
class ctx_t;
class io_thread_t;
class socket_base_t;
class msg_t;
class pub_t ZMQ_FINAL : public xpub_t
{
public:
pub_t (zmq::ctx_t *parent_, uint32_t tid_... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>initiated_);
zmq_assert (pipe_);
_fq.attach (pipe_);
}
void zmq::pull_t::xread_activated (pipe_t *pipe_)
{
_fq.activated (pipe_);
}
void zmq::pull_t::xpipe_terminated (pipe_t *pipe_)
{
_fq.pipe_terminated (pipe_);
}
int zmq::pull_t::xrecv (msg_t *msg_)
{
return _fq.recv (msg_);
}
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PULL_HPP_INCLUDED__
#define __ZMQ_PULL_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
#include "fq.hpp"
namespace zmq
{
class ctx_t;
class pipe_t;
class msg_t;
class io_thread_t;
class pull_t ZMQ_FINAL : public socket_base_t
{... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#incl<|fim_suffix|>return _lb.send (msg_);
}
bool zmq::push_t::xhas_out ()
{
return _lb.has_out ();
}
<|fim_middle|>ude "macros.hpp"
#include "push.hpp"
#include "pipe.hpp"
#include "err.hpp"
#include "msg.hpp"
zmq::push_t::push_t (c... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PUSH_HPP_INCLUDED__
#define __ZMQ_PUSH_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
#include "lb.hpp"
namespace zmq
{
class ctx_t;
class pipe_t;
class msg_t;
class io_thread_t;
class push_t ZMQ_FINAL : public socket_base_t
{... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>::xsetsockopt (int option_,
const void *optval_,
size_t optvallen_)
{
if (optvallen_ != sizeof (int) || *static_cast<const int *> (optval_) < 0) {
errno = EINVAL;
return -1;
}
if (option_ == ZMQ_XPUB_NODROP)
... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_RADIO_HPP_INCLUDED__
#define __ZMQ_RADIO_HPP_INCLUDED__
#include <map>
#include <string>
#include <vector>
#include "socket_base.hpp"
#include "session_base.hpp"
#include "dist.hpp"
#include "msg.hpp"
namespace zmq
{
class ctx_t;
class pipe_t;
class io_thread_t;
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ength ());
_size.add (1);
current_node.set_refcount (current_node.refcount () + 1);
return current_node.refcount () == 1;
}
bool zmq::radix_tree_t::rm (const unsigned char *key_, size_t key_size_)
{
const match_result_t match_result = match (key_, key_size_);
const size_t key_bytes_m... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>const unsigned char *key_, size_t key_size_, bool is_lookup_) const;
node_t _root;
atomic_counter_t _size;
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef RADIX_TREE_HPP
#define RADIX_TREE_HPP
#include <stddef.h>
#include "stdint.hpp"
#include "atomic_counter.hpp"
//... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>manage_random (bool init_)
{
#if defined(ZMQ_USE_LIBSODIUM)
if (init_) {
// sodium_init() is now documented as thread-safe in recent versions
int rc = sodium_init ();
zmq_assert (rc != -1);
#if defined(ZMQ_LIBSODIUM_RANDOMBYTES_CLOSE)
} else {
// randombytes_close ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>at it can be called
// from multiple threads, each with its own context, and from
// the various zmq_utils curve functions safely.
void random_open ();
void random_close ();
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_RANDOM_HPP_INCLUDED__
#define __ZMQ_RANDOM_HPP_INCLU... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include <stdlib.h>
#include <string.h>
#include "raw_decoder.hpp"
#include "err.hpp"
zmq::raw_decoder_t::raw_decoder_t (size_t bufsize_) : _allocator (bufsize_, 1)
{
const int rc = _in_progress.init ();
errno_assert (rc == 0);
}... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>de (const unsigned char *data_, size_t size_, size_t &bytes_used_);
msg_t *msg () { return &_in_progress; }
void resize_buffer (size_t) {}
private:
msg_t _in_progress;
shared_message_memory_allocator _allocator;
ZMQ_NON_COPYABLE_NOR_MOVABLE (raw_decoder_t)
};
}
#endif
<|fim_pre... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>
// Write 0 bytes to the batch and go to message_ready state.
next_step (NULL, 0, &raw_encoder_t::raw_message_ready, true);
}
zmq::raw_encoder_t::~raw_encoder_t ()
{
}
void zmq::raw_encoder_t::raw_message_ready ()
{
next_step (in_progress ()->data (), in_progress ()->size (),
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>y ();
ZMQ_NON_COPYABLE_NOR_MOVABLE (raw_encoder_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_RAW_ENCODER_HPP_INCLUDED_<|fim_middle|>_
#define __ZMQ_RAW_ENCODER_HPP_INCLUDED__
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include "encoder.hpp"
n... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> = new (std::nothrow) raw_decoder_t (_options.in_batch_size);
alloc_assert (_decoder);
_next_msg = &raw_engine_t::pull_msg_from_session;
_process_msg = static_cast<int (stream_engine_base_t::*) (msg_t *)> (
&raw_engine_t::push_raw_msg_to_session);
properties_t properties;
if (i... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_RAW_ENGINE_HPP_INCLUDED__
#define __ZMQ_RAW_ENGINE_HPP_INCLUDED__
#include <stddef.h>
#include "fd.hpp"
#include "i_engine.hpp"
#include "io_object.hpp"
#include "i_encoder.hpp"
#include "i_decoder.hpp"
#include "options.hpp"
#include "socket_base.hp... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>_poller (NULL),
_sockets (0),
_terminating (false)
{
if (!_mailbox.valid ())
return;
_poller = new (std::nothrow) poller_t (*ctx_);
alloc_assert (_poller);
if (_mailbox.get_fd () != retired_fd) {
_mailbox_handle = _poller->add_fd (_mailbox.get_fd (), this);
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_REAPER_HPP_INCLUDED__
#define __ZMQ_REAPER_HPP_INCLUDED__
#include "object.hpp"
#include "mailbox.hpp"
#include "poller.hpp"
#include "i<|fim_suffix|> void timer_event (int id_);
private:
// Command handlers.
void process_stop ();
void... | fim | zeromq/libzmq | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.