blob: 881ae586cdbbcad8dfff8a5967d4c21a703f89cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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.
|