您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

51 行
1.4 KiB

  1. /* Copyright (c) 2014, Google Inc.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
  14. #include <string>
  15. #include <vector>
  16. #include <openssl/err.h>
  17. #include <openssl/ssl.h>
  18. bool Speed(const std::vector<std::string> &args);
  19. bool Client(const std::vector<std::string> &args);
  20. static void usage(const char *name) {
  21. printf("Usage: %s [speed|client]\n", name);
  22. }
  23. int main(int argc, char **argv) {
  24. std::string tool;
  25. if (argc >= 2) {
  26. tool = argv[1];
  27. }
  28. SSL_library_init();
  29. std::vector<std::string> args;
  30. for (int i = 2; i < argc; i++) {
  31. args.push_back(argv[i]);
  32. }
  33. if (tool == "speed") {
  34. return !Speed(args);
  35. } else if (tool == "s_client" || tool == "client") {
  36. return !Client(args);
  37. } else {
  38. usage(argv[0]);
  39. return 1;
  40. }
  41. }