This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minimal HTTP server in 0MQ | |
#include "czmq.h" | |
int main (void) | |
{ | |
zctx_t *ctx = zctx_new (); | |
void *router = zsocket_new (ctx, ZMQ_ROUTER); | |
zsocket_set_router_raw (router, 1); | |
int rc = zsocket_bind (router, "tcp://*:8080"); | |
assert (rc != -1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <czmq.h> | |
static void | |
listener_thread (void *args, zctx_t *ctx, void *pipe) | |
{ | |
void *listener = zsocket_new (ctx, ZMQ_SUB); | |
zsocket_set_subscribe (listener, ""); | |
int address; | |
for (address = 1; address < 255; address++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The ZeroMQ messaging library spawned a new product category of thin, | |
fast message transports that today includes JeroMQ, NullMQ, NetMQ, | |
Axon, Crossroads, Nanomsg, and more. Fast, light messaging on the LAN | |
is now a solved problem. But how about Internet scale? That means | |
security. Pieter Hintjens explains how he remixed D.J.Bernstein's | |
NaCl and CurveCP with SASL (IETF RFC 4422) to create a new ZeroMQ | |
protocol (ZMTP 3.0) and security handshake (CurveZMQ). This focus of | |
this talk will be on the design choices in ZMTP and CurveZMQ, and how | |
different kinds of architecture need different types of security. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Census Pattern | |
// Model 1, over XPUB-XSUB | |
#include "czmq.h" | |
static void | |
counter_task (void *args, zctx_t *ctx, void *pipe) | |
{ | |
void *counter = zsocket_new (ctx, ZMQ_XPUB); | |
zsocket_set_xpub_verbose (counter, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Meerkat Pattern | |
// | |
// In which we address the slow subscriber problem by asking for | |
// a show of hands before we start publishing. | |
#include "czmq.h" | |
static void | |
publisher_task (void *args, zctx_t *ctx, void *pipe) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ========================================================================= | |
CurveZMQ - authentication and confidentiality for 0MQ | |
------------------------------------------------------------------------- | |
Copyright (c) 1991-2013 iMatix Corporation <www.imatix.com> | |
Copyright other contributors as noted in the AUTHORS file. | |
This 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
# c - C compile command | |
# | |
# Copyright (c) 1996-2009 iMatix Corporation | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or (at | |
# your option) any later version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Proof of concept CurveCP handshake over 0MQ. | |
// | |
// Demonstrates a confidential, authenticated connection between | |
// two 0MQ peers (two DEALER sockets in this example). See the | |
// curvecp.org website for details of the security design. | |
// | |
// This is a flat walk-through in code with minimal abstraction. | |
// The next version of this code will be more packaged. | |
// | |
// IMPORTANT NOTE: this code has not been reviewed by security experts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exploring functionality of NaCl | |
#include <czmq.h> | |
#include <crypto_box.h> | |
#include <crypto_secretbox.h> | |
#include <randombytes.h> | |
int main (void) | |
{ | |
// Generate public+secret key pair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "czmq.h" | |
static void | |
s_test_attached (void *args, zctx_t *ctx, void *pipe) | |
{ | |
while (true) { | |
void *dealer = zsocket_new (ctx, ZMQ_DEALER); | |
if (!dealer) | |
break; | |
zsocket_connect (dealer, "tcp://localhost:9999"); |