Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Terminal Detection

Terminal Detection

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Boborak   USA  (228 posts)  Bio
Date Fri 03 Jan 2003 12:37 AM (UTC)
Message
Here's the deal, I've recently set up my mud, a SWR-derivitive, to auto-detect among other things a client's type, using IAC calls.

Now, the terminal detection works flawlessly, but ONLY if the user sends some type of data back to the mud. What I mean by this, is that it seems an 'enter' or ANYTHING sent from the client is needed for proper detection of the client. I'm looking to fix this somehow. My question here is, how and when is the reply sent back to the server? Is it merely waiting in the buffer? Or maybe there's something along the lines that's looking for a \n that I'm missing?

My ultimate goal is to have a color 'greeting' only for those clients that can support it, and currently I *DO* have such a thing. But, my players are required to hit 'enter' before anything else is displayed. I'd like to get rid of that enter ;-) Thanks in advance.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 03 Jan 2003 08:31 PM (UTC)
Message
I suppose I should ask "which client"? MUSHclient should send a response back without waiting for an enter.

However check the way the SMAUG code is handling the IACs. Its normal behaviour is to wait for a \n before passing the "line" on for processing. Perhaps this is where the block is? In other words, the IAC check might be too "high" in the server code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #2 on Sat 04 Jan 2003 10:59 AM (UTC)
Message
The IAC's are sent out right after the new descriptor is created and linked, and right before the stock 'greeting' is sent out. I read in the 'responses' in read_from_buffer(). I assume the \n is what's blocking things. Any reccomendations to get around this?
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #3 on Sat 04 Jan 2003 11:37 AM (UTC)
Message
Of note, I just did a packet debug and verified that at least mushclient *IS* sending the required data. But if I take out my required enter (which is just another CON state) the mud seems to dicard the IAC sequences (I'm also doing MCCP detection). Here's a snippet of the packet debug:

Incoming packet: 1 (32 bytes)
...........Press 0a 0d ff fb 19 ff fa 18 01 ff f0 50 72 65 73 73
[Enter]....V..Z 20 5b 45 6e 74 65 72 5d 0a 0d ff fb 56 ff fb 5a
Sent packet: 1 (3 bytes)
... ff fe 19
Sent packet: 2 (16 bytes)
....mushclient.. ff fa 18 00 6d 75 73 68 63 6c 69 65 6e 74 ff f0
Sent packet: 3 (3 bytes)
..V ff fd 56
Sent packet: 4 (3 bytes)
..Z ff fe 5a
Incoming packet: 2 (999 bytes) //the incoming greeting
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 05 Jan 2003 09:59 PM (UTC)
Message
read_from_buffer reads a "line" from the input, ie. it looks for a \n. I put code in to detect IACs for MXP processing, which works, see example below. You should be able to modify it for your needs.

My code is in bold, the rest is the standard code.


/*
 * Transfer one line from input buffer to input line.
 */
void read_from_buffer( DESCRIPTOR_DATA *d )
{    
    int i, j, k;
    unsigned char * p;

    /*
     * Hold horses if pending command already.
     */
    if ( d->incomm[0] != '\0' )
        return;


/*

  Look for incoming telnet negotiation
*/


  for (p = d->inbuf; *p; p++)
    if (*p == IAC)
      {
      if (memcmp (p, do_mxp_str, strlen (do_mxp_str)) == 0)
        {
        turn_on_mxp (d);
        /* remove string from input buffer */
        memmove (p, &p [strlen (do_mxp_str)], strlen (&p [strlen (do_mxp_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
        } /* end of turning on MXP */
      else  if (memcmp (p, dont_mxp_str, strlen (dont_mxp_str)) == 0)
        {
        d->mxp = FALSE;
        /* remove string from input buffer */
        memmove (p, &p [strlen (dont_mxp_str)], strlen (&p [strlen (dont_mxp_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
        } /* end of turning off MXP */
      } /* end of finding an IAC */



    /*
     * Look for at least one new line.
     */
    for ( i = 0; d->inbuf != '\n' && d->inbuf != '\r' && i<MAX_INBUF_SIZE;
          i++ )
    {
        if ( d->inbuf == '\0' )
            return;
    }


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by halkeye   Canada  (28 posts)  Bio
Date Reply #5 on Mon 15 Dec 2003 10:11 PM (UTC)
Message
I've been trying to get the mud to autodetected MCCP. But unfortuatly with the exception of mcclient, and occasionally zmud, I am unable to detect mccp at all.

I've been using the code listed both here and at http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1110 and still being unable exactly to get things detected.

For the most part, i'm using the smaug-1.4 patch on randomly.org:


   for (p = d->inbuf; *p; p++)
    {
            if (*p == IAC)
            {
                    if (memcmp (p, will_termtype_str, strlen(will_termtype_str)) == 0)
                    {
                            memmove (p, &p [strlen (will_termtype_str)], strlen (&p [strlen (will_termtype_str)]) + 1);
                            p--;
                            write_to_buffer(d, req_termtype_str, 0);
                    } else if (memcmp (p, wont_termtype_str, strlen(wont_termtype_str)) == 0) {
                            memmove (p, &p [strlen (wont_termtype_str)], strlen (&p [strlen (wont_termtype_str)]) + 1);
                            p--;
#ifdef MCCP
                    } else if (memcmp (p, do_compress1_str, strlen(do_compress1_str)) == 0) {
                            compressStart(d, TELOPT_COMPRESS);
                            memmove (p, &p [strlen (do_compress1_str)], strlen(&p[strlen(do_compress1_str)] + 1));
                            p--;
                    } else if (memcmp (p, dont_compress1_str, strlen(dont_compress1_str)) == 0) {
                            compressEnd(d);
                            memmove (p, &p [strlen (dont_compress1_str)], strlen(&p[strlen(do_compress1_str)] + 1));
                            p--;
                    } else if (memcmp (p, do_compress2_str, strlen(do_compress2_str)) == 0) {
                            compressStart(d, TELOPT_COMPRESS2);
                            memmove (p, &p [strlen (do_compress2_str)], strlen(&p[strlen(do_compress2_str)] + 1));
                            p--;
                    } else if (memcmp (p, dont_compress2_str, strlen(dont_compress2_str)) == 0 && compress == FALSE) {
                            compressEnd(d);
                            memmove (p, &p [strlen (dont_compress2_str)], strlen(&p[strlen(do_compress2_str)] + 1));
                            p--;
#endif


There are more lines of course, mainly todo with client detection.

I've been testing with MUSHclient 3.42.

For the retrofit, i've been looking at http://www.gammon.com.au/mushclient/addingservermxp.htm and using mccp stuff instead (mxp is another project i'd like todo something, but mccp is what i started first).

I tried putting in debug lines, I havn't actually tried a packet filter, but it looks like i get a DO COMPRESS2 then a DONT COMPRESS, thus killing off the compression. I've tried taking this into account, but it still doesn't seem to turn it on.

Can you give me any hints at all?

- Gavin

Gavin
Dark Warriors - Coder
http://darkwars.wolfpaw.net
telnet://darkwars.wolfpaw.net:4848
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.


19,214 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.