Go to the documentation of this file.
4 #if defined(ZMQ_HAVE_WINDOWS)
8 #define close closesocket
11 #include <arpa/inet.h>
23 #define UINT16_MAX 65535
36 for (
int i = 0;
i < 10;
i++) {
47 uint16_t
event = *
reinterpret_cast<uint16_t *
> (
data);
66 recv (fd_,
buffer_ + received, bytes_ - received, 0));
70 if (received == bytes_)
99 const uint8_t zmtp_ping[12] = {4, 10, 4,
'P',
'I',
'N',
100 'G', 0, 0,
'L',
'O',
'L'};
101 uint8_t zmtp_pong[10] = {4, 8, 4,
'P',
'O',
'N',
'G',
'L',
'O',
'L'};
103 memcpy (
buffer, zmtp_ping, 12);
110 memcpy (
buffer, zmtp_ping, 12);
120 uint8_t zmtp_pooong[65] = {4, 21, 4,
'P',
'O',
'N',
'G',
'L',
'O',
'L'};
121 memset (zmtp_pooong + 10,
'z', 55);
128 const char *secret_key;
129 const char *public_key;
130 const char *server_key;
133 secret_key =
"JTKVSB%%)wK0E.X)V>+}o?pNmC{O&4W4b!Ni{Lh6";
134 public_key =
"rq:rM>}U?@Lns47E1%kR.o@n%FcmmsL/@{H8]yf7";
137 secret_key =
"D:)Q[IlAW!ahhC2ac:9*A}h:p?([4%wOTJ%JR%cs";
138 public_key =
"Yne@$w-vo<fVvi]a<NY6T1ed:M$fCG*[IaLV{hID";
139 server_key =
"rq:rM>}U?@Lns47E1%kR.o@n%FcmmsL/@{H8]yf7";
143 strlen (secret_key));
145 strlen (public_key));
148 sizeof (is_server_));
151 strlen (server_key));
169 if (set_heartbeats_) {
184 server,
"inproc://monitor-dealer",
302 "Unreliable test occasionally fails on slow CIs, ignoring");
320 #define DEFINE_TESTS(first, second, first_define, second_define) \
321 void test_heartbeat_ttl_##first##_##second () \
323 test_heartbeat_ttl (first_define, second_define); \
325 void test_heartbeat_notimeout_##first##_##second () \
327 test_heartbeat_notimeout (0, first_define, second_define); \
329 void test_heartbeat_notimeout_##first##_##second##_with_curve () \
331 test_heartbeat_notimeout (1, first_define, second_define); \
340 #ifdef ZMQ_BUILD_DRAFT_API
356 size_t value_read_size =
sizeof (value_read);
358 &value_read, &value_read_size));
398 RUN_TEST (test_heartbeat_ttl_dealer_router);
399 RUN_TEST (test_heartbeat_ttl_req_rep);
400 RUN_TEST (test_heartbeat_ttl_pull_push);
401 RUN_TEST (test_heartbeat_ttl_sub_pub);
402 RUN_TEST (test_heartbeat_ttl_pair_pair);
408 RUN_TEST (test_heartbeat_notimeout_dealer_router);
409 RUN_TEST (test_heartbeat_notimeout_req_rep);
410 RUN_TEST (test_heartbeat_notimeout_pull_push);
411 RUN_TEST (test_heartbeat_notimeout_sub_pub);
412 RUN_TEST (test_heartbeat_notimeout_pair_pair);
414 RUN_TEST (test_heartbeat_notimeout_dealer_router_with_curve);
415 RUN_TEST (test_heartbeat_notimeout_req_rep_with_curve);
416 RUN_TEST (test_heartbeat_notimeout_pull_push_with_curve);
417 RUN_TEST (test_heartbeat_notimeout_sub_pub_with_curve);
418 RUN_TEST (test_heartbeat_notimeout_pair_pair_with_curve);
420 #ifdef ZMQ_BUILD_DRAFT_API
421 RUN_TEST (test_heartbeat_ttl_client_server);
422 RUN_TEST (test_heartbeat_ttl_gather_scatter);
424 RUN_TEST (test_heartbeat_notimeout_client_server);
425 RUN_TEST (test_heartbeat_notimeout_gather_scatter);
427 RUN_TEST (test_heartbeat_notimeout_client_server_with_curve);
428 RUN_TEST (test_heartbeat_notimeout_gather_scatter_with_curve);
static void test_heartbeat_timeout(int server_type_, int mock_ping_)
void test_heartbeat_timeout_router_mock_ping()
#define TEST_ASSERT_LESS_OR_EQUAL_INT(threshold, actual)
#define ZMQ_HEARTBEAT_IVL
static void prep_server_socket(int set_heartbeats_, int is_curve_, void **server_out_, void **mon_out_, char *endpoint_, size_t ep_length_, int socket_type_)
void msleep(int milliseconds_)
ZMQ_EXPORT int zmq_socket_monitor(void *s_, const char *addr_, int events_)
#define TEST_ASSERT_TRUE(condition)
#define ZMQ_CURVE_SECRETKEY
#define ZMQ_CURVE_SERVERKEY
#define SETUP_TEARDOWN_TESTCONTEXT
static void mock_handshake(raw_socket fd_, int mock_ping_)
void bind_loopback_ipv4(void *socket_, char *my_endpoint_, size_t len_)
void send(fd_t fd_, const char(&data_)[N])
static void setup_curve(void *socket_, int is_server_)
#define TEST_ASSERT_FALSE(condition)
ZMQ_EXPORT void * zmq_msg_data(zmq_msg_t *msg_)
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
#define TEST_ASSERT_GREATER_THAN_INT(threshold, actual)
void test_setsockopt_heartbeat_ttl_more_than_max_fails()
ZMQ_EXPORT int zmq_setsockopt(void *s_, int option_, const void *optval_, size_t optvallen_)
void test_setsockopt_heartbeat_success(const int value_)
#define ZMQ_EVENT_CONNECTED
#define TEST_ASSERT_SUCCESS_RAW_ERRNO(expr)
fd_t connect_socket(const char *endpoint_, const int af_, const int protocol_)
#define DEFINE_TESTS(first, second, first_define, second_define)
char my_endpoint[MAX_SOCKET_STRING]
#define MAX_SOCKET_STRING
ZMQ_EXPORT int zmq_msg_recv(zmq_msg_t *msg_, void *s_, int flags_)
void * test_context_socket(int type_)
void test_setsockopt_heartbeat_ttl_near_zero()
#define TEST_ASSERT_EQUAL_INT(expected, actual)
ZMQ_EXPORT int zmq_msg_init(zmq_msg_t *msg_)
const uint8_t zmtp_greeting_null[64]
#define ZMQ_HEARTBEAT_TTL
#define TEST_IGNORE_MESSAGE(message)
const uint8_t zmtp_ready_dealer[43]
#define ZMQ_EVENT_ACCEPTED
#define ZMQ_EVENT_DISCONNECTED
static SETUP_TEARDOWN_TESTCONTEXT int get_monitor_event(void *monitor_)
void setup_test_environment(int timeout_seconds_)
static void test_heartbeat_ttl(int client_type_, int server_type_)
void test_setsockopt_heartbeat_ttl_max()
static void push(tarjan *t, const upb_refcounted *r)
#define TEST_ASSERT_FAILURE_ERRNO(error_code, expr)
const int heartbeat_ttl_max
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
static uint8 buffer_[kBufferSize]
GLsizei const GLfloat * value
ZMQ_EXPORT int zmq_msg_more(const zmq_msg_t *msg_)
void * test_context_socket_close(void *socket_)
#define TEST_ASSERT_SUCCESS_ERRNO(expr)
const int deciseconds_per_millisecond
void test_heartbeat_timeout_router()
ZMQ_EXPORT int zmq_getsockopt(void *s_, int option_, void *optval_, size_t *optvallen_)
#define ZMQ_CURVE_PUBLICKEY
static void recv_with_retry(raw_socket fd_, char *buffer_, int bytes_)
static void test_heartbeat_notimeout(int is_curve_, int client_type_, int server_type_)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:59