OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This is an application of a minimal host process in a Chromoting | 5 // This is an application of a minimal host process in a Chromoting |
6 // system. It serves the purpose of gluing different pieces together | 6 // system. It serves the purpose of gluing different pieces together |
7 // to make a functional host process for testing. | 7 // to make a functional host process for testing. |
8 // | 8 // |
9 // It peforms the following functionality: | 9 // It peforms the following functionality: |
10 // 1. Connect to the GTalk network and register the machine as a host. | 10 // 1. Connect to the GTalk network and register the machine as a host. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 codec = ChannelConfig::CODEC_VP8; | 337 codec = ChannelConfig::CODEC_VP8; |
338 } else { | 338 } else { |
339 LOG(ERROR) << "Unknown video codec: " << video_codec; | 339 LOG(ERROR) << "Unknown video codec: " << video_codec; |
340 return 1; | 340 return 1; |
341 } | 341 } |
342 config->mutable_video_configs()->push_back(ChannelConfig( | 342 config->mutable_video_configs()->push_back(ChannelConfig( |
343 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 343 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
344 simple_host.set_protocol_config(config.release()); | 344 simple_host.set_protocol_config(config.release()); |
345 } | 345 } |
346 | 346 |
347 simple_host.network_settings()->allow_nat_traversal = | 347 simple_host.network_settings()->nat_traversal_mode = |
348 !cmd_line->HasSwitch(kDisableNatTraversalSwitchName); | 348 cmd_line->HasSwitch(kDisableNatTraversalSwitchName) ? |
| 349 remoting::protocol::TransportConfig::NAT_TRAVERSAL_DISABLED : |
| 350 remoting::protocol::TransportConfig::NAT_TRAVERSAL_ENABLED; |
349 | 351 |
350 if (cmd_line->HasSwitch(kMinPortSwitchName)) { | 352 if (cmd_line->HasSwitch(kMinPortSwitchName)) { |
351 std::string min_port_str = | 353 std::string min_port_str = |
352 cmd_line->GetSwitchValueASCII(kMinPortSwitchName); | 354 cmd_line->GetSwitchValueASCII(kMinPortSwitchName); |
353 int min_port = 0; | 355 int min_port = 0; |
354 if (!base::StringToInt(min_port_str, &min_port) || | 356 if (!base::StringToInt(min_port_str, &min_port) || |
355 min_port < 0 || min_port > 65535) { | 357 min_port < 0 || min_port > 65535) { |
356 LOG(ERROR) << "Invalid min-port value: " << min_port | 358 LOG(ERROR) << "Invalid min-port value: " << min_port |
357 << ". Expected integer in range [0, 65535]."; | 359 << ". Expected integer in range [0, 65535]."; |
358 return 1; | 360 return 1; |
359 } | 361 } |
360 simple_host.network_settings()->min_port = min_port; | 362 simple_host.network_settings()->min_port = min_port; |
361 } | 363 } |
362 | 364 |
363 if (cmd_line->HasSwitch(kMaxPortSwitchName)) { | 365 if (cmd_line->HasSwitch(kMaxPortSwitchName)) { |
364 std::string max_port_str = | 366 std::string max_port_str = |
365 cmd_line->GetSwitchValueASCII(kMaxPortSwitchName); | 367 cmd_line->GetSwitchValueASCII(kMaxPortSwitchName); |
366 int max_port = 0; | 368 int max_port = 0; |
367 if (!base::StringToInt(max_port_str, &max_port) || | 369 if (!base::StringToInt(max_port_str, &max_port) || |
368 max_port < 0 || max_port > 65535) { | 370 max_port < 0 || max_port > 65535) { |
369 LOG(ERROR) << "Invalid max-port value: " << max_port | 371 LOG(ERROR) << "Invalid max-port value: " << max_port |
370 << ". Expected integer in range [0, 65535]."; | 372 << ". Expected integer in range [0, 65535]."; |
371 return 1; | 373 return 1; |
372 } | 374 } |
373 simple_host.network_settings()->max_port = max_port; | 375 simple_host.network_settings()->max_port = max_port; |
374 } | 376 } |
375 | 377 |
376 return simple_host.Run(); | 378 return simple_host.Run(); |
377 } | 379 } |
OLD | NEW |