Changeset 2a180307 in mainline
- Timestamp:
- 2012-01-12T09:45:21Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c17c4e28
- Parents:
- 99c2e9f3
- Location:
- uspace/srv/hid/remcons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/remcons/telnet.h
r99c2e9f3 r2a180307 45 45 46 46 #define TELNET_IAC 255 47 47 48 #define TELNET_WILL 251 48 49 #define TELNET_WONT 252 50 #define TELNET_DO 253 51 #define TELNET_DONT 254 52 53 #define TELNET_IS_OPTION_CODE(code) (((code) >= 251) && ((code) <= 254)) 54 49 55 #define TELNET_ECHO 1 50 56 #define TELNET_SUPPRESS_GO_AHEAD 3 -
uspace/srv/hid/remcons/user.c
r99c2e9f3 r2a180307 55 55 #include <assert.h> 56 56 #include "user.h" 57 #include "telnet.h" 57 58 58 59 static FIBRIL_MUTEX_INITIALIZE(users_guard); … … 228 229 } 229 230 231 static void process_telnet_command(telnet_user_t *user, 232 telnet_cmd_t option_code, telnet_cmd_t cmd) 233 { 234 if (option_code != 0) { 235 telnet_user_log(user, "Ignoring telnet command %u %u %u.", 236 TELNET_IAC, option_code, cmd); 237 } else { 238 telnet_user_log(user, "Ignoring telnet command %u %u.", 239 TELNET_IAC, cmd); 240 } 241 } 242 230 243 int telnet_user_get_next_keyboard_event(telnet_user_t *user, kbd_event_t *event) 231 244 { … … 233 246 if (list_empty(&user->in_events.list)) { 234 247 char next_byte = 0; 248 bool inside_telnet_command = false; 249 250 telnet_cmd_t telnet_option_code = 0; 251 235 252 /* Skip zeros, bail-out on error. */ 236 253 while (next_byte == 0) { 237 254 int rc = telnet_user_recv_next_byte_no_lock(user, &next_byte); 238 DEBUG("Got %d.\n", next_byte);239 255 if (rc != EOK) { 240 256 fibril_mutex_unlock(&user->guard); 241 257 return rc; 258 } 259 uint8_t byte = (uint8_t) next_byte; 260 261 /* Skip telnet commands. */ 262 if (inside_telnet_command) { 263 inside_telnet_command = false; 264 next_byte = 0; 265 if (TELNET_IS_OPTION_CODE(byte)) { 266 telnet_option_code = byte; 267 inside_telnet_command = true; 268 } else { 269 process_telnet_command(user, 270 telnet_option_code, byte); 271 } 272 } 273 if (byte == TELNET_IAC) { 274 inside_telnet_command = true; 275 next_byte = 0; 242 276 } 243 277 }
Note:
See TracChangeset
for help on using the changeset viewer.