x.chnl[#].dst - Destination Hooks
The sequence of destination callback hooks is:
onrun
/ [onpush]
/ onconnect
(if success) / ondisconnect
… repeat through onpush
if multiple interfaces configured.
x.chnl[#].dst.onconnect = function(channelno, typedest, peer, modem)
Called when the ip.buffer connects to the remote end (either push or pull). #Firmware/v282
Parameter | Type | Description |
---|---|---|
'channelno' |
integer | channel number. |
'typedest' |
string | type of the delivery. e.g. 'tcpc', 'httpc' |
'peer' |
string | remote IP address (if applicable) |
'modem' |
boolean | whether running over modem. |
x.chnl[#].dst.ondisconnect = function(channelno, typedest, peer, modem, successful, moretodo, transferred)
Called when the ip.buffer connects to the remote end (either push or pull). #Firmware/v282
Parameter | Type | Description |
---|---|---|
'channelno' |
integer | channel number. |
'typedest' |
string | type of the delivery. e.g. 'tcpc', 'httpc' |
'peer' |
string | remote IP address (if applicable) |
'modem' |
boolean | whether running over modem. |
'successful' |
boolean | whether transfer was successful. |
'moretodo' |
boolean | whether there's another transfer required. |
'transferred' |
integer | number of bytes transferred this time. |
onconnect
is only called if the peer is reached.
In contrast, ondisconnect
is always called as the delivery process closes down.
x.chnl[#].dst.onprefix = function(channelno, typedest, str)
Called when the ip.buffer inserts the prefix string into the data stream. #Firmware/v282
Parameter | Type | Description |
---|---|---|
'channelno' |
integer | channel number. |
'typedest' |
string | type of the delivery. e.g. 'tcpc', 'httpc' |
'str' |
string | the existing string. |
Return a string to replace the prefix.
x.chnl[#].dst.onpush = function(channelno, typedest, action, reason)
Called as a push-delivery is started. #Firmware/v282
This is called after 'onrun'
and will be called for each interface chosen for delivery.
action integer |
Description |
---|---|
0 |
Finish |
1 |
LAN try |
2 |
LAN skip (reason given) |
3 |
LAN fail (reason given) |
4 |
Modem try |
5 |
Modem skip (reason given) |
6 |
Modem fail (reason given) |
'reason'
is the string reason (if applicable)
Returning a number in the range of 0-6 will change the flow of attempts. Use with extreme caution! (Easy to create endless loops)
x.chnl[#].dst.onrun = function(channelno, typedest)
Called as the destination delivery task is created for running. #Firmware/v282
Parameter | Type | Description |
---|---|---|
'channelno' |
integer | channel number. |
'typedest' |
string | type of the delivery. e.g. 'tcpc', 'httpc' |
x.chnl[#].dst.onsuffix = function(channelno, typedest, str)
Called when the ip.buffer inserts the suffix string into the data stream. #Firmware/v282
Parameter | Type | Description |
---|---|---|
'channelno' |
integer | channel number. |
'typedest' |
string | type of the delivery. e.g. 'tcpc', 'httpc' |
'str' |
string | the existing string. |
Return a string to replace the prefix.