state.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * ZMap Copyright 2013 Regents of the University of Michigan
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at http://www.apache.org/licenses/LICENSE-2.0
  7. */
  8. #include "state.h"
  9. #include "../lib/logger.h"
  10. // global configuration and defaults
  11. struct state_conf zconf = {
  12. .log_level = LOG_INFO,
  13. .source_port_first = 32768, // (these are the default
  14. .source_port_last = 61000, // ephemeral range on Linux)
  15. .output_filename = NULL,
  16. .blacklist_filename = NULL,
  17. .whitelist_filename = NULL,
  18. .target_port = 0,
  19. .max_targets = 0xFFFFFFFF,
  20. .max_runtime = 0,
  21. .max_results = 0,
  22. .iface = NULL,
  23. .rate = 0,
  24. .bandwidth = 0,
  25. .cooldown_secs = 0,
  26. .senders = 1,
  27. .packet_streams = 1,
  28. .use_seed = 0,
  29. .seed = 0,
  30. .output_module = NULL,
  31. .output_args = NULL,
  32. .probe_module = NULL,
  33. .probe_args = NULL,
  34. .gw_mac = {0},
  35. .gw_ip = 0,
  36. .hw_mac = {0},
  37. .gw_mac_set = 0,
  38. .hw_mac_set = 0,
  39. .send_ip_pkts = 0,
  40. .source_ip_first = NULL,
  41. .source_ip_last = NULL,
  42. .raw_output_fields = NULL,
  43. .output_fields = NULL,
  44. .output_filter_str = NULL,
  45. .output_fields_len = 0,
  46. .log_file = NULL,
  47. .log_directory = NULL,
  48. .status_updates_file = NULL,
  49. .dryrun = 0,
  50. .quiet = 0,
  51. .syslog = 1,
  52. .filter_duplicates = 0,
  53. .filter_unsuccessful = 0,
  54. .max_sendto_failures = 1,
  55. .min_hitrate = 0.0,
  56. #ifdef JSON
  57. .metadata_file = NULL,
  58. .metadata_filename = NULL,
  59. .notes = NULL,
  60. .custom_metadata_str = NULL,
  61. #endif
  62. .recv_ready = 0
  63. };
  64. // global sender stats and defaults
  65. struct state_send zsend = {
  66. .start = 0.0,
  67. .finish = 0.0,
  68. .sent = 0,
  69. .blacklisted = 0,
  70. .whitelisted = 0,
  71. .warmup = 1,
  72. .complete = 0,
  73. .sendto_failures = 0,
  74. .targets = 0,
  75. };
  76. // global receiver stats and defaults
  77. struct state_recv zrecv = {
  78. .success_unique = 0,
  79. .success_total = 0,
  80. .app_success_unique = 0,
  81. .app_success_total = 0,
  82. .cooldown_unique = 0,
  83. .cooldown_total = 0,
  84. .failure_total = 0,
  85. .complete = 0,
  86. .pcap_recv = 0,
  87. .pcap_drop = 0,
  88. .pcap_ifdrop = 0,
  89. };