102 lines
2.5 KiB
Plaintext
102 lines
2.5 KiB
Plaintext
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.
|