[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUDs
. -> [Folder]  General
. . -> [Subject]  Suggested protocol for server to client "out of band" messages
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Suggested protocol for server to client "out of band" messages

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2  3  4  5 6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #60 on Thu 04 Feb 2010 12:03 AM (UTC)  quote  ]
Message
Twisol said:

(Also, any chance we could get the project that builds the resources DLL (i.e. EN.DLL) uplaoded to GitHub too?)


That can be done pretty soon.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #61 on Thu 04 Feb 2010 03:25 AM (UTC)  quote  ]

Amended on Thu 04 Feb 2010 03:26 AM (UTC) by David Haley

Message
Nick Gammon said:
Anyway, what is the justification for throwing away the IAC x?

The spec says pretty clearly that IAC means "interpret the next byte as a command". My reading is that, if you don't know what the command is, you just ignore the command; you wouldn't blow up, or treat it as the 'IAC' byte. After all, if you tell me: "David: do the task", I know to do the task, but if you say: "David: do the flipperflop foo", I'll have no idea what you are talking about and will ignore you. :P (Well, actually, I'd ask you what you meant, but that's the nice thing about being able to actually communicate...)

Nick Gammon said:
Let's assume every system has some flaws, and at this stage I am trying to reduce any in my proposed system (e.g. message limits, handling of subnegotiation), and offer up simplicity and ease of use as an argument for it.

I don't think it's all that simple if you're not working in Lua on the receiving end. For example, you also now have the problem I mentioned to Twisol regarding PPI, where a Lua list-table looks like a map to Python, even though it should be creating it as a list object.

I think it's very simple and easy to use if you're working in Lua on the receiving end.

I think it makes it more difficult to standardize messages across MUDs, because that would require another layer of standardization on top of this. (ZMP provides that layer explicitly with the package mechanism, although you still obviously have to write a package spec.)
Of course, I'm not necessarily convinced that it's realistic to expect some kind of large, cross-MUD standardization effort. So, eh. Maybe this doesn't matter.


Somebody brought up the problem of a too-loosely defined protocol data format: "assignments that Lua can handle". Does this mean that you can assign arbitrary expressions, including function calls? What if you sent:

<IAC> <SB> tt="foo";hp=math.pow(2,2) <IAC><SE>

what is the expected value of hp: "math.pow(2,2)" or 4?

IMO this is a pretty serious issue.


To be clear, my statement is not that this new protocol is not good. It's that we're doing something that might already have been done. We could come up with many variations of protocols that are nice etc., repeating what's been done. (For example, we could have sent Python code, not Lua code.)
Actually I kind of like the protocol because using Lua really does make things nice and easy (if you're using Lua). 'course, I have no objection to forcing Lua. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #62 on Thu 04 Feb 2010 03:42 AM (UTC)  quote  ]

Amended on Thu 04 Feb 2010 03:51 AM (UTC) by Nick Gammon

Message
I've done more reading, and still can't see a definitive response. I understand your point about IAC, and it makes sense in many ways to say "IAC will start a new command".

But then why insist on a subnegotiation ending with IAC SE and not just SE (subnegotiation end?).

I suppose the answer is that you may want SE inside the negotiation (for example, with NAWS your window might be 240 characters wide). Thus, you precede it with IAC, and it already deals with IAC being in the sequence because you have to double it.

But in the same way you can say "well, SE on its own is just 240) then you could argue IAC on its own (not followed by a SE) is just IAC. But then maybe not. Maybe you say IAC on its own (not followed by IAC) terminates the subnegotiation. But why use SE at all then?

I suppose the answer to *that* is, until you see another byte after the IAC you don't know if it will be IAC IAC or not.

So if I sent:


IAC SB 102 <blah blah> IAC


I can't do anything yet, because the final IAC might be followed by another one in another packet. So the SE in this case is a sort of "padder" to make sure you know it is *not* an IAC after the IAC.

So I think I can make out a case that the IAC at the end is not Interpret As Command, because for one thing it could be followed by IAC, and for another it could be followed by SE which is "end of subnegotiation" not a "command" of some sort.

As for math.pow, as I suggested you interpret the script in its own environment, so it is a totally empty environment. No functions are there, no _G variable, nothing.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #63 on Thu 04 Feb 2010 03:49 AM (UTC)  quote  ]
Message
Now I have a question for the ATCP experts.

The next issue that arises from having MUSHclient call a plugin with *any* subnegotiation is, which ones should it agree to handle?

Eg. I notice that the ATCP spec says the server sends:


IAC DO ATCP       (255 253 200)


and the client should reply:


IAC WILL ATCP     (255 251 200)


Fair enough. But if I automatically handle all subnegotiations then should I also agree to the IAC DO ATCP, even if no plugin is installed that will use it?

So one possibility is to agree to all sub-negotiation requests, as in "yeah, yeah send me the data, whatever".

The other is for a plugin to have to agree to it. eg.


function OnPluginTelnetDoRequest (which)
  if which == 200 then
     return true
  else
     return false
  end -- if
end -- function


Now this introduces the issue of the problem of plugins being constantly reinstalled during testing, and they may only get the message during MUD connection time.

So do you think it would be an issue to agree to all requests (or all in a range, and if so, what range?) or make the plugins agree individually?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #64 on Thu 04 Feb 2010 03:51 AM (UTC)  quote  ]
Message
There are some excellent posts by elanthis on the MudBytes forums on the subject of parsing Telnet sequences. Here are a couple:

[1] http://www.mudbytes.net/index.php?a=topic&t=873&p=13651#p13651
[2] http://www.mudbytes.net/index.php?a=topic&t=1335&p=20765#p20765

The important lines, taken from [1], are:

Quote:
IAC : SB -> SB (begin sub-request)
SB : IAC -> SB_IAC (sub-request end/escape sequence)
SB_IAC : IAC -> SB (escaped IAC byte)
SB_IAC : SE -> TEXT (completed subrequest, process data)
SB_IAC : anything -> TEXT (invalid sub-request, abort)

He's basically saying that if you hit an IAC followed by a non-IAC/SB byte, abort the subnegotiation and move back to the text state.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #65 on Thu 04 Feb 2010 03:51 AM (UTC)  quote  ]
Message
Oh, and does ATCP include 0x00 inside its sequences?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #66 on Thu 04 Feb 2010 04:00 AM (UTC)  quote  ]

Amended on Thu 04 Feb 2010 04:02 AM (UTC) by Twisol

Message
The most recent public documentation for ATCP can be found here [1]. It doesn't make any mention of the NUL byte, but having worked with it for a while (though admittedly only on the client side), I doubt they would allow NUL bytes within the protocol.

When it comes to deciding how to support the protocols, I thought about this for a while when brainstorming my [still theoretical] webclient. I would rather support protocols only through plugins than build them directly into the client. My plan was to let registered MUD owners determine the 'protocol pipeline' for users playing their MUD from my client. Obviously, the idea doesn't translate perfectly to MUSHclient, but I think it's infinitely more extensible to modularize the protocol support. I would be happy with a general subopt mechanism that any 'protocol plugin' can hook into, implementing the processing for that protocol and making the details accessible, just like my ATCP plugin handles it. With MUD-variable protocols like ATCP and ZMP, I don't think the client should be directly responsible for it, especially when there are many potential protocols around. (Of course, MXP and ANSI-colors don't count, as they're rather popular and well-known.)

[1] http://www.ironrealms.com/nexus/atcp.html

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #67 on Thu 04 Feb 2010 04:10 AM (UTC)  quote  ]
Message
Nick Gammon said:
So I think I can make out a case that the IAC at the end is not Interpret As Command, because for one thing it could be followed by IAC, and for another it could be followed by SE which is "end of subnegotiation" not a "command" of some sort.

I actually think that SE is a command, namely the command to terminate subnegotiation. If you prefer, IAC should be interpreted as "interpret as control <sequence>".

Of course, I'm also quite happy to abort the subneg immediately, on the assumption that it's obviously confusing and improper.

Nick Gammon said:
As for math.pow, as I suggested you interpret the script in its own environment, so it is a totally empty environment. No functions are there, no _G variable, nothing.

Well, ok. If you insist :P
tt="foo";hp=(function(x) x * 7 end)(2)

What is the value of hp? 14? Something else?

What about:
tt="foo";hp=(function(x) while true do x = x end end)(2)

oh no!

Basically, I think you've left the definition for legal values too open by saying it's just any assignable expression in Lua.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #68 on Thu 04 Feb 2010 04:16 AM (UTC)  quote  ]
Message
Twisol said:

The most recent public documentation for ATCP can be found here [1]. It doesn't make any mention of the NUL byte, but having worked with it for a while (though admittedly only on the client side), I doubt they would allow NUL bytes within the protocol.


Well they actually say:

ATCP spec said:


IAC SB ATCP	255 250 200	Start sequence
IAC SE	255 240	Stop sequence


The text between the two markers includes the entire ATCP message body, and can be any text you desire (except, of course, the end marker sequence).


I take "any text you desire" as including 0x00, as I might desire that. Interestingly you appear to be able put in anything "except IAC SE" which is a strange restriction. Perhaps they should have said "any sequence at all, provided you convert IAC to IAC IAC" which would let you put in IAC SE by doubling the IAC.

It is funny he doesn't mention not putting in IAC on its own, as if you did that, like this:


IAC SB ATCP blah IAC blah IAC SE


That actually follows his spec - I have put in "any text I desire" and that text does not include "the end marker sequence".

It's tricky to get these specs right, isn't it?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #69 on Thu 04 Feb 2010 04:23 AM (UTC)  quote  ]
Message
David Haley said:


What about:
tt="foo";hp=(function(x) while true do x = x end end)(2)

oh no!

Basically, I think you've left the definition for legal values too open by saying it's just any assignable expression in Lua.


Yes, well I was waiting for that one. ;)

I suppose if the server coder wants to annoy the players he has lots of ways of doing it, for example, simple insults. Or, sending down 2 Gb of data between IAC SB x and IAC SE.

At least by setting up a separate environment I am stopping them doing "os.remove "mushclient.exe".

However I haven't effectively dealt with: "repeat until false". I suppose you could build in a runaway instruction timer, but really, I think this won't happen in practice.

It's a trade-off between paranoia about security (like your example of the loop), and ease of use. In the examples I did, you can easily specify stuff like player hit points at the server end, and easily parse them at the client end.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #70 on Thu 04 Feb 2010 04:32 AM (UTC)  quote  ]
Message
Nick Gammon said:


IAC SB ATCP blah IAC blah IAC SE


That actually follows his spec - I have put in "any text I desire" and that text does not include "the end marker sequence".

It's tricky to get these specs right, isn't it?


Yes, but it's implied that you're also following the telnet spec, given most of the preamble of the ATCP spec.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #71 on Thu 04 Feb 2010 04:46 AM (UTC)  quote  ]
Message
Quote:
It's a trade-off between paranoia about security (like your example of the loop), and ease of use. In the examples I did, you can easily specify stuff like player hit points at the server end, and easily parse them at the client end.

But the point is that these things are no longer well-defined, and that it becomes far more complex to evaluate arbitrary expressions -- even if you assume that the server isn't trying to be malicious.
The other example (tt="foo";hp=(function(x) x * 7 end)(2)), while contrived, isn't malicious and could be extended to something more plausible. And maybe you actually want to evaluate the script in some well-known environment (say, previously specified variables).
Regardless, any Lua expression beyond simple primitives and tables of simple primitives will be very hard for other languages to deal with.

My point is just that if you want ease of use, especially across languages, you might want to further constrain what can appear inside an expression.

I think it would be reasonable to give a recursive definition of the types that may be passed:
A value may be of type T, where T is one of:
- a string
- a number
- a boolean
- 'nil'
- a table whose keys are all one of the types above, and whose values are any valid type given for 'T'.

This means that you can syntactically throw out anything with functions in it. To be honest I'm not sure why you would send a function to the user if you're just trying to pass data (don't send a function and tell them to evaluate it: just send them the value).
It could be interesting to send them Lua function definitions that they're supposed to use themselves, but that seems outside the scope of this project.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #72 on Thu 04 Feb 2010 04:51 AM (UTC)  quote  ]
Message
Well if you are implying that, then I *can* put in IAC SE as long as I put it in as IAC IAC SE, and that restriction can go away.

If I seem a bit touchy about it, it is because these vague specs tend to be our unbringing [1]. Especially when the ZMP spec specifically uses the 0x00 byte as a string terminator (and then says you can't use that in messages) but you "doubt" that ATCP will support them, even after reading that you can use "any text I desire".

Then we MUD client developers get sledged for "not following the spec" when the specs are loosely and vaguely worded. This reminds me a little of the MXP spec, which was fairly clear about what to do if the input followed the spec, but less clear about what to do if you happened to get something that didn't follow the spec.


[1] Warning, word not in dictionary. :P

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,339 posts)  [Biography] bio   Forum Administrator
Date Reply #73 on Thu 04 Feb 2010 04:57 AM (UTC)  quote  ]
Message
I'll word my earlier question a bit differently ...

Do you think it would matter if MUSHclient agreed to negotiate ZMP, ATCP, MCP (or whatever) through an automatic telnet subnegotiation (ie. it replies WILL to the DO), even if any data that was subsequently sent was ignored?

In other words, is the ATCP, or ZMP stuff supplemental? Or, once you agree to accept it, the server relies on you doing stuff with it?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #74 on Thu 04 Feb 2010 04:58 AM (UTC)  quote  ]
Message
Yes, if you escape IAC into IAC IAC, there's no reason why you couldn't "embed" an IAC SE sequence into the message content.

Good point about NUL, I suppose it is legal. I suppose what I was really thinking is that Iron Realms probably wouldn't ever use NUL in its content, but that's not quite the same as illegal. My brain apologizes! >_> But ATCP is really more of a proprietary protocol - I've only ever seen it used in IRE MUDs.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


87,250 views.

This is page 5, subject is 23 pages long:  [Previous page]  1  2  3  4  5 6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]