/* Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file This file is part of 0MQ. 0MQ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 0MQ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include "platform.hpp" #include #include #include #include "testutil.hpp" static void * zap_handler (void *zap) { char *version = s_recv (zap); char *sequence = s_recv (zap); char *domain = s_recv (zap); char *mechanism = s_recv (zap); char *client_key = s_recv (zap); assert (streq (version, "1.0")); assert (streq (mechanism, "CURVE")); s_sendmore (zap, version); s_sendmore (zap, sequence); s_sendmore (zap, "200"); s_sendmore (zap, "OK"); s_send (zap, "anonymous"); free (version); free (sequence); free (domain); free (mechanism); free (client_key); int rc = zmq_close (zap); assert (rc == 0); return NULL; } int main (void) { #ifndef HAVE_LIBSODIUM printf ("libsodium not installed, skipping CURVE test\n"); return 0; #endif int rc; size_t optsize; int mechanism; int as_server; void *ctx = zmq_ctx_new (); assert (ctx); // Server socket will accept connections void *server = zmq_socket (ctx, ZMQ_DEALER); assert (server); // Client socket that will try to connect to server void *client = zmq_socket (ctx, ZMQ_DEALER); assert (client); // Test keys from the zmq_curve man page char client_public [] = "Yne@$w-vo