Changeset 3806317 in mainline for uspace/srv/hid/remcons/remcons.c


Ignore:
Timestamp:
2012-01-10T14:51:09Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7c2bb2c
Parents:
6f7cd5d
Message:

remcons: move telnet commands to telnet.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/remcons/remcons.c

    r6f7cd5d r3806317  
    5454#include <io/console.h>
    5555#include <inttypes.h>
     56#include "telnet.h"
    5657
    5758
     
    8384static FIBRIL_MUTEX_INITIALIZE(clients_guard);
    8485static LIST_INITIALIZE(clients);
     86
     87/** Telnet commands to force character mode
     88 * (redundant to be on the safe side).
     89 * See
     90 * http://stackoverflow.com/questions/273261/force-telnet-client-into-character-mode
     91 * for discussion.
     92 */
     93static const telnet_cmd_t telnet_force_character_mode_command[] = {
     94        TELNET_IAC, TELNET_WILL, TELNET_ECHO,
     95        TELNET_IAC, TELNET_WILL, TELNET_SUPPRESS_GO_AHEAD,
     96        TELNET_IAC, TELNET_WONT, TELNET_LINEMODE
     97};
     98static const size_t telnet_force_character_mode_command_count =
     99    sizeof(telnet_force_character_mode_command) / sizeof(telnet_cmd_t);
    85100
    86101static client_t *client_create(int socket)
     
    308323        fibril_mutex_unlock(&client->refcount_mutex);
    309324
    310         /*
    311          * Force character mode.
    312          * IAC WILL ECHO IAC WILL SUPPRESS_GO_AHEAD IAC WONT LINEMODE
    313          * http://stackoverflow.com/questions/273261/force-telnet-client-into-character-mode
    314          */
    315         const char force_char_mode[] = {255, 251, 1, 255, 251, 3, 255, 252, 34};
    316         send(client->socket, (void *)force_char_mode, sizeof(force_char_mode), 0);
     325        /* Force character mode. */
     326        send(client->socket, (void *)telnet_force_character_mode_command,
     327            telnet_force_character_mode_command_count, 0);
    317328
    318329        client_connection_message_loop(client);
Note: See TracChangeset for help on using the changeset viewer.