Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== nng Barebones {{libnng}} bindings for CHICKEN Scheme. rep, req, pull, push, sub, pub, pair, surveyor, respondent and bus sockets are supported. Feedback and patches are very welcome! == Requirements * {{libnng}}, at least 1.3. Known to work with 1.4+. * {{libmbedtls}} (and a TLS-enabled {{libnng}}) if you plan on using TLS transport. * CHICKEN 5 with the following eggs: ** srfi-18 ** foreigners ** test and miscmacros (for tests) == Usage === Socket creation <procedure>(make-rep-socket)</procedure> <procedure>(make-req-socket)</procedure> <procedure>(make-pull-socket)</procedure> <procedure>(make-push-socket)</procedure> <procedure>(make-pub-socket)</procedure> <procedure>(make-sub-socket)</procedure> <procedure>(make-pair-socket)</procedure> <procedure>(make-surveyor-socket)</procedure> <procedure>(make-respondent-socket)</procedure> <procedure>(make-bus-socket)</procedure> Spawn a specific socket type. All sockets are closed automatically when their finalizers run. === Socket/listener/dialer options <procedure>(socket-get socket option)</procedure> <procedure>(socket-set! socket option value)</procedure> <procedure>(listener-get listener option)</procedure> <procedure>(listener-set! listener option value)</procedure> <procedure>(dialer-get dialer option)</procedure> <procedure>(dialer-set! dialer option value)</procedure> {{option}} is object-specific. Currently supported options are: * {{nng/recvtimeo}} * {{nng/sendtimeo}} * {{nng/sub-subscribe}} * {{nng/recvmaxsz}} === Listening/Dialing <procedure>(make-listener socket address)</procedure> Make listener from {{socket}} to bind to {{address}}. <procedure>(make-dialer socket address)</procedure> Make a dialer from {{socket}} to connect to {{address}}. <procedure>(listener-start! listener)</procedure> Bind listener. <procedure>(dialer-start! dialer)</procedure> Connect dialer. <procedure>(nng-listen socket address [listener])</procedure> Bind a socket to an address. <procedure>(nng-dial socket address [dialer])</procedure> Connect a socket to an address. === Send/Recv <procedure>(nng-send socket msg)</procedure> Send string {{msg}} through a socket. <procedure>(nng-recv socket [non-blocking?])</procedure> Receive msg through a socket. If {{non-blocking?}} is passed and is not false, {{nng-recv}} returns {{#f}} when it would otherwise block. Additionally, if a timeout has been set with {{nng-socket-set-recv-timeout!}}, {{#f}} is returned when said timeout is reached. === Closing <procedure>(nng-close! socket)</procedure> Close socket explicitly. <procedure>(listener-close! listener)</procedure> Close listener explicitly. Should not be necessary since listeners get close whenever their associated sockets get closed. <procedure>(dialer-close! dialer)</procedure> Same as above; usually unnecessary. === TLS Transport <procedure>(tls-register!)</procedure> Register TLS transport. Usually not necessary, but depends on how your {{libnng}} was built. <procedure>(tls-enabled?)</procedure> Check if TLS is enabled in your system. <procedure>(set-listener-tls-own-certificate! listener cert key enforce-client-auth? [pass])</procedure> Configure listener with a certificate, secret key and a (possible) passphrase. If {{enfonce-client-auth?}} is {{#t}}, it will require clients to authenticate themselves. <procedure>(set-dialer-tls-certificate! dialer chain [server-name [key [pass]]])</procedure> Configure dialer with a certificate. {{server-name}} defaults to localhost. If the certificate is its own, also provide a private key, and passphrase if applicable. == Repository https://gitlab.com/ariSun/chicken-nng == Bugs/Caveats/TODOs * Some options don’t seem to work properly yet. {{nng/recvtimeo}} isn’t particularly useful since we block the current thread with {{thread-wait-for-i/o!}} when receiving. * We use {{NNG_OPT_RECVFD}} in combination with {{thread-wait-for-i/o!}} to avoid blocking all threads. Unfortunately, this means we can’t use {{nng_ctx}}. == License Copyright 2021 Ariela Wenner arisunz at disroot dot org Licensed under MIT. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 16 to 21?