test_security_no_zap_handler.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #include "testutil.hpp"
4 #include "testutil_unity.hpp"
5 
7 
9 {
10  // We first test client/server with a ZAP domain but with no handler
11  // If there is no handler, libzmq should ignore the ZAP option unless
12  // ZMQ_ZAP_ENFORCE_DOMAIN is set
16  zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 5));
20  bounce (server, client);
23 }
24 
26 {
27 #ifdef ZMQ_ZAP_ENFORCE_DOMAIN
28  // Now set ZMQ_ZAP_ENFORCE_DOMAIN which strictly enforces the ZAP
29  // RFC but is backward-incompatible, now it should fail
32  int required = 1;
34  zmq_setsockopt (server, ZMQ_ZAP_ENFORCE_DOMAIN, &required, sizeof (int)));
36  zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 5));
39 
44 #endif
45 }
46 
47 int main ()
48 {
50 
51  UNITY_BEGIN ();
54  return UNITY_END ();
55 }
bounce
static void bounce(void *socket_)
Definition: test_req_relaxed.cpp:50
UNITY_END
return UNITY_END()
ZMQ_ZAP_ENFORCE_DOMAIN
#define ZMQ_ZAP_ENFORCE_DOMAIN
Definition: zmq_draft.h:25
RUN_TEST
#define RUN_TEST(func)
Definition: unity_internals.h:615
SETUP_TEARDOWN_TESTCONTEXT
#define SETUP_TEARDOWN_TESTCONTEXT
Definition: testutil_unity.hpp:172
bind_loopback_ipv4
void bind_loopback_ipv4(void *socket_, char *my_endpoint_, size_t len_)
Definition: testutil_unity.cpp:246
client
void client(int num)
Definition: test_multithread.cpp:134
test_context_socket_close_zero_linger
void * test_context_socket_close_zero_linger(void *socket_)
Definition: testutil_unity.cpp:215
zmq_connect
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
Definition: zmq.cpp:307
testutil_unity.hpp
ZMQ_DEALER
#define ZMQ_DEALER
Definition: zmq.h:263
zmq_setsockopt
ZMQ_EXPORT int zmq_setsockopt(void *s_, int option_, const void *optval_, size_t optvallen_)
Definition: zmq.cpp:250
testutil.hpp
my_endpoint
char my_endpoint[MAX_SOCKET_STRING]
Definition: test_security_curve.cpp:31
MAX_SOCKET_STRING
#define MAX_SOCKET_STRING
Definition: libzmq/tests/testutil.hpp:35
test_context_socket
void * test_context_socket(int type_)
Definition: testutil_unity.cpp:200
server
void * server
Definition: test_security_curve.cpp:29
ZMQ_ZAP_DOMAIN
#define ZMQ_ZAP_DOMAIN
Definition: zmq.h:320
expect_bounce_fail
void expect_bounce_fail(void *server_, void *client_)
Definition: testutil.cpp:107
main
int main()
Definition: test_security_no_zap_handler.cpp:47
setup_test_environment
void setup_test_environment(int timeout_seconds_)
Definition: testutil.cpp:201
UNITY_BEGIN
UNITY_BEGIN()
test_no_zap_handler
SETUP_TEARDOWN_TESTCONTEXT void test_no_zap_handler()
Definition: test_security_no_zap_handler.cpp:8
test_no_zap_handler_enforce_domain
void test_no_zap_handler_enforce_domain()
Definition: test_security_no_zap_handler.cpp:25
TEST_ASSERT_SUCCESS_ERRNO
#define TEST_ASSERT_SUCCESS_ERRNO(expr)
Definition: proxy_thr.cpp:47


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:59