I'm running into some problems when receiving certain characters in MSDP subnegotiation sequences, and was wondering if anyone might know the cause, and perhaps a solution. For testing purposes, I used the following simple function:
local MSDP = 69
function OnPluginTelnetSubnegotiation (type, data)
if type == MSDP then
testdata = ""
for i=0,string.len(data),1 do
if string.byte(data,i) ~= nil then
testdata = testdata..string.byte(data,i).." "
end -- if
end -- loop
Note('['..testdata..']')
end -- if
end -- OnPluginTelnetSubnegotiation
The mud sends the following sequence:
IAC SB MSDP MSDP_VAR "TEST" MSDP_VAL "abcde*edcba" IAC SE
EDIT: Corrected the order of MSDP_VAR and MSDP_VAL.
Note that the quotes aren't sent, they just represent the start and end of a string. MSDP_VAR is 1, MSDP_VAL is 2, and the * is replaced with values 1-12. The results are between the square brackets, as follows:
1: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 1 101 100 99 98 97] IAC SE
2: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 2 101 100 99 98 97] IAC SE
3: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101] IAC SE
4: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 101 100 99 98 97] IAC SE
5: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101] IAC SE
6: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 6 101 100 99 98 97] IAC SE
7: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 7 101 100 99 98 97] IAC SE
8: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 8 101 100 99 98 97] IAC SE
9: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 100 99 98 97] IAC SE
10: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 10 101 100 99 98 97] IAC SE
11: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 11 101 100 99 98 97] IAC SE
12: IAC SB MSDP [1 84 69 83 84 2 97 98 99 100 101 12 101 100 99 98 97] IAC SE
As you can see, most of them are correct, but four of the characters have unexpected results:
3 (ETX/end of text) chops off the sequence and corrupts the next one.
4 (EOT/end of transmission) vanishes from the sequence.
5 (ENQ/enquiry) chops off the sequence and corrupts the next one.
9 (TAB/horizontal tab) vanishes from the sequence and takes the next character with it.
Now I can understand these characters being stripped from the in-band stream, but this is an out-of-band subnegotiation sequence.
Is this a bug, or an unavoidable side-effect of something else?
I tested it with versions 4.51 and 4.73, both had the same results.
|