├── .gitignore ├── Makefile ├── README ├── TODO ├── doc └── overview.edoc ├── include └── gen_tcpd_types.hrl ├── rebar.config └── src ├── gen_tcpd.app.src └── gen_tcpd.erl /.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw[nop] 2 | .eunit/ 3 | rebar 4 | ebin/ 5 | doc/ 6 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | REBAR_URL ?= http://cloud.github.com/downloads/basho/rebar/rebar 2 | 3 | ifneq ($(shell which wget 2>/dev/null),) 4 | REBAR_GET ?= wget -q $(REBAR_URL) 5 | else 6 | REBAR_GET ?= curl -s -f $(REBAR_URL) >rebar 7 | endif 8 | 9 | .PHONY: all compile doc test clean clean-all 10 | 11 | all: compile doc 12 | 13 | rebar: 14 | $(REBAR_GET) 15 | chmod +x rebar 16 | 17 | compile: rebar 18 | ./rebar compile 19 | 20 | doc: rebar 21 | ./rebar doc 22 | 23 | test: rebar 24 | ./rebar eunit 25 | 26 | clean: rebar 27 | ./rebar clean 28 | 29 | clean-all: 30 | rm -rf rebar ebin doc/*{-info,.html,.css,.png} 31 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | gen_tcpd behaviour 2 | ====================== 3 | 4 | gen_tcpd is an erlang behaviour for TCP accept loops. gen_tcpd lets you 5 | implement a tcp server with lots of flexibility, but takes care of 6 | dealing with accepting new connections and delivers them using a 7 | callback. Since gen_tcpd is an OTP behaviour your module will be put 8 | under a supervisor and will integrate naturally in any OTP application. 9 | 10 | 11 | Authors 12 | --------- 13 | 14 | Martin Carlson, martin@martinc.eu 15 | Oscar Hellström, oscar@hellstrom.st 16 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | - Give the option to start not linked children process 2 | -------------------------------------------------------------------------------- /doc/overview.edoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oscarh/gen_tcpd/c84b4ea9903f8629b5b687124a9e81255a003b65/doc/overview.edoc -------------------------------------------------------------------------------- /include/gen_tcpd_types.hrl: -------------------------------------------------------------------------------- 1 | -type server_ref() :: pid() | {atom(), atom()} | {global, term()}. 2 | -type gen_tcpd_socket() :: {atom(), _}. 3 | -type ip_address() :: {byte(), byte(), byte(), byte()} | 4 | { 5 | 0..65535, 0..65535, 0..65535, 0..65535, 6 | 0..65535, 0..65535, 0..65535, 0..65535 7 | }. 8 | -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [warn_unused_vars, 2 | warn_export_all, 3 | warn_shadow_vars, 4 | warn_unused_import, 5 | warn_unused_function, 6 | warn_bif_clash, 7 | warn_unused_record, 8 | warn_deprecated_function, 9 | warn_obsolete_guard, 10 | strict_validation, 11 | warn_export_vars, 12 | warn_exported_vars, 13 | warn_missing_spec, 14 | warn_untyped_record, debug_info]}. 15 | {xref_checks, [exports_not_used, undefined_function_calls]}. 16 | {cover_enabled, true}. 17 | -------------------------------------------------------------------------------- /src/gen_tcpd.app.src: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oscarh/gen_tcpd/c84b4ea9903f8629b5b687124a9e81255a003b65/src/gen_tcpd.app.src -------------------------------------------------------------------------------- /src/gen_tcpd.erl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oscarh/gen_tcpd/c84b4ea9903f8629b5b687124a9e81255a003b65/src/gen_tcpd.erl --------------------------------------------------------------------------------