summaryrefslogtreecommitdiff
path: root/doc/transports_api.txt
diff options
context:
space:
mode:
authorJoe <joe@joelightning.com>2011-11-10 11:31:23 +0000
committerJoe <joe@joelightning.com>2011-11-10 11:31:23 +0000
commitc40170cb03e41bd1efe775bbd430a50da6cdeea4 (patch)
tree0cc4c0f5cc41c502a0dff8fdca124cab2bd0dab5 /doc/transports_api.txt
First commit, pbot-ng already works.
Diffstat (limited to 'doc/transports_api.txt')
-rw-r--r--doc/transports_api.txt101
1 files changed, 101 insertions, 0 deletions
diff --git a/doc/transports_api.txt b/doc/transports_api.txt
new file mode 100644
index 0000000..881ae58
--- /dev/null
+++ b/doc/transports_api.txt
@@ -0,0 +1,101 @@
+Transport modules
+=================
+
+Transport modules is a feature that allows different ways to connect to the server.
+They may support different systems and/or different features.
+
+
+File descriptors
+================
+If a module need to use a file descriptor it should use FD 3 and 4.
+If more than two are needed, the module can try higher but that may be used
+for other things in the future.
+
+
+Configuration
+=============
+Additional configuration variables for a module should follow this naming scheme:
+config_transport_transportname_variablename
+Example:
+config_transport_stunnel_path
+
+
+Variables
+=========
+The module defines a variable called $transport_supports
+It is a space separated list of supported features. Current ones:
+ * ipv4 - Supports IPv4
+ * ipv6 - Supports IPv6
+ * nossl - Supports making non-SSL connections
+ * ssl - Supports SSL
+ * bind - Supports using a specific IP when connecting
+This variable only needs to be set after transport_check_support has run
+
+
+Functions
+=========
+The function names below should not be unique for the module like with
+normal modules. You can only use one transport module at a time.
+
+
+transport_check_support()
+ Check if all the stuff needed to use this transport is available
+ on this system.
+ Return status:
+ 0 = Yes
+ 1 = No
+
+
+transport_connect()
+ Try to connect
+ Return status:
+ 0 = Connection successful
+ 1 = Connection failed
+ Parameters:
+ $1 = Hostname/IP
+ $2 = Port
+ $3 = If 1 use SSL. If the module does not support it, just ignore it.
+ $3 = IP to bind to if any and if supported
+ If the module does not support it, just ignore it.
+
+
+transport_disconnect()
+ Called to close connection
+ Parameters:
+ None
+ Return status:
+ Not checked.
+ Notes:
+ The module must handle this getting called even when not connected or when
+ partly connected (it should clean up any program the module is running in
+ the background on a ping time out for example).
+
+
+transport_alive()
+ Called to check if connection is still alive.
+ Return status
+ 0 If connection is still alive.
+ 1 If it isn't alive.
+ Notes:
+ This function should be low overhead, it gets called quite often.
+
+
+
+transport_read_line()
+ Return a line in the variable $line.
+ Return status:
+ 0 = Success
+ 1 = Connection has failed (timeout or whatever)
+ Notes:
+ The transport module should remove any trailing \r and/or \n (CR and/or LF)
+ from the string before it returns it.
+
+
+transport_write_line()
+ Send a line
+ Parameters:
+ $* = send this
+ Return status:
+ Not checked.
+ Notes:
+ The transport module should add a \n (LF) to the end of the data it get.