├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── doc ├── highlight.pack.js ├── index.html ├── mirage-zmq │ ├── Mirage_zmq │ │ ├── .dune-keep │ │ ├── Context │ │ │ └── index.html │ │ ├── Socket_tcp │ │ │ └── index.html │ │ └── index.html │ └── index.html └── odoc.css ├── perf ├── REQ-REP │ ├── client │ │ ├── build.sh │ │ └── client.cpp │ ├── cpp_server │ │ ├── build.sh │ │ ├── server │ │ └── server.cpp │ ├── java_server │ │ ├── build.sh │ │ ├── pom.xml │ │ ├── run_server.sh │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── Rep.java │ ├── mirage_server │ │ ├── build.sh │ │ ├── config.ml │ │ ├── init.sh │ │ ├── mem.sh │ │ ├── run_server.sh │ │ └── unikernel.ml │ └── timer_client │ │ ├── build.sh │ │ ├── client │ │ ├── client.cpp │ │ └── timer.sh ├── libzmq │ ├── local │ │ ├── cpp_lat │ │ │ ├── build.sh │ │ │ ├── local_lat.cpp │ │ │ └── run.sh │ │ ├── cpp_thr │ │ │ ├── build.sh │ │ │ ├── local_thr.cpp │ │ │ └── run.sh │ │ ├── java_lat │ │ │ ├── build.sh │ │ │ ├── pom.xml │ │ │ ├── run_server.sh │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── LocalLat.java │ │ ├── java_thr │ │ │ ├── build.sh │ │ │ ├── pom.xml │ │ │ ├── run_server.sh │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── LocalThr.java │ │ └── unikernel_lat │ │ │ ├── build.sh │ │ │ ├── config.ml │ │ │ ├── local_lat.ml │ │ │ ├── run_server.sh │ │ │ └── start_unikernel.sh │ └── remote │ │ ├── cpp_lat │ │ ├── build.sh │ │ ├── remote_lat.cpp │ │ └── run.sh │ │ ├── cpp_thr │ │ ├── build.sh │ │ ├── remote_thr.cpp │ │ └── run.sh │ │ ├── java_thr │ │ ├── build.sh │ │ ├── pom.xml │ │ ├── run_server.sh │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── RemoteThr.java │ │ └── unikernel_thr │ │ ├── build.sh │ │ ├── config.ml │ │ ├── remote_thr.ml │ │ └── run_server.sh ├── plot_cpu_vs_time.py ├── plot_latency_vs_msg_size.py ├── plot_latency_vs_no_clients.py ├── plot_mem_vs _time.py └── plot_throughput_vs_msg_size.py ├── src ├── dune ├── mirage-zmq.opam ├── mirage_zmq.ml └── mirage_zmq.mli └── test ├── DEALER ├── dealer.py ├── dealer_bind.py ├── expected_output.txt ├── expected_output_against_router.txt ├── expected_output_bind.txt ├── test.sh ├── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml └── unikernel_bind │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── IDENTITY ├── expected_output.txt ├── router.py ├── test.sh └── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── PAIR ├── expected_output.txt ├── pair.py ├── test.sh ├── unikernel1 │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml └── unikernel2 │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── PLAIN ├── client.py ├── client_unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── server.py ├── server_unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml └── test.sh ├── PUB ├── pub.py ├── test.sh └── unikernel │ ├── build.sh │ ├── config.ml │ ├── run_server.sh │ └── unikernel.ml ├── PULL ├── expected_output.txt ├── pull.py ├── test.sh └── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── PUSH ├── push.py ├── test.sh └── unikernel │ ├── build.sh │ ├── config.ml │ ├── run_server.sh │ └── unikernel.ml ├── Queue_size ├── PULL_slow_receive │ └── pull.py ├── PUSH_send_limited │ ├── build.sh │ ├── config.ml │ ├── run_server.sh │ └── unikernel.ml └── SUB_receive_limited │ ├── build.sh │ ├── config.ml │ ├── run_server.sh │ └── unikernel.ml ├── REP ├── expected_output.txt ├── rep.py ├── test.sh └── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── REQ ├── expected_output.txt ├── req.py ├── test.sh └── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── ROUTER ├── expected_output.txt ├── expected_output_against_router.txt ├── router.py ├── router_connect.py ├── test.sh ├── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── expected_output_against_router.txt │ ├── run_server.sh │ └── unikernel.ml └── unikernel_connect │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── SUB ├── sub.py ├── test.sh └── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml ├── XPUB ├── test.sh ├── unikernel │ ├── build.sh │ ├── config.ml │ ├── run_server.sh │ └── unikernel.ml └── xpub.py ├── XSUB ├── test.sh ├── unikernel │ ├── build.sh │ ├── config.ml │ ├── expected_output.txt │ ├── run_server.sh │ └── unikernel.ml └── xsub.py ├── build_all.sh ├── clean_all.sh ├── example_load_balancer ├── build.sh ├── config.ml └── unikernel.ml ├── test_all.sh └── trie.ml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.annot 2 | *.cmo 3 | *.cma 4 | *.cmi 5 | *.a 6 | *.o 7 | *.cmx 8 | *.cmxs 9 | *.cmxa 10 | 11 | # ocamlbuild working directory 12 | _build/ 13 | 14 | # ocamlbuild targets 15 | *.byte 16 | *.native 17 | 18 | # oasis generated files 19 | setup.data 20 | setup.log 21 | 22 | .vscode/ 23 | 24 | *.byte 25 | *.depends 26 | _digests 27 | *.where 28 | _log 29 | _build/ 30 | *.swp 31 | lib 32 | Makefile 33 | .mirage.config 34 | key_gen.ml 35 | main.ml 36 | *.native 37 | myocamlbuild.ml 38 | src/dune-project 39 | *.ctf 40 | *.csv 41 | 42 | test/**/mirage_zmq.ml 43 | test/**/mirage_zmq.mli 44 | test/REQ-REP/client/hw_client 45 | test/REQ-REP/server/network 46 | src/.merlin 47 | test/**/*.opam 48 | example_snippets/**/*.opam 49 | perf/REQ-REP/client/client 50 | perf/REQ-REP/client/server 51 | **/.idea 52 | **/*.class 53 | **/.merlin 54 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright 2018-2019 Huiyao Zheng 4 | 5 | Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mirage-zmq 2 | 3 | Part II Project: A ZeroMQ implementation for MirageOS 4 | 5 | ## RFCs implemented 6 | 7 | - 23/ZMTP 8 | 9 | - 24/ZMTP-PLAIN 10 | 11 | - 28/REQREP 12 | 13 | - 29/PUBSUB 14 | 15 | - 30/PIPELINE 16 | 17 | - 31/EXPAIR 18 | -------------------------------------------------------------------------------- /doc/highlight.pack.js: -------------------------------------------------------------------------------- 1 | /*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */ 2 | !function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,"&").replace(//g,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function u(e){s+=""}function c(e){("start"===e.event?o:u)(e.node)}for(var l=0,s="",f=[];e.length||r.length;){var g=i();if(s+=n(a.substring(l,g[0].offset)),l=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===l);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return s+n(a.substr(l))}function l(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},u=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?u("keyword",a.k):x(a.k).forEach(function(e){u(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return l("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var c=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=c.length?t(c.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function l(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":I.classPrefix,i='',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=l(E,r),e?(B+=e[1],a+=p(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!y[E.sL])return n(k);var t=e?f(E.sL,k,!0,x[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(B+=t.r),e&&(x[E.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=null!=E.sL?d():h(),k=""}function v(e){L+=e.cN?p(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(k+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),b(),t.rB||t.eB||(k=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),b(),a.eE&&(k=n));do E.cN&&(L+=C),E.skip||(B+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return k+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var R,E=i||N,x={},L="";for(R=E;R!==N;R=R.parent)R.cN&&(L=p(R.cN,"",!0)+L);var k="",B=0;try{for(var M,j,O=0;;){if(E.t.lastIndex=O,M=E.t.exec(t),!M)break;j=m(t.substring(O,M.index),M[0]),O=M.index+j}for(m(t.substr(O)),R=E;R.parent;R=R.parent)R.cN&&(L+=C);return{r:B,value:L,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function g(e,t){t=t||I.languages||x(y);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return I.tabReplace||I.useBR?e.replace(M,function(e,n){return I.useBR&&"\n"===e?"
":I.tabReplace?n.replace(/\t/g,I.tabReplace):""}):e}function h(e,n,t){var r=n?L[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function d(e){var n,t,r,o,l,s=i(e);a(s)||(I.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,l=n.textContent,r=s?f(s,l,!0):g(l),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),l)),r.value=p(r.value),e.innerHTML=r.value,e.className=h(e.className,s,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){I=o(I,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,d)}}function m(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function N(n,t){var r=y[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function R(){return x(y)}function w(e){return e=(e||"").toLowerCase(),y[e]||y[L[e]]}var E=[],x=Object.keys,y={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="
",I={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=d,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("ocaml",function(e){return{aliases:["ml"],k:{keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref",literal:"true false"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:"\\[(\\|\\|)?\\]|\\(\\)",r:0},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"type",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*",r:0},e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}}); -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | index 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

OCaml package documentation

13 |
    14 |
  1. mirage-zmq 0.1
  2. 15 |
16 |
17 |
18 | 19 | -------------------------------------------------------------------------------- /doc/mirage-zmq/Mirage_zmq/.dune-keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huiyaozheng/Mirage-zmq/af288a3378a7c357bd5646a3abf4fd5ae777369b/doc/mirage-zmq/Mirage_zmq/.dune-keep -------------------------------------------------------------------------------- /doc/mirage-zmq/Mirage_zmq/Context/index.html: -------------------------------------------------------------------------------- 1 | 2 | Context (mirage-zmq.Mirage_zmq.Context)

Module Mirage_zmq.Context

A context contains a set of default options (queue size). New sockets created in a context inherits the default options.

type t
val create_context : unit -> t

Create a new context with default queue sizes.

val set_default_queue_size : t -> int -> unit

Set the default queue size for this context. The queue size is measured in the number of messages in the queue.

val get_default_queue_size : t -> int

Get the default queue size for this context.

-------------------------------------------------------------------------------- /doc/mirage-zmq/Mirage_zmq/Socket_tcp/index.html: -------------------------------------------------------------------------------- 1 | 2 | Socket_tcp (mirage-zmq.Mirage_zmq.Socket_tcp)

Module Mirage_zmq.Socket_tcp

Due to the characteristics of a unikernel, we need the network stack module to create TCP sockets

Parameters

  • S : Mirage_stack_lwt.V4

Signature

type t
val create_socket : Context.t -> ?⁠mechanism:mechanism_type -> socket_type -> t

Create a socket in the given context, mechanism and type

val set_plain_credentials : t -> string -> string -> unit

Set user name and password for a socket of PLAIN mechanism. Call this function before connect or bind.

val set_plain_user_list : t -> (string * string) list -> unit

Set the admissible password list for a socket of PLAIN mechanism. Call this function before connect or bind.

val set_identity : t -> string -> unit

Set the IDENTITY property of a socket. Call this function before connect or bind.

val set_incoming_queue_size : t -> int -> unit

Set the maximum capacity (size) of the incoming queue in terms of the number of messages.

val set_outgoing_queue_size : t -> int -> unit

Set the maximum capacity (size) of the outgoing queue in terms of the number of messages.

val subscribe : t -> string -> unit

Add a subscription topic to SUB/XSUB socket.

val unsubscribe : t -> string -> unit

Remove a subscription topic from SUB/XSUB socket

val recv : t -> message_type Lwt.t

Receive a message from the socket, according to the semantics of the socket type. The returned promise is not resolved until a message is available.

val send : t -> message_type -> unit Lwt.t

Send a message to the connected peer(s), according to the semantics of the socket type. The returned promise is not resolved until the message enters the outgoing queue(s).

val send_blocking : t -> message_type -> unit Lwt.t

Send a message to the connected peer(s). The returned promise is not resolved until the message has been sent by the TCP connection.

val bind : t -> int -> S.t -> unit

Bind the socket to a local TCP port, so the socket will accept incoming connections.

val connect : t -> string -> int -> S.t -> unit Lwt.t

Connect the socket to a remote IP address and port.

-------------------------------------------------------------------------------- /doc/mirage-zmq/Mirage_zmq/index.html: -------------------------------------------------------------------------------- 1 | 2 | Mirage_zmq (mirage-zmq.Mirage_zmq)

Module Mirage_zmq

exception No_Available_Peers
exception Incorrect_use_of_API of string

Raised when the function calls are invalid as defined by the RFCs, e.g. calling recv before send on a REQ socket.

exception Connection_closed

Raised when the connection that is the target of send/source of recv unexpectedly closes. Catch this exception to re-try the current operation on another connection if available.

type socket_type =
| REQ
| REP
| DEALER
| ROUTER
| PUB
| XPUB
| SUB
| XSUB
| PUSH
| PULL
| PAIR

Each ZMTP socket type has a corresponding type here.

type mechanism_type =
| NULL
| PLAIN

NULL and PLAIN security mechanisms are implemented in Mirage-zmq.

type message_type =
| Data of string
| Identity_and_data of string * string

All socket types, except ROUTER, send and receive Data. ROUTER sends and receives Identity_and_data.

module Context : sig ... end

A context contains a set of default options (queue size). New sockets created in a context inherits the default options.

module Socket_tcp : functor (S : Mirage_stack_lwt.V4) -> sig ... end

Due to the characteristics of a unikernel, we need the network stack module to create TCP sockets

-------------------------------------------------------------------------------- /doc/mirage-zmq/index.html: -------------------------------------------------------------------------------- 1 | 2 | index (mirage-zmq.index)

mirage-zmq index

Library mirage-zmq

The entry point of this library is the module: Mirage_zmq.

-------------------------------------------------------------------------------- /doc/odoc.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* Copyright (c) 2016 The odoc contributors. All rights reserved. 3 | Distributed under the ISC license, see terms at the end of the file. 4 | odoc 1.4.0 */ 5 | 6 | /* Fonts */ 7 | @import url('https://fonts.googleapis.com/css?family=Fira+Mono:400,500'); 8 | @import url('https://fonts.googleapis.com/css?family=Noticia+Text:400,400i,700'); 9 | @import url('https://fonts.googleapis.com/css?family=Fira+Sans:400,400i,500,500i,600,600i,700,700i'); 10 | 11 | 12 | /* Reset a few things. */ 13 | 14 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { 15 | margin: 0; 16 | padding: 0; 17 | border: 0; 18 | font-size: inherit; 19 | font: inherit; 20 | line-height: inherit; 21 | vertical-align: baseline; 22 | text-align: inherit; 23 | color: inherit; 24 | background: transparent; 25 | } 26 | 27 | table { 28 | border-collapse: collapse; 29 | border-spacing: 0; 30 | } 31 | 32 | *, *:before, *:after { 33 | box-sizing: border-box; 34 | } 35 | 36 | html { 37 | font-size: 15px; 38 | } 39 | 40 | body { 41 | font-family: "Fira Sans", Helvetica, Arial, sans-serif; 42 | text-align: left; 43 | color: #333; 44 | background: #FFFFFF; 45 | } 46 | 47 | .content { 48 | max-width: 90ex; 49 | margin-left: calc(10vw + 20ex); 50 | margin-right: 4ex; 51 | margin-top: 20px; 52 | margin-bottom: 50px; 53 | font-family: "Noticia Text", Georgia, serif; 54 | line-height: 1.5; 55 | } 56 | 57 | .content>header { 58 | margin-bottom: 30px; 59 | } 60 | 61 | .content>header nav { 62 | font-family: "Fira Sans", Helvetica, Arial, sans-serif; 63 | } 64 | 65 | /* Basic markup elements */ 66 | 67 | b, strong { 68 | font-weight: 500; 69 | } 70 | 71 | i, em { 72 | font-style: italic; 73 | } 74 | 75 | sup { 76 | vertical-align: super; 77 | } 78 | 79 | sub { 80 | vertical-align: sub; 81 | } 82 | 83 | sup, sub { 84 | font-size: 12px; 85 | line-height: 0; 86 | margin-left: 0.2ex; 87 | } 88 | 89 | pre { 90 | margin-top: 0.8em; 91 | margin-bottom: 1.2em; 92 | } 93 | 94 | p, ul, ol { 95 | margin-top: 0.5em; 96 | margin-bottom: 1em; 97 | } 98 | ul, ol { 99 | list-style-position: outside 100 | } 101 | 102 | ul>li { 103 | margin-left: 22px; 104 | } 105 | 106 | ol>li { 107 | margin-left: 27.2px; 108 | } 109 | 110 | li>*:first-child { 111 | margin-top: 0 112 | } 113 | 114 | /* Text alignements, this should be forbidden. */ 115 | 116 | .left { 117 | text-align: left; 118 | } 119 | 120 | .right { 121 | text-align: right; 122 | } 123 | 124 | .center { 125 | text-align: center; 126 | } 127 | 128 | /* Links and anchors */ 129 | 130 | a { 131 | text-decoration: none; 132 | color: #2C5CBD; 133 | } 134 | 135 | a:hover { 136 | box-shadow: 0 1px 0 0 #2C5CBD; 137 | } 138 | 139 | /* Linked highlight */ 140 | *:target { 141 | background-color: rgba(187,239,253,0.3) !important; 142 | box-shadow: 0 0px 0 1px rgba(187,239,253,0.8) !important; 143 | border-radius: 1px; 144 | } 145 | 146 | *:hover>a.anchor { 147 | visibility: visible; 148 | } 149 | 150 | a.anchor:before { 151 | content: "#" 152 | } 153 | 154 | a.anchor:hover { 155 | box-shadow: none; 156 | text-decoration: none; 157 | color: #555; 158 | } 159 | 160 | a.anchor { 161 | visibility: hidden; 162 | position: absolute; 163 | /* top: 0px; */ 164 | /* margin-left: -3ex; */ 165 | margin-left: -1.3em; 166 | font-weight: normal; 167 | font-style: normal; 168 | padding-right: 0.4em; 169 | padding-left: 0.4em; 170 | /* To remain selectable */ 171 | color: #d5d5d5; 172 | } 173 | 174 | .spec > a.anchor { 175 | margin-left: -2.3em; 176 | padding-right: 0.9em; 177 | } 178 | 179 | .xref-unresolved { 180 | color: #2C5CBD; 181 | } 182 | .xref-unresolved:hover { 183 | box-shadow: 0 1px 0 0 #CC6666; 184 | } 185 | 186 | /* Section and document divisions. 187 | Until at least 4.03 many of the modules of the stdlib start at .h7, 188 | we restart the sequence there like h2 */ 189 | 190 | h1, h2, h3, h4, h5, h6, .h7, .h8, .h9, .h10 { 191 | font-family: "Fira Sans", Helvetica, Arial, sans-serif; 192 | font-weight: 400; 193 | margin: 0.5em 0 0.5em 0; 194 | padding-top: 0.1em; 195 | line-height: 1.2; 196 | overflow-wrap: break-word; 197 | } 198 | 199 | h1 { 200 | font-weight: 500; 201 | font-size: 2.441em; 202 | margin-top: 1.214em; 203 | } 204 | 205 | h1 { 206 | font-weight: 500; 207 | font-size: 1.953em; 208 | box-shadow: 0 1px 0 0 #ddd; 209 | } 210 | 211 | h2 { 212 | font-size: 1.563em; 213 | } 214 | 215 | h3 { 216 | font-size: 1.25em; 217 | } 218 | 219 | small, .font_small { 220 | font-size: 0.8em; 221 | } 222 | 223 | h1 code, h1 tt { 224 | font-size: inherit; 225 | font-weight: inherit; 226 | } 227 | 228 | h2 code, h2 tt { 229 | font-size: inherit; 230 | font-weight: inherit; 231 | } 232 | 233 | h3 code, h3 tt { 234 | font-size: inherit; 235 | font-weight: inherit; 236 | } 237 | 238 | h3 code, h3 tt { 239 | font-size: inherit; 240 | font-weight: inherit; 241 | } 242 | 243 | h4 { 244 | font-size: 1.12em; 245 | } 246 | 247 | 248 | /* Preformatted and code */ 249 | 250 | tt, code, pre { 251 | font-family: "Fira Mono", courier; 252 | font-weight: 400; 253 | } 254 | 255 | pre { 256 | padding: 0.1em; 257 | border: 1px solid #eee; 258 | border-radius: 5px; 259 | overflow-x: auto; 260 | } 261 | 262 | p code, li code { 263 | background-color: #f6f8fa; 264 | color: #0d2b3e; 265 | border-radius: 3px; 266 | padding: 0 0.3ex; 267 | } 268 | 269 | p a > code { 270 | color: #2C5CBD; 271 | } 272 | 273 | /* Code blocks (e.g. Examples) */ 274 | 275 | pre code { 276 | font-size: 0.893rem; 277 | } 278 | 279 | /* Code lexemes */ 280 | 281 | .keyword { 282 | font-weight: 500; 283 | } 284 | 285 | /* Module member specification */ 286 | 287 | .spec:not(.include), .spec.include details summary { 288 | background-color: #f6f8fa; 289 | border-radius: 3px; 290 | border-left: 4px solid #5c9cf5; 291 | border-right: 5px solid transparent; 292 | padding: 0.35em 0.5em; 293 | } 294 | 295 | .spec.include details summary:hover { 296 | background-color: #ebeff2; 297 | } 298 | 299 | dl, div.spec, .doc, aside { 300 | margin-bottom: 20px; 301 | } 302 | 303 | dl > dd { 304 | padding: 0.5em; 305 | } 306 | 307 | dd> :first-child { 308 | margin-top: 0; 309 | } 310 | 311 | dl:last-child, dd> :last-child, aside:last-child, article:last-child { 312 | margin-bottom: 0; 313 | } 314 | 315 | dt+dt { 316 | margin-top: 15px; 317 | } 318 | 319 | section+section, section > header + dl { 320 | margin-top: 25px; 321 | } 322 | 323 | .spec.type .variant { 324 | margin-left: 2ch; 325 | } 326 | .spec.type .variant p { 327 | margin: 0; 328 | font-style: italic; 329 | } 330 | .spec.type .record { 331 | margin-left: 2ch; 332 | } 333 | .spec.type .record p { 334 | margin: 0; 335 | font-style: italic; 336 | } 337 | 338 | div.def { 339 | margin-top: 0; 340 | text-indent: -2ex; 341 | padding-left: 2ex; 342 | } 343 | 344 | div.def+div.doc { 345 | margin-left: 1ex; 346 | margin-top: 2.5px 347 | } 348 | 349 | div.doc>*:first-child { 350 | margin-top: 0; 351 | } 352 | 353 | /* The elements other than heading should be wrapped in