Working on GMCP, ATCP, and AARD (102) for Tinyfugue

by David Sexton Aug 4 2010 06:17 PM PST

Tinyfugue was last updated officially on January 14th 2007.  Since that time several "out of band" communication protocols, such as ATCP, GMCP/ATCP2, and AARD (102), have been created to facilitate data transfer between MUD clients and MUD servers.  These protocols use telnet option "subnegotiation".  Tinyfugue needs to be updated to be able to negotiate these newer protocols, and any other future protocols, that use telnet option subnegotiation.

 

Before telnet option subnegotiation can occur, telnet option "negotiation" must occur.  Telnet option negotiation is used to decide which protocols the client and server support.  Once a specific telnet option has been agreed upon, they can exchange information using the appropriate telnet option subnegotiation for that telnet option.

 

Tinyfugue has several basic telnet options hardcoded in its source code.  Tinyfugue sends back a negative response when it does not recognize a telnet option.   Telnet option negotiation must occur before telnet option subnegotiation can exchange data.  Since Tinyfugue responds negatively to all unknown options, it is not possible to begin exchanging data through telnet subnegotiation.  Updating the source code to recognize GMCP, ATCP, and AARD (102) telnet options is easy.  However, updating the source code for these specific options does not provide a generic method for dealing with other protocols that be created in the future.

 

One method for solving this issue is to provide Tinyfugue hook events (like the ICONFAIL and SEND hooks) for the several stages of telnet negotiation.  With those telnet option hooks in place, the end user would have the ability to accept or deny arbitrary telnet options from servers.  Having control over arbitrary telnet options allows the end user to respond to options that are currently in use, and also support options that may come in to use later.

 

Tinyfugue has a framework for telnet option subnegotiation that is currently used for MCCP, NAWS, and terminal type negotiation.  Telnet option subnegotiation has a very generic format.  All telnet option subnegotiation messages begin with "IAC SB XX" (255 250 XX) where XX is the telnet option identifier (GMCP uses 201, ATCP uses 200, AARD uses 102, etc).  After that byte sequence, the data is sent in whatever format is specified by the protocol documentation (for example GMCP uses JSON formatted messages).  Finally, "IAC SE" (255 240) is sent signifying the end of the data.  This generic format for telnet subnegotiation means that when Tinyfugue receives a subnegotiation message from the server it is easy to pass the data to the end user for manipulation.  The telnet option ID and subnegotiation data could be provided through the use of a Tinyfugue hook.

 

Providing hooks for telnet option negotiation and subnegotiation only solves half of the problem.  The end user also needs to be able to respond to the telnet option negotiation request.  It does not help the end user to know that the server is requesting the GMCP telnet option when the end user cannot reply back to the server.  The same issue applies to telnet option subnegotiation.  In particular, newer telnet subnegotiation options (such as GMCP) allow the end user to request information about the MUD server through client initiated subnegotiation messages.  The solution to this half of the problem is to provide a set of commands that can send telnet commands back to the server.

 

A small set of specialized Tinyfugue functions could be created in order to allow the end user to send telnet commands.  There would be a minor issue with using these specialized functions because most telnet commands use byte arrays. End users need the ability to provide some information (such as the telnet negotiation option ID) in the form of numbers or bytes, but other information as normal text (such as the JSON data for GMCP).  Also, the functions must be generic enough to allow the input of data for any protocol that might be implemented in the future.

 

One way to solve the issue of specialized functions with generic or unknown requirements would be to modify Tinyfugue's Send function to accept raw telnet data using a new command switch (such as -r for raw).  If that command switch was available, then it might be possible to create Tinyfugue script libraries that are able to correctly respond to current telnet options.  When new telnet options become available, new script libraries could be created without the need to edit Tinyfugue's source code.

 

Thus Tinyfugue currently needs a set of hooks for telnet option negotiation and telnet option subnegotiation and a command or commands used to respond (and initiate) those same items.  Once all of those pieces are in place, libraries for telnet options like GMCP, ATCP, and AARD (102) can be created through Tinyfugue scripts.

Tags: , , , ,

Tinyfugue

Comments

8/24/2010 3:29:18 PM #

I am interested in this.  A MUD server I am on just recently enabled GMCP communication and I would like to be able to take advantage of this feature. I've been looking around but information on getting tinyfugue to recognize GMCP is scarce. I've been told that merely getting tinyfugue to recognize and accept GMCP negotiations is simple, but unfortunately I have no idea where to start. The depth and insight in your post admittedly far exceeds my needs, though I am wondering if you will be releasing a patch to address these out of band protocols.

jinu United States | Reply

9/11/2010 9:22:45 PM #

@jinu: I think who ever told you TinyFugue+GMCP was "simple" was also irrevocably simple themselves.

Besides that, I too am really extremely hopeful this patch comes to fruition. I just spent much time hoping and praying that the /helps would divulge the secret code to enable GMCP/ATCP, but alas no luck.

Nick United States | Reply

9/24/2010 12:48:10 AM #

Nick: nah, whoever said that enabling GMCP in tf is simple was correct (actually it was mentioned in the blog posting). It requires recompiling tf, but adding in the functionality is pretty easy (the bigger pain is the json formatting). The blog author's goal is to make a modular system, such that we wouldn't have to recompile to add any arbitrary new protocols.

When I added option 102 and GMCP support to my tinyfugue, I was basically doing a copy/paste of the diffs from forums.lusternia.com/index.php?showtopic=10144. For GMCP, I noticed that the default source has a limit of 255 characters in the payload of the telopt message. This wouldn't work, since some rooms have more info than that, and certainly channel messages can be longer than that. I quadrupled the limit and haven't seen a longer message yet. Click my name for GMCP source and example script code for Aardwolf.

Abelinc United States | Reply

9/24/2010 3:37:50 PM #

I definitely suggest heading over to Abelinc's site.  I haven't had much time to spare on this and polish it up, and it appears that Abelinc already has it set up in a usable way.

David United States | Reply

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading



About the author

Name: David Sexton

Currenty City: Portland, OR

I'm a full time programmer (mainly Microsoft stack), just looking for a spot to put stuff that I can't find a better place for.

Month List