| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 // winsock2.h must be included first in order to ensure it is included before | 8 // winsock2.h must be included first in order to ensure it is included before |
| 9 // windows.h. | 9 // windows.h. |
| 10 #include <winsock2.h> | 10 #include <winsock2.h> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 // Check for line termination | 191 // Check for line termination |
| 192 if (c == TelnetProtocol::CR) | 192 if (c == TelnetProtocol::CR) |
| 193 input_state_ = EXPECTING_NEW_LINE; | 193 input_state_ = EXPECTING_NEW_LINE; |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 break; | 196 break; |
| 197 case EXPECTING_NEW_LINE: | 197 case EXPECTING_NEW_LINE: |
| 198 if (c == TelnetProtocol::LF) { | 198 if (c == TelnetProtocol::LF) { |
| 199 Send("\n", 1); | 199 Send("\n", 1); |
| 200 socket_delegate_->DidRead(this, command_line_); | 200 socket_delegate_->DidRead(this, |
| 201 command_line_.c_str(), |
| 202 command_line_.length()); |
| 201 command_line_ = ""; | 203 command_line_ = ""; |
| 202 } | 204 } |
| 203 input_state_ = NOT_IN_IAC_OR_ESC_SEQUENCE; | 205 input_state_ = NOT_IN_IAC_OR_ESC_SEQUENCE; |
| 204 break; | 206 break; |
| 205 case EXPECTING_COMMAND: | 207 case EXPECTING_COMMAND: |
| 206 // Read command, expect option. | 208 // Read command, expect option. |
| 207 iac_command_ = c; | 209 iac_command_ = c; |
| 208 input_state_ = EXPECTING_OPTION; | 210 input_state_ = EXPECTING_OPTION; |
| 209 break; | 211 break; |
| 210 case EXPECTING_OPTION: | 212 case EXPECTING_OPTION: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } else { | 275 } else { |
| 274 const char *data = buf; | 276 const char *data = buf; |
| 275 for (int i = 0; i < len; ++i) { | 277 for (int i = 0; i < len; ++i) { |
| 276 unsigned char c = static_cast<unsigned char>(*data); | 278 unsigned char c = static_cast<unsigned char>(*data); |
| 277 StateMachineStep(c); | 279 StateMachineStep(c); |
| 278 data++; | 280 data++; |
| 279 } | 281 } |
| 280 } | 282 } |
| 281 } while (len == kReadBufSize); | 283 } while (len == kReadBufSize); |
| 282 } | 284 } |
| OLD | NEW |