contrast-agent 6.6.4 → 6.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/.gitmodules +0 -3
- data/.simplecov +0 -1
- data/Rakefile +0 -1
- data/ext/cs__assess_array/cs__assess_array.c +41 -10
- data/ext/cs__assess_array/cs__assess_array.h +4 -1
- data/ext/cs__scope/cs__scope.c +1 -1
- data/lib/contrast/agent/assess/contrast_event.rb +2 -24
- data/lib/contrast/agent/assess/events/source_event.rb +7 -61
- data/lib/contrast/agent/assess/finalizers/hash.rb +11 -0
- data/lib/contrast/agent/assess/policy/dynamic_source_factory.rb +0 -55
- data/lib/contrast/agent/assess/policy/policy_node.rb +3 -3
- data/lib/contrast/agent/assess/policy/policy_node_utils.rb +0 -1
- data/lib/contrast/agent/assess/policy/propagation_node.rb +4 -4
- data/lib/contrast/agent/assess/policy/source_method.rb +24 -1
- data/lib/contrast/agent/assess/policy/trigger/reflected_xss.rb +7 -5
- data/lib/contrast/agent/assess/policy/trigger/xpath.rb +6 -1
- data/lib/contrast/agent/assess/policy/trigger_method.rb +40 -121
- data/lib/contrast/agent/assess/policy/trigger_node.rb +3 -3
- data/lib/contrast/agent/assess/policy/trigger_validation/redos_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/ssrf_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/xss_validator.rb +1 -1
- data/lib/contrast/agent/assess/property/evented.rb +2 -12
- data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +42 -82
- data/lib/contrast/agent/assess/rule/response/base_rule.rb +11 -27
- data/lib/contrast/agent/assess/rule/response/body_rule.rb +1 -3
- data/lib/contrast/agent/assess/rule/response/cache_control_header_rule.rb +77 -62
- data/lib/contrast/agent/assess/rule/response/csp_header_insecure_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/framework/rails_support.rb +6 -1
- data/lib/contrast/agent/assess/rule/response/header_rule.rb +5 -5
- data/lib/contrast/agent/assess/rule/response/hsts_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/x_xss_protection_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/tracker.rb +1 -7
- data/lib/contrast/agent/at_exit_hook.rb +1 -7
- data/lib/contrast/agent/excluder.rb +224 -0
- data/lib/contrast/agent/exclusion_matcher.rb +25 -7
- data/lib/contrast/agent/inventory/database_config.rb +18 -23
- data/lib/contrast/agent/middleware.rb +4 -5
- data/lib/contrast/agent/patching/policy/after_load_patcher.rb +6 -0
- data/lib/contrast/agent/protect/input_analyzer/input_analyzer.rb +146 -127
- data/lib/contrast/agent/protect/policy/applies_command_injection_rule.rb +4 -0
- data/lib/contrast/agent/protect/policy/applies_path_traversal_rule.rb +20 -0
- data/lib/contrast/agent/protect/policy/applies_sqli_rule.rb +1 -0
- data/lib/contrast/agent/protect/policy/rule_applicator.rb +1 -1
- data/lib/contrast/agent/protect/rule/base.rb +98 -66
- data/lib/contrast/agent/protect/rule/base_service.rb +49 -24
- data/lib/contrast/agent/protect/rule/bot_blocker/bot_blocker_input_classification.rb +98 -0
- data/lib/contrast/agent/protect/rule/bot_blocker.rb +81 -0
- data/lib/contrast/agent/protect/rule/cmd_injection.rb +30 -99
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_backdoors.rb +132 -0
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_base_rule.rb +169 -0
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb +69 -0
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_dangerous_path.rb +68 -0
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_input_classification.rb +2 -58
- data/lib/contrast/agent/protect/rule/default_scanner.rb +1 -1
- data/lib/contrast/agent/protect/rule/deserialization.rb +10 -19
- data/lib/contrast/agent/protect/rule/http_method_tampering/http_method_tampering_input_classification.rb +2 -2
- data/lib/contrast/agent/protect/rule/http_method_tampering.rb +0 -11
- data/lib/contrast/agent/protect/rule/no_sqli/no_sqli_input_classification.rb +29 -34
- data/lib/contrast/agent/protect/rule/no_sqli.rb +25 -18
- data/lib/contrast/agent/protect/rule/path_traversal/path_traversal_input_classification.rb +61 -0
- data/lib/contrast/agent/protect/rule/path_traversal/path_traversal_semantic_security_bypass.rb +114 -0
- data/lib/contrast/agent/protect/rule/path_traversal.rb +46 -18
- data/lib/contrast/agent/protect/rule/sql_sample_builder.rb +49 -29
- data/lib/contrast/agent/protect/rule/sqli/sqli_base_rule.rb +37 -0
- data/lib/contrast/agent/protect/rule/sqli/sqli_input_classification.rb +2 -62
- data/lib/contrast/agent/protect/rule/sqli/sqli_semantic/sqli_dangerous_functions.rb +67 -0
- data/lib/contrast/agent/protect/rule/sqli.rb +67 -22
- data/lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_input_classification.rb +39 -63
- data/lib/contrast/agent/protect/rule/unsafe_file_upload.rb +6 -33
- data/lib/contrast/agent/protect/rule/xss/reflected_xss_input_classification.rb +58 -0
- data/lib/contrast/agent/protect/rule/xss.rb +14 -20
- data/lib/contrast/agent/protect/rule/xxe.rb +15 -30
- data/lib/contrast/agent/protect/rule.rb +3 -1
- data/lib/contrast/agent/reporting/attack_result/attack_result.rb +8 -0
- data/lib/contrast/agent/reporting/attack_result/rasp_rule_sample.rb +70 -36
- data/lib/contrast/agent/reporting/attack_result/response_type.rb +9 -9
- data/lib/contrast/agent/reporting/attack_result/user_input.rb +11 -0
- data/lib/contrast/agent/reporting/details/bot_blocker_details.rb +29 -0
- data/lib/contrast/agent/reporting/details/cmd_injection_details.rb +30 -0
- data/lib/contrast/agent/reporting/details/details.rb +18 -0
- data/lib/contrast/agent/reporting/details/http_method_tempering_details.rb +27 -0
- data/lib/contrast/agent/reporting/details/ip_denylist_details.rb +35 -0
- data/lib/contrast/agent/reporting/details/no_sqli_details.rb +36 -0
- data/lib/contrast/agent/reporting/details/path_traversal_details.rb +24 -0
- data/lib/contrast/agent/reporting/details/path_traversal_semantic_analysis_details.rb +32 -0
- data/lib/contrast/agent/reporting/details/protect_rule_details.rb +17 -0
- data/lib/contrast/agent/reporting/details/sqli_dangerous_functions.rb +22 -0
- data/lib/contrast/agent/reporting/details/sqli_details.rb +36 -0
- data/lib/contrast/agent/reporting/details/untrusted_deserialization_details.rb +27 -0
- data/lib/contrast/agent/reporting/details/virtual_patch_details.rb +30 -0
- data/lib/contrast/agent/reporting/details/xss_details.rb +33 -0
- data/lib/contrast/agent/reporting/details/xss_match.rb +30 -0
- data/lib/contrast/agent/reporting/details/xxe_details.rb +36 -0
- data/lib/contrast/agent/reporting/details/xxe_match.rb +25 -0
- data/lib/contrast/agent/reporting/details/xxe_wrapper.rb +25 -0
- data/lib/contrast/agent/reporting/input_analysis/details/bot_blocker_details.rb +27 -0
- data/lib/contrast/agent/reporting/input_analysis/details/protect_rule_details.rb +15 -0
- data/lib/contrast/agent/reporting/input_analysis/input_analysis.rb +1 -2
- data/lib/contrast/agent/reporting/input_analysis/input_analysis_result.rb +17 -3
- data/lib/contrast/agent/reporting/masker/masker.rb +80 -65
- data/lib/contrast/agent/reporting/masker/masker_utils.rb +1 -30
- data/lib/contrast/agent/reporting/reporter.rb +1 -15
- data/lib/contrast/agent/reporting/reporting_events/agent_startup.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/application_activity.rb +84 -15
- data/lib/contrast/agent/reporting/reporting_events/application_defend_activity.rb +13 -25
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_activity.rb +19 -24
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample.rb +46 -126
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_activity.rb +5 -16
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attacker_activity.rb +10 -18
- data/lib/contrast/agent/reporting/reporting_events/application_inventory_activity.rb +6 -14
- data/lib/contrast/agent/reporting/reporting_events/application_startup.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/application_update.rb +0 -2
- data/lib/contrast/agent/reporting/reporting_events/architecture_component.rb +7 -22
- data/lib/contrast/agent/reporting/reporting_events/finding.rb +23 -53
- data/lib/contrast/agent/reporting/reporting_events/finding_event.rb +12 -9
- data/lib/contrast/agent/reporting/reporting_events/finding_event_signature.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/finding_event_source.rb +23 -21
- data/lib/contrast/agent/reporting/reporting_events/finding_event_stack.rb +5 -18
- data/lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb +1 -0
- data/lib/contrast/{api/decorators/trace_taint_range_tags.rb → agent/reporting/reporting_events/finding_event_taint_range_tags.rb} +7 -6
- data/lib/contrast/agent/reporting/reporting_events/finding_request.rb +40 -10
- data/lib/contrast/agent/reporting/reporting_events/library_discovery.rb +0 -1
- data/lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/observed_route.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/poll.rb +1 -11
- data/lib/contrast/agent/reporting/reporting_events/preflight_message.rb +10 -14
- data/lib/contrast/agent/reporting/reporting_events/reporting_event.rb +11 -0
- data/lib/contrast/agent/reporting/reporting_events/route_coverage.rb +3 -1
- data/lib/contrast/agent/reporting/reporting_events/route_discovery.rb +12 -25
- data/lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb +8 -27
- data/lib/contrast/agent/reporting/reporting_utilities/audit.rb +3 -3
- data/lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb +4 -7
- data/lib/contrast/agent/reporting/reporting_utilities/headers.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb +2 -1
- data/lib/contrast/agent/reporting/reporting_utilities/reporter_client_utils.rb +3 -3
- data/lib/contrast/agent/reporting/reporting_utilities/response.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler.rb +0 -3
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler_utils.rb +1 -0
- data/lib/contrast/agent/reporting/settings/code_exclusion.rb +6 -1
- data/lib/contrast/agent/reporting/settings/exclusion_base.rb +18 -0
- data/lib/contrast/agent/reporting/settings/exclusions.rb +2 -1
- data/lib/contrast/agent/reporting/settings/input_exclusion.rb +9 -3
- data/lib/contrast/agent/reporting/settings/protect.rb +15 -15
- data/lib/contrast/agent/request.rb +4 -14
- data/lib/contrast/agent/request_context.rb +18 -24
- data/lib/contrast/agent/request_context_extend.rb +23 -164
- data/lib/contrast/agent/request_handler.rb +1 -11
- data/lib/contrast/agent/response.rb +0 -18
- data/lib/contrast/agent/telemetry/events/event.rb +1 -1
- data/lib/contrast/agent/telemetry/events/metric_event.rb +1 -1
- data/lib/contrast/agent/telemetry/events/startup_metrics_event.rb +3 -3
- data/lib/contrast/agent/thread_watcher.rb +3 -18
- data/lib/contrast/agent/version.rb +1 -1
- data/lib/contrast/agent.rb +0 -11
- data/lib/contrast/agent_lib/api/command_injection.rb +46 -0
- data/lib/contrast/agent_lib/api/init.rb +101 -0
- data/lib/contrast/agent_lib/api/input_tracing.rb +267 -0
- data/lib/contrast/agent_lib/api/method_tempering.rb +29 -0
- data/lib/contrast/agent_lib/api/panic.rb +87 -0
- data/lib/contrast/agent_lib/api/path_semantic_file_security_bypass.rb +40 -0
- data/lib/contrast/agent_lib/interface.rb +260 -0
- data/lib/contrast/agent_lib/interface_base.rb +118 -0
- data/lib/contrast/agent_lib/return_types/eval_result.rb +44 -0
- data/lib/contrast/agent_lib/test.rb +29 -0
- data/lib/contrast/api/communication/connection_status.rb +5 -5
- data/lib/contrast/components/agent.rb +13 -23
- data/lib/contrast/components/api.rb +10 -10
- data/lib/contrast/components/app_context.rb +9 -11
- data/lib/contrast/components/app_context_extend.rb +1 -26
- data/lib/contrast/components/assess.rb +92 -38
- data/lib/contrast/components/assess_rules.rb +36 -0
- data/lib/contrast/components/config.rb +49 -24
- data/lib/contrast/components/heap_dump.rb +1 -1
- data/lib/contrast/components/protect.rb +9 -6
- data/lib/contrast/components/ruby_component.rb +81 -0
- data/lib/contrast/components/sampling.rb +1 -1
- data/lib/contrast/components/security_logger.rb +23 -0
- data/lib/contrast/components/settings.rb +41 -85
- data/lib/contrast/config/base_configuration.rb +1 -1
- data/lib/contrast/config/protect_rule_configuration.rb +7 -7
- data/lib/contrast/config/protect_rules_configuration.rb +24 -48
- data/lib/contrast/config/server_configuration.rb +1 -1
- data/lib/contrast/config.rb +0 -6
- data/lib/contrast/configuration.rb +73 -18
- data/lib/contrast/extension/assess/array.rb +9 -0
- data/lib/contrast/extension/assess/exec_trigger.rb +3 -1
- data/lib/contrast/extension/assess/marshal.rb +3 -2
- data/lib/contrast/extension/assess/string.rb +0 -1
- data/lib/contrast/extension/delegator.rb +2 -0
- data/lib/contrast/extension/extension.rb +1 -1
- data/lib/contrast/framework/base_support.rb +0 -5
- data/lib/contrast/framework/grape/support.rb +1 -23
- data/lib/contrast/framework/manager.rb +3 -11
- data/lib/contrast/framework/rails/patch/action_controller_live_buffer.rb +1 -6
- data/lib/contrast/framework/rails/railtie.rb +0 -1
- data/lib/contrast/framework/rails/support.rb +5 -59
- data/lib/contrast/framework/sinatra/support.rb +2 -21
- data/lib/contrast/logger/cef_log.rb +21 -3
- data/lib/contrast/logger/log.rb +1 -11
- data/lib/contrast/tasks/config.rb +5 -10
- data/lib/contrast/utils/assess/event_limit_utils.rb +28 -12
- data/lib/contrast/utils/assess/trigger_method_utils.rb +10 -18
- data/lib/contrast/utils/duck_utils.rb +1 -0
- data/lib/contrast/utils/findings.rb +6 -5
- data/lib/contrast/utils/hash_digest.rb +9 -24
- data/lib/contrast/utils/hash_digest_extend.rb +6 -6
- data/lib/contrast/utils/input_classification_base.rb +156 -0
- data/lib/contrast/utils/invalid_configuration_util.rb +21 -58
- data/lib/contrast/utils/log_utils.rb +47 -17
- data/lib/contrast/utils/net_http_base.rb +2 -2
- data/lib/contrast/utils/os.rb +0 -20
- data/lib/contrast/utils/patching/policy/patch_utils.rb +3 -2
- data/lib/contrast/utils/response_utils.rb +0 -16
- data/lib/contrast/utils/stack_trace_utils.rb +3 -40
- data/lib/contrast/utils/string_utils.rb +19 -7
- data/lib/contrast/utils/telemetry_client.rb +13 -7
- data/lib/contrast.rb +7 -13
- data/resources/protect/policy.json +1 -2
- data/ruby-agent.gemspec +2 -5
- metadata +78 -137
- data/exe/contrast_service +0 -23
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_worth_watching.rb +0 -64
- data/lib/contrast/agent/protect/rule/sqli/sqli_worth_watching.rb +0 -118
- data/lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_matcher.rb +0 -45
- data/lib/contrast/agent/reaction_processor.rb +0 -47
- data/lib/contrast/agent/reporting/reporting_events/trace_event_source.rb +0 -30
- data/lib/contrast/agent/reporting/reporting_utilities/dtm_message.rb +0 -43
- data/lib/contrast/agent/service_heartbeat.rb +0 -35
- data/lib/contrast/api/communication/messaging_queue.rb +0 -129
- data/lib/contrast/api/communication/response_processor.rb +0 -90
- data/lib/contrast/api/communication/service_lifecycle.rb +0 -77
- data/lib/contrast/api/communication/socket.rb +0 -44
- data/lib/contrast/api/communication/socket_client.rb +0 -130
- data/lib/contrast/api/communication/speedracer.rb +0 -142
- data/lib/contrast/api/communication/tcp_socket.rb +0 -32
- data/lib/contrast/api/communication/unix_socket.rb +0 -28
- data/lib/contrast/api/communication.rb +0 -20
- data/lib/contrast/api/decorators/activity.rb +0 -33
- data/lib/contrast/api/decorators/address.rb +0 -59
- data/lib/contrast/api/decorators/agent_startup.rb +0 -57
- data/lib/contrast/api/decorators/application_settings.rb +0 -42
- data/lib/contrast/api/decorators/application_startup.rb +0 -56
- data/lib/contrast/api/decorators/architecture_component.rb +0 -36
- data/lib/contrast/api/decorators/bot_blocker.rb +0 -37
- data/lib/contrast/api/decorators/finding.rb +0 -29
- data/lib/contrast/api/decorators/http_request.rb +0 -137
- data/lib/contrast/api/decorators/input_analysis.rb +0 -18
- data/lib/contrast/api/decorators/instrumentation_mode.rb +0 -35
- data/lib/contrast/api/decorators/ip_denylist.rb +0 -37
- data/lib/contrast/api/decorators/message.rb +0 -71
- data/lib/contrast/api/decorators/rasp_rule_sample.rb +0 -58
- data/lib/contrast/api/decorators/response_type.rb +0 -17
- data/lib/contrast/api/decorators/route_coverage.rb +0 -91
- data/lib/contrast/api/decorators/server_features.rb +0 -25
- data/lib/contrast/api/decorators/trace_event.rb +0 -120
- data/lib/contrast/api/decorators/trace_event_object.rb +0 -63
- data/lib/contrast/api/decorators/trace_event_signature.rb +0 -69
- data/lib/contrast/api/decorators/trace_taint_range.rb +0 -52
- data/lib/contrast/api/decorators/user_input.rb +0 -51
- data/lib/contrast/api/decorators/virtual_patch.rb +0 -34
- data/lib/contrast/api/decorators.rb +0 -28
- data/lib/contrast/api/dtm.pb.rb +0 -852
- data/lib/contrast/api/settings.pb.rb +0 -500
- data/lib/contrast/api.rb +0 -16
- data/lib/contrast/components/contrast_service.rb +0 -88
- data/lib/contrast/config/assess_configuration.rb +0 -93
- data/lib/contrast/config/assess_rules_configuration.rb +0 -32
- data/lib/contrast/config/root_configuration.rb +0 -90
- data/lib/contrast/config/ruby_configuration.rb +0 -81
- data/lib/contrast/config/service_configuration.rb +0 -49
- data/lib/contrast/tasks/service.rb +0 -84
- data/lib/contrast/utils/input_classification.rb +0 -73
- data/lib/contrast/utils/preflight_util.rb +0 -13
- data/lib/protobuf/code_generator.rb +0 -129
- data/lib/protobuf/decoder.rb +0 -28
- data/lib/protobuf/deprecation.rb +0 -117
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +0 -79
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +0 -360
- data/lib/protobuf/descriptors.rb +0 -3
- data/lib/protobuf/encoder.rb +0 -11
- data/lib/protobuf/enum.rb +0 -365
- data/lib/protobuf/exceptions.rb +0 -9
- data/lib/protobuf/field/base_field.rb +0 -380
- data/lib/protobuf/field/base_field_object_definitions.rb +0 -504
- data/lib/protobuf/field/bool_field.rb +0 -64
- data/lib/protobuf/field/bytes_field.rb +0 -67
- data/lib/protobuf/field/double_field.rb +0 -25
- data/lib/protobuf/field/enum_field.rb +0 -56
- data/lib/protobuf/field/field_array.rb +0 -102
- data/lib/protobuf/field/field_hash.rb +0 -122
- data/lib/protobuf/field/fixed32_field.rb +0 -25
- data/lib/protobuf/field/fixed64_field.rb +0 -28
- data/lib/protobuf/field/float_field.rb +0 -43
- data/lib/protobuf/field/int32_field.rb +0 -21
- data/lib/protobuf/field/int64_field.rb +0 -34
- data/lib/protobuf/field/integer_field.rb +0 -23
- data/lib/protobuf/field/message_field.rb +0 -51
- data/lib/protobuf/field/sfixed32_field.rb +0 -27
- data/lib/protobuf/field/sfixed64_field.rb +0 -28
- data/lib/protobuf/field/signed_integer_field.rb +0 -29
- data/lib/protobuf/field/sint32_field.rb +0 -21
- data/lib/protobuf/field/sint64_field.rb +0 -21
- data/lib/protobuf/field/string_field.rb +0 -51
- data/lib/protobuf/field/uint32_field.rb +0 -21
- data/lib/protobuf/field/uint64_field.rb +0 -21
- data/lib/protobuf/field/varint_field.rb +0 -77
- data/lib/protobuf/field.rb +0 -74
- data/lib/protobuf/generators/base.rb +0 -85
- data/lib/protobuf/generators/enum_generator.rb +0 -39
- data/lib/protobuf/generators/extension_generator.rb +0 -27
- data/lib/protobuf/generators/field_generator.rb +0 -193
- data/lib/protobuf/generators/file_generator.rb +0 -262
- data/lib/protobuf/generators/group_generator.rb +0 -122
- data/lib/protobuf/generators/message_generator.rb +0 -104
- data/lib/protobuf/generators/option_generator.rb +0 -17
- data/lib/protobuf/generators/printable.rb +0 -160
- data/lib/protobuf/generators/service_generator.rb +0 -50
- data/lib/protobuf/lifecycle.rb +0 -33
- data/lib/protobuf/logging.rb +0 -39
- data/lib/protobuf/message/fields.rb +0 -233
- data/lib/protobuf/message/serialization.rb +0 -85
- data/lib/protobuf/message.rb +0 -241
- data/lib/protobuf/optionable.rb +0 -72
- data/lib/protobuf/tasks/compile.rake +0 -80
- data/lib/protobuf/tasks.rb +0 -1
- data/lib/protobuf/varint.rb +0 -20
- data/lib/protobuf/varint_pure.rb +0 -31
- data/lib/protobuf/version.rb +0 -3
- data/lib/protobuf/wire_type.rb +0 -10
- data/lib/protobuf.rb +0 -91
- data/proto/dynamic_discovery.proto +0 -46
- data/proto/google/protobuf/compiler/plugin.proto +0 -183
- data/proto/google/protobuf/descriptor.proto +0 -911
- data/proto/rpc.proto +0 -71
- data/service_executables/.gitkeep +0 -0
- data/service_executables/VERSION +0 -1
- data/service_executables/linux/contrast-service +0 -0
- data/service_executables/mac/contrast-service +0 -0
data/lib/protobuf/optionable.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/object/try'
|
2
|
-
|
3
|
-
module Protobuf
|
4
|
-
module Optionable
|
5
|
-
module ClassMethods
|
6
|
-
def get_option(name)
|
7
|
-
name = name.to_s
|
8
|
-
option = optionable_descriptor_class.get_field(name, true)
|
9
|
-
fail ArgumentError, "invalid option=#{name}" unless option
|
10
|
-
unless option.fully_qualified_name.to_s == name
|
11
|
-
# Eventually we'll deprecate the use of simple names of fields completely, but for now make sure people
|
12
|
-
# are accessing options correctly. We allow simple names in other places for backwards compatibility.
|
13
|
-
fail ArgumentError, "must access option using its fully qualified name: #{option.fully_qualified_name.inspect}"
|
14
|
-
end
|
15
|
-
value =
|
16
|
-
if @_optionable_options.try(:key?, name)
|
17
|
-
@_optionable_options[name]
|
18
|
-
else
|
19
|
-
option.default_value
|
20
|
-
end
|
21
|
-
if option.type_class < ::Protobuf::Message
|
22
|
-
option.type_class.new(value)
|
23
|
-
else
|
24
|
-
value
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def get_option!(name)
|
29
|
-
get_option(name) if @_optionable_options.try(:key?, name.to_s)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def set_option(name, value = true)
|
35
|
-
@_optionable_options ||= {}
|
36
|
-
@_optionable_options[name.to_s] = value
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def get_option(name)
|
41
|
-
self.class.get_option(name)
|
42
|
-
end
|
43
|
-
|
44
|
-
def get_option!(name)
|
45
|
-
self.class.get_option!(name)
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.inject(base_class, extend_class = true, &block)
|
49
|
-
unless block_given?
|
50
|
-
fail ArgumentError, 'missing option class block (e.g: ::CSGoogle::Protobuf::MessageOptions)'
|
51
|
-
end
|
52
|
-
if extend_class
|
53
|
-
# Check if optionable_descriptor_class is already defined and short circuit if so.
|
54
|
-
# File options are injected per module, and since a module can be defined more than once,
|
55
|
-
# we will get a warning if we try to define optionable_descriptor_class twice.
|
56
|
-
if base_class.respond_to?(:optionable_descriptor_class)
|
57
|
-
# Don't define optionable_descriptor_class twice
|
58
|
-
return if base_class.optionable_descriptor_class == block.call
|
59
|
-
|
60
|
-
fail 'A class is being defined with two different descriptor classes, something is very wrong'
|
61
|
-
end
|
62
|
-
|
63
|
-
base_class.extend(ClassMethods)
|
64
|
-
base_class.__send__(:include, self)
|
65
|
-
base_class.define_singleton_method(:optionable_descriptor_class, block)
|
66
|
-
else
|
67
|
-
base_class.__send__(:include, ClassMethods)
|
68
|
-
base_class.module_eval { define_method(:optionable_descriptor_class, block) }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
|
3
|
-
namespace :protobuf do
|
4
|
-
|
5
|
-
desc "Clean & Compile the protobuf source to ruby classes. Pass PB_NO_CLEAN=1 if you do not want to force-clean first."
|
6
|
-
task :compile, [:package, :source, :destination, :plugin, :file_extension] do |_tasks, args|
|
7
|
-
binpath = ::File.expand_path("../../../../bin", __FILE__)
|
8
|
-
|
9
|
-
args.with_defaults(:destination => "lib")
|
10
|
-
args.with_defaults(:source => "definitions")
|
11
|
-
args.with_defaults(:plugin => "protoc-gen-ruby-protobuf=#{binpath}/protoc-gen-ruby")
|
12
|
-
args.with_defaults(:file_extension => ".pb.rb")
|
13
|
-
|
14
|
-
# The local Ruby generator collides with the builtin Ruby generator
|
15
|
-
#
|
16
|
-
# From the protoc docs:
|
17
|
-
#
|
18
|
-
# --plugin=EXECUTABLE
|
19
|
-
#
|
20
|
-
# ...EXECUTABLE may be of the form NAME=PATH, in which case the given plugin name
|
21
|
-
# is mapped to the given executable even if the executable"s own name differs.
|
22
|
-
#
|
23
|
-
# Use the NAME=PATH form to specify an alternative plugin name that avoids the name collision
|
24
|
-
#
|
25
|
-
plugin_name, _plugin_path = args[:plugin].split("=")
|
26
|
-
|
27
|
-
# The plugin name MUST have the protoc-gen- prefix in order to work, but that prefix is dropped
|
28
|
-
# when using the plugin to generate definitions
|
29
|
-
plugin_name.gsub!("protoc-gen-", "")
|
30
|
-
|
31
|
-
unless do_not_clean?
|
32
|
-
force_clean!
|
33
|
-
::Rake::Task[:clean].invoke(args[:package], args[:destination], args[:file_extension])
|
34
|
-
end
|
35
|
-
|
36
|
-
command = []
|
37
|
-
command << "protoc"
|
38
|
-
command << "--plugin=#{args[:plugin]}"
|
39
|
-
command << "--#{plugin_name}_out=#{args[:destination]}"
|
40
|
-
command << "-I #{args[:source]}"
|
41
|
-
command << Dir["#{args[:source]}/#{args[:package]}/**/*.proto"].join(" ")
|
42
|
-
full_command = command.join(" ")
|
43
|
-
|
44
|
-
puts full_command
|
45
|
-
system(full_command)
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "Clean the generated *.pb.rb files from the destination package. Pass PB_FORCE_CLEAN=1 to skip confirmation step."
|
49
|
-
task :clean, [:package, :destination, :file_extension] do |_task, args|
|
50
|
-
args.with_defaults(:destination => "lib")
|
51
|
-
args.with_defaults(:file_extension => ".pb.rb")
|
52
|
-
|
53
|
-
file_extension = args[:file_extension].sub(/\*?\.+/, "")
|
54
|
-
files_to_clean = ::File.join(args[:destination], args[:package], "**", "*.#{file_extension}")
|
55
|
-
|
56
|
-
if force_clean? || permission_to_clean?(files_to_clean)
|
57
|
-
::Dir.glob(files_to_clean).each do |file|
|
58
|
-
::FileUtils.rm(file)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def do_not_clean?
|
64
|
-
! ::ENV.key?("PB_NO_CLEAN")
|
65
|
-
end
|
66
|
-
|
67
|
-
def force_clean?
|
68
|
-
::ENV.key?("PB_FORCE_CLEAN")
|
69
|
-
end
|
70
|
-
|
71
|
-
def force_clean!
|
72
|
-
::ENV["PB_FORCE_CLEAN"] = "1"
|
73
|
-
end
|
74
|
-
|
75
|
-
def permission_to_clean?(files_to_clean)
|
76
|
-
puts "Do you really want to remove files matching pattern #{files_to_clean}? (y/n)"
|
77
|
-
::STDIN.gets.chomp =~ /y(es)?/i
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
data/lib/protobuf/tasks.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
load 'protobuf/tasks/compile.rake'
|
data/lib/protobuf/varint.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Protobuf
|
2
|
-
class Varint
|
3
|
-
if defined?(::Varint)
|
4
|
-
extend ::Varint
|
5
|
-
|
6
|
-
def self.encode(value)
|
7
|
-
bytes = []
|
8
|
-
until value < 128
|
9
|
-
bytes << (0x80 | (value & 0x7f))
|
10
|
-
value >>= 7
|
11
|
-
end
|
12
|
-
(bytes << value).pack('C*')
|
13
|
-
end
|
14
|
-
elsif defined?(::ProtobufJavaHelpers)
|
15
|
-
extend ::ProtobufJavaHelpers::EncodeDecode
|
16
|
-
else
|
17
|
-
extend VarintPure
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/protobuf/varint_pure.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Protobuf
|
2
|
-
module VarintPure
|
3
|
-
CACHE_LIMIT = 2048
|
4
|
-
|
5
|
-
def cached_varint(value)
|
6
|
-
@_varint_cache ||= {}
|
7
|
-
(@_varint_cache[value] ||= encode(value, false)).dup
|
8
|
-
end
|
9
|
-
|
10
|
-
def decode(stream)
|
11
|
-
value = index = 0
|
12
|
-
begin
|
13
|
-
byte = stream.readbyte
|
14
|
-
value |= (byte & 0x7f) << (7 * index)
|
15
|
-
index += 1
|
16
|
-
end while (byte & 0x80).nonzero?
|
17
|
-
value
|
18
|
-
end
|
19
|
-
|
20
|
-
def encode(value, use_cache = true)
|
21
|
-
return cached_varint(value) if use_cache && value >= 0 && value <= CACHE_LIMIT
|
22
|
-
|
23
|
-
bytes = []
|
24
|
-
until value < 128
|
25
|
-
bytes << (0x80 | (value & 0x7f))
|
26
|
-
value >>= 7
|
27
|
-
end
|
28
|
-
(bytes << value).pack('C*')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/lib/protobuf/version.rb
DELETED
data/lib/protobuf/wire_type.rb
DELETED
data/lib/protobuf.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'base64'
|
2
|
-
require 'logger'
|
3
|
-
require 'pp'
|
4
|
-
require 'socket'
|
5
|
-
require 'stringio'
|
6
|
-
|
7
|
-
# All top-level run time code requires, ordered by necessity
|
8
|
-
require 'protobuf/wire_type'
|
9
|
-
|
10
|
-
require 'protobuf/varint_pure'
|
11
|
-
require 'protobuf/varint'
|
12
|
-
|
13
|
-
require 'protobuf/exceptions'
|
14
|
-
require 'protobuf/deprecation'
|
15
|
-
require 'protobuf/logging'
|
16
|
-
|
17
|
-
require 'protobuf/encoder'
|
18
|
-
require 'protobuf/decoder'
|
19
|
-
|
20
|
-
require 'protobuf/optionable'
|
21
|
-
require 'protobuf/field'
|
22
|
-
require 'protobuf/enum'
|
23
|
-
require 'protobuf/message'
|
24
|
-
require 'protobuf/descriptors'
|
25
|
-
|
26
|
-
module Protobuf
|
27
|
-
class << self
|
28
|
-
# Client Host
|
29
|
-
#
|
30
|
-
# Default: `hostname` of the system
|
31
|
-
#
|
32
|
-
# The name or address of the host to use during client RPC calls.
|
33
|
-
attr_writer :client_host
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.after_server_bind
|
37
|
-
::ActiveSupport::Notifications.subscribe('after_server_bind') do |*args|
|
38
|
-
yield(*args)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.before_server_bind
|
43
|
-
::ActiveSupport::Notifications.subscribe('before_server_bind') do |*args|
|
44
|
-
yield(*args)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.client_host
|
49
|
-
@client_host ||= Socket.gethostname
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.connector_type_class
|
53
|
-
@connector_type_class ||= ::Protobuf::Rpc::Connectors::Socket
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.connector_type_class= type_class
|
57
|
-
@connector_type_class = type_class
|
58
|
-
end
|
59
|
-
|
60
|
-
# GC Pause during server requests
|
61
|
-
#
|
62
|
-
# Default: false
|
63
|
-
#
|
64
|
-
# Boolean value to tell the server to disable
|
65
|
-
# the Garbage Collector when handling an rpc request.
|
66
|
-
# Once the request is completed, the GC is enabled again.
|
67
|
-
# This optomization provides a huge boost in speed to rpc requests.
|
68
|
-
def self.gc_pause_server_request?
|
69
|
-
return @gc_pause_server_request unless @gc_pause_server_request.nil?
|
70
|
-
|
71
|
-
self.gc_pause_server_request = false
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.gc_pause_server_request= value
|
75
|
-
@gc_pause_server_request = !!value
|
76
|
-
end
|
77
|
-
|
78
|
-
# Permit unknown field on Message initialization
|
79
|
-
#
|
80
|
-
# Default: true
|
81
|
-
#
|
82
|
-
# Simple boolean to define whether we want to permit unknown fields
|
83
|
-
# on Message intialization; otherwise a ::Protobuf::FieldNotDefinedError is thrown.
|
84
|
-
def self.ignore_unknown_fields?
|
85
|
-
!defined?(@ignore_unknown_fields) || @ignore_unknown_fields
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.ignore_unknown_fields= value
|
89
|
-
@ignore_unknown_fields = !!value
|
90
|
-
end
|
91
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
// Copyright (c) 2013 MoneyDesktop, Inc.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
8
|
-
// furnished to do so, subject to the following conditions:
|
9
|
-
//
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
11
|
-
// all copies or substantial portions of the Software.
|
12
|
-
//
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
// THE SOFTWARE.
|
20
|
-
|
21
|
-
// Authors: Devin Christensen
|
22
|
-
//
|
23
|
-
// Protobufs needed for dynamic discovery zmq server and client.
|
24
|
-
|
25
|
-
syntax = "proto2";
|
26
|
-
|
27
|
-
package protobuf.rpc.dynamicDiscovery;
|
28
|
-
|
29
|
-
enum BeaconType {
|
30
|
-
HEARTBEAT = 0;
|
31
|
-
FLATLINE = 1;
|
32
|
-
}
|
33
|
-
|
34
|
-
message Server {
|
35
|
-
optional string uuid = 1;
|
36
|
-
optional string address = 2;
|
37
|
-
optional string port = 3;
|
38
|
-
optional int32 ttl = 4;
|
39
|
-
repeated string services = 5;
|
40
|
-
}
|
41
|
-
|
42
|
-
message Beacon {
|
43
|
-
optional BeaconType beacon_type = 1;
|
44
|
-
optional Server server = 2;
|
45
|
-
}
|
46
|
-
|
@@ -1,183 +0,0 @@
|
|
1
|
-
// Protocol Buffers - Google's data interchange format
|
2
|
-
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
-
// https://developers.google.com/protocol-buffers/
|
4
|
-
//
|
5
|
-
// Redistribution and use in source and binary forms, with or without
|
6
|
-
// modification, are permitted provided that the following conditions are
|
7
|
-
// met:
|
8
|
-
//
|
9
|
-
// * Redistributions of source code must retain the above copyright
|
10
|
-
// notice, this list of conditions and the following disclaimer.
|
11
|
-
// * Redistributions in binary form must reproduce the above
|
12
|
-
// copyright notice, this list of conditions and the following disclaimer
|
13
|
-
// in the documentation and/or other materials provided with the
|
14
|
-
// distribution.
|
15
|
-
// * Neither the name of Google Inc. nor the names of its
|
16
|
-
// contributors may be used to endorse or promote products derived from
|
17
|
-
// this software without specific prior written permission.
|
18
|
-
//
|
19
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
|
31
|
-
// Author: kenton@google.com (Kenton Varda)
|
32
|
-
//
|
33
|
-
// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
|
34
|
-
// change.
|
35
|
-
//
|
36
|
-
// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
|
37
|
-
// just a program that reads a CodeGeneratorRequest from stdin and writes a
|
38
|
-
// CodeGeneratorResponse to stdout.
|
39
|
-
//
|
40
|
-
// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
|
41
|
-
// of dealing with the raw protocol defined here.
|
42
|
-
//
|
43
|
-
// A plugin executable needs only to be placed somewhere in the path. The
|
44
|
-
// plugin should be named "protoc-gen-$NAME", and will then be used when the
|
45
|
-
// flag "--${NAME}_out" is passed to protoc.
|
46
|
-
|
47
|
-
syntax = "proto2";
|
48
|
-
|
49
|
-
package google.protobuf.compiler;
|
50
|
-
option java_package = "com.google.protobuf.compiler";
|
51
|
-
option java_outer_classname = "PluginProtos";
|
52
|
-
|
53
|
-
option go_package = "google.golang.org/protobuf/types/pluginpb";
|
54
|
-
|
55
|
-
import "google/protobuf/descriptor.proto";
|
56
|
-
|
57
|
-
// The version number of protocol compiler.
|
58
|
-
message Version {
|
59
|
-
optional int32 major = 1;
|
60
|
-
optional int32 minor = 2;
|
61
|
-
optional int32 patch = 3;
|
62
|
-
// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
|
63
|
-
// be empty for mainline stable releases.
|
64
|
-
optional string suffix = 4;
|
65
|
-
}
|
66
|
-
|
67
|
-
// An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
68
|
-
message CodeGeneratorRequest {
|
69
|
-
// The .proto files that were explicitly listed on the command-line. The
|
70
|
-
// code generator should generate code only for these files. Each file's
|
71
|
-
// descriptor will be included in proto_file, below.
|
72
|
-
repeated string file_to_generate = 1;
|
73
|
-
|
74
|
-
// The generator parameter passed on the command-line.
|
75
|
-
optional string parameter = 2;
|
76
|
-
|
77
|
-
// FileDescriptorProtos for all files in files_to_generate and everything
|
78
|
-
// they import. The files will appear in topological order, so each file
|
79
|
-
// appears before any file that imports it.
|
80
|
-
//
|
81
|
-
// protoc guarantees that all proto_files will be written after
|
82
|
-
// the fields above, even though this is not technically guaranteed by the
|
83
|
-
// protobuf wire format. This theoretically could allow a plugin to stream
|
84
|
-
// in the FileDescriptorProtos and handle them one by one rather than read
|
85
|
-
// the entire set into memory at once. However, as of this writing, this
|
86
|
-
// is not similarly optimized on protoc's end -- it will store all fields in
|
87
|
-
// memory at once before sending them to the plugin.
|
88
|
-
//
|
89
|
-
// Type names of fields and extensions in the FileDescriptorProto are always
|
90
|
-
// fully qualified.
|
91
|
-
repeated FileDescriptorProto proto_file = 15;
|
92
|
-
|
93
|
-
// The version number of protocol compiler.
|
94
|
-
optional Version compiler_version = 3;
|
95
|
-
|
96
|
-
}
|
97
|
-
|
98
|
-
// The plugin writes an encoded CodeGeneratorResponse to stdout.
|
99
|
-
message CodeGeneratorResponse {
|
100
|
-
// Error message. If non-empty, code generation failed. The plugin process
|
101
|
-
// should exit with status code zero even if it reports an error in this way.
|
102
|
-
//
|
103
|
-
// This should be used to indicate errors in .proto files which prevent the
|
104
|
-
// code generator from generating correct code. Errors which indicate a
|
105
|
-
// problem in protoc itself -- such as the input CodeGeneratorRequest being
|
106
|
-
// unparseable -- should be reported by writing a message to stderr and
|
107
|
-
// exiting with a non-zero status code.
|
108
|
-
optional string error = 1;
|
109
|
-
|
110
|
-
// A bitmask of supported features that the code generator supports.
|
111
|
-
// This is a bitwise "or" of values from the Feature enum.
|
112
|
-
optional uint64 supported_features = 2;
|
113
|
-
|
114
|
-
// Sync with code_generator.h.
|
115
|
-
enum Feature {
|
116
|
-
FEATURE_NONE = 0;
|
117
|
-
FEATURE_PROTO3_OPTIONAL = 1;
|
118
|
-
}
|
119
|
-
|
120
|
-
// Represents a single generated file.
|
121
|
-
message File {
|
122
|
-
// The file name, relative to the output directory. The name must not
|
123
|
-
// contain "." or ".." components and must be relative, not be absolute (so,
|
124
|
-
// the file cannot lie outside the output directory). "/" must be used as
|
125
|
-
// the path separator, not "\".
|
126
|
-
//
|
127
|
-
// If the name is omitted, the content will be appended to the previous
|
128
|
-
// file. This allows the generator to break large files into small chunks,
|
129
|
-
// and allows the generated text to be streamed back to protoc so that large
|
130
|
-
// files need not reside completely in memory at one time. Note that as of
|
131
|
-
// this writing protoc does not optimize for this -- it will read the entire
|
132
|
-
// CodeGeneratorResponse before writing files to disk.
|
133
|
-
optional string name = 1;
|
134
|
-
|
135
|
-
// If non-empty, indicates that the named file should already exist, and the
|
136
|
-
// content here is to be inserted into that file at a defined insertion
|
137
|
-
// point. This feature allows a code generator to extend the output
|
138
|
-
// produced by another code generator. The original generator may provide
|
139
|
-
// insertion points by placing special annotations in the file that look
|
140
|
-
// like:
|
141
|
-
// @@protoc_insertion_point(NAME)
|
142
|
-
// The annotation can have arbitrary text before and after it on the line,
|
143
|
-
// which allows it to be placed in a comment. NAME should be replaced with
|
144
|
-
// an identifier naming the point -- this is what other generators will use
|
145
|
-
// as the insertion_point. Code inserted at this point will be placed
|
146
|
-
// immediately above the line containing the insertion point (thus multiple
|
147
|
-
// insertions to the same point will come out in the order they were added).
|
148
|
-
// The double-@ is intended to make it unlikely that the generated code
|
149
|
-
// could contain things that look like insertion points by accident.
|
150
|
-
//
|
151
|
-
// For example, the C++ code generator places the following line in the
|
152
|
-
// .pb.h files that it generates:
|
153
|
-
// // @@protoc_insertion_point(namespace_scope)
|
154
|
-
// This line appears within the scope of the file's package namespace, but
|
155
|
-
// outside of any particular class. Another plugin can then specify the
|
156
|
-
// insertion_point "namespace_scope" to generate additional classes or
|
157
|
-
// other declarations that should be placed in this scope.
|
158
|
-
//
|
159
|
-
// Note that if the line containing the insertion point begins with
|
160
|
-
// whitespace, the same whitespace will be added to every line of the
|
161
|
-
// inserted text. This is useful for languages like Python, where
|
162
|
-
// indentation matters. In these languages, the insertion point comment
|
163
|
-
// should be indented the same amount as any inserted code will need to be
|
164
|
-
// in order to work correctly in that context.
|
165
|
-
//
|
166
|
-
// The code generator that generates the initial file and the one which
|
167
|
-
// inserts into it must both run as part of a single invocation of protoc.
|
168
|
-
// Code generators are executed in the order in which they appear on the
|
169
|
-
// command line.
|
170
|
-
//
|
171
|
-
// If |insertion_point| is present, |name| must also be present.
|
172
|
-
optional string insertion_point = 2;
|
173
|
-
|
174
|
-
// The file contents.
|
175
|
-
optional string content = 15;
|
176
|
-
|
177
|
-
// Information describing the file content being inserted. If an insertion
|
178
|
-
// point is used, this information will be appropriately offset and inserted
|
179
|
-
// into the code generation metadata for the generated files.
|
180
|
-
optional GeneratedCodeInfo generated_code_info = 16;
|
181
|
-
}
|
182
|
-
repeated File file = 15;
|
183
|
-
}
|