openc3-cosmos-cfdp 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +18 -0
- data/README.md +181 -0
- data/Rakefile +40 -0
- data/lib/cfdp.rb +283 -0
- data/lib/cfdp_api.rb +204 -0
- data/microservices/CFDP/Gemfile +37 -0
- data/microservices/CFDP/Rakefile +6 -0
- data/microservices/CFDP/app/controllers/application_controller.rb +46 -0
- data/microservices/CFDP/app/controllers/cfdp_controller.rb +222 -0
- data/microservices/CFDP/app/models/cfdp_checksum.rb +52 -0
- data/microservices/CFDP/app/models/cfdp_crc_checksum.rb +41 -0
- data/microservices/CFDP/app/models/cfdp_mib.rb +613 -0
- data/microservices/CFDP/app/models/cfdp_model.rb +25 -0
- data/microservices/CFDP/app/models/cfdp_null_checksum.rb +29 -0
- data/microservices/CFDP/app/models/cfdp_pdu.rb +202 -0
- data/microservices/CFDP/app/models/cfdp_receive_transaction.rb +590 -0
- data/microservices/CFDP/app/models/cfdp_source_transaction.rb +449 -0
- data/microservices/CFDP/app/models/cfdp_topic.rb +58 -0
- data/microservices/CFDP/app/models/cfdp_transaction.rb +188 -0
- data/microservices/CFDP/app/models/cfdp_user.rb +601 -0
- data/microservices/CFDP/bin/rails +4 -0
- data/microservices/CFDP/bin/rake +4 -0
- data/microservices/CFDP/bin/setup +25 -0
- data/microservices/CFDP/config/application.rb +55 -0
- data/microservices/CFDP/config/boot.rb +4 -0
- data/microservices/CFDP/config/credentials.yml.enc +1 -0
- data/microservices/CFDP/config/environment.rb +5 -0
- data/microservices/CFDP/config/environments/development.rb +53 -0
- data/microservices/CFDP/config/environments/production.rb +75 -0
- data/microservices/CFDP/config/environments/test.rb +50 -0
- data/microservices/CFDP/config/initializers/application_controller_renderer.rb +8 -0
- data/microservices/CFDP/config/initializers/backtrace_silencers.rb +7 -0
- data/microservices/CFDP/config/initializers/cfdp_initializer.rb +26 -0
- data/microservices/CFDP/config/initializers/cors.rb +16 -0
- data/microservices/CFDP/config/initializers/filter_parameter_logging.rb +8 -0
- data/microservices/CFDP/config/initializers/inflections.rb +16 -0
- data/microservices/CFDP/config/initializers/mime_types.rb +4 -0
- data/microservices/CFDP/config/initializers/wrap_parameters.rb +9 -0
- data/microservices/CFDP/config/locales/en.yml +29 -0
- data/microservices/CFDP/config/puma.rb +38 -0
- data/microservices/CFDP/config/routes.rb +16 -0
- data/microservices/CFDP/config.ru +5 -0
- data/microservices/CFDP/init.sh +9 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb +82 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_enum.rb +237 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb +87 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_file_data.rb +98 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb +114 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb +65 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb +116 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb +91 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb +60 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_tlv.rb +291 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_user_ops.rb +749 -0
- data/microservices/CFDP/public/robots.txt +1 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_ack_spec.rb +114 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_eof_spec.rb +159 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_file_data_spec.rb +76 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_finished_spec.rb +192 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_keep_alive_spec.rb +69 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_metadata_spec.rb +346 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_nak_spec.rb +126 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_prompt_spec.rb +94 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_spec.rb +111 -0
- data/microservices/CFDP/spec/rails_helper.rb +71 -0
- data/microservices/CFDP/spec/requests/cfdp_spec.rb +1965 -0
- data/microservices/CFDP/spec/spec_helper.rb +200 -0
- data/plugin.txt +67 -0
- data/targets/CFDPTEST/cmd_tlm/cmd.txt +5 -0
- data/targets/CFDPTEST/cmd_tlm/tlm.txt +4 -0
- data/targets/CFDPTEST/procedures/cfdp_test_suite.rb +130 -0
- data/targets/CFDPTEST/target.txt +4 -0
- metadata +118 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
require_relative "boot"
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
# require "active_model/railtie"
|
6
|
+
# require "active_job/railtie"
|
7
|
+
# require "active_record/railtie"
|
8
|
+
# require "active_storage/engine"
|
9
|
+
require "action_controller/railtie"
|
10
|
+
# require "action_mailer/railtie"
|
11
|
+
# require "action_mailbox/engine"
|
12
|
+
# require "action_text/engine"
|
13
|
+
# require "action_view/railtie"
|
14
|
+
# require "action_cable/engine"
|
15
|
+
# require "rails/test_unit/railtie"
|
16
|
+
|
17
|
+
# Require the gems listed in Gemfile, including any gems
|
18
|
+
# you've limited to :test, :development, or :production.
|
19
|
+
Bundler.require(*Rails.groups)
|
20
|
+
|
21
|
+
module CfdpApi
|
22
|
+
class Application < Rails::Application
|
23
|
+
# Initialize configuration defaults for originally generated Rails version.
|
24
|
+
config.load_defaults 7.0
|
25
|
+
# Add to hosts to prevent "Blocked host" errors
|
26
|
+
config.hosts.clear
|
27
|
+
|
28
|
+
# Configuration for the application, engines, and railties goes here.
|
29
|
+
#
|
30
|
+
# These settings can be overridden in specific environments using the files
|
31
|
+
# in config/environments, which are processed later.
|
32
|
+
#
|
33
|
+
# config.time_zone = "Central Time (US & Canada)"
|
34
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
35
|
+
|
36
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
37
|
+
# Middleware like session, flash, cookies can be added back manually.
|
38
|
+
# Skip views, helpers and assets when generating a new resource.
|
39
|
+
config.api_only = true
|
40
|
+
|
41
|
+
# config.action_cable.disable_request_forgery_protection = true
|
42
|
+
# config.action_cable.mount_path = '/script-api/cable'
|
43
|
+
|
44
|
+
OpenC3::Logger.microservice_name = ENV['OPENC3_MICROSERVICE_NAME']
|
45
|
+
|
46
|
+
require 'openc3/utilities/open_telemetry'
|
47
|
+
OpenC3.setup_open_telemetry(ENV['OPENC3_MICROSERVICE_NAME'], true)
|
48
|
+
if OpenC3.otel_enabled
|
49
|
+
config.middleware.insert_before(
|
50
|
+
0,
|
51
|
+
OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
+pvZ3Zik3uIaWS3QvCTYrHQW+EI3A+w9lM8FkYGFnYfuciByseArZe/5Bf3G7NnEcJ4vt+d67pQxCWeitmNxU7fAyz5WXGAWUrb80wrB8Exh3jjaCW8WpQNdIMtiHwubTudj+hDSiXtpYbiulpN9xfUBSpZ5H1hO6QH5768tSiTOva6xa51vK6W0/v8gyxzED/kXwbdAr6LqbLBvoFt3+6OQcyb7tLtzU0LQAQq+u1Q/usvOgw48S7KTpLgCzjeXhoHUFi7BVcCaJtk1nmZVbrtlYNfYDuyfks13NGleL2sk0EevVHfb4PDKXBaH1PgqCTFEigxIQHTu05FYwJxfwmTZ9jh/YqLBM3nIF/V98Q2O5IPfeQqNa1jeWUmKVHS4AjsC+mVWE07v8am9NhjZFQBWhTb9ythYtIwn--XltxEGXRgR3F+f1d--CI0Ramf8SPg+CThji22tFQ==
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# In the development environment your application's code is reloaded any time
|
7
|
+
# it changes. This slows down response time but is perfect for development
|
8
|
+
# since you don't have to restart the web server when you make code changes.
|
9
|
+
config.cache_classes = false
|
10
|
+
|
11
|
+
# Do not eager load code on boot.
|
12
|
+
config.eager_load = false
|
13
|
+
|
14
|
+
# Show full error reports.
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
|
17
|
+
# Enable server timing
|
18
|
+
config.server_timing = true
|
19
|
+
|
20
|
+
# Enable/disable caching. By default caching is disabled.
|
21
|
+
# Run rails dev:cache to toggle caching.
|
22
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
23
|
+
config.cache_store = :memory_store
|
24
|
+
config.public_file_server.headers = {
|
25
|
+
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
26
|
+
}
|
27
|
+
else
|
28
|
+
config.action_controller.perform_caching = false
|
29
|
+
|
30
|
+
config.cache_store = :null_store
|
31
|
+
end
|
32
|
+
|
33
|
+
# Print deprecation notices to the Rails logger.
|
34
|
+
config.active_support.deprecation = :log
|
35
|
+
|
36
|
+
# Raise exceptions for disallowed deprecations.
|
37
|
+
config.active_support.disallowed_deprecation = :raise
|
38
|
+
|
39
|
+
# Tell Active Support which deprecation messages to disallow.
|
40
|
+
config.active_support.disallowed_deprecation_warnings = []
|
41
|
+
|
42
|
+
# Raises error for missing translations.
|
43
|
+
# config.i18n.raise_on_missing_translations = true
|
44
|
+
|
45
|
+
# Annotate rendered view with file names.
|
46
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
47
|
+
|
48
|
+
# Disable ActionCable logging
|
49
|
+
# ActionCable.server.config.logger = Logger.new(STDOUT, level: Logger::ERROR)
|
50
|
+
|
51
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
52
|
+
# config.action_cable.disable_request_forgery_protection = true
|
53
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# Code is not reloaded between requests.
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Eager load code on boot. This eager loads most of Rails and
|
10
|
+
# your application in memory, allowing both threaded web servers
|
11
|
+
# and those relying on copy on write to perform better.
|
12
|
+
# Rake tasks automatically ignore this option for performance.
|
13
|
+
config.eager_load = true
|
14
|
+
|
15
|
+
# Full error reports are disabled and caching is turned on.
|
16
|
+
config.consider_all_requests_local = false
|
17
|
+
|
18
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
19
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
20
|
+
# config.require_master_key = true
|
21
|
+
|
22
|
+
# Disable serving static files from the `/public` folder by default since
|
23
|
+
# Apache or NGINX already handles this.
|
24
|
+
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
25
|
+
|
26
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
27
|
+
# config.asset_host = "http://assets.example.com"
|
28
|
+
|
29
|
+
# Specifies the header that your server uses for sending files.
|
30
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
31
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
32
|
+
|
33
|
+
# Mount Action Cable outside main process or domain.
|
34
|
+
# config.action_cable.mount_path = nil
|
35
|
+
# config.action_cable.url = "wss://example.com/cable"
|
36
|
+
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
37
|
+
|
38
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
39
|
+
# config.force_ssl = true
|
40
|
+
|
41
|
+
# Include generic and useful information about system operation, but avoid logging too much
|
42
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
43
|
+
config.log_level = :info
|
44
|
+
|
45
|
+
# Prepend all log lines with the following tags.
|
46
|
+
config.log_tags = [ :request_id ]
|
47
|
+
|
48
|
+
# Use a different cache store in production.
|
49
|
+
# config.cache_store = :mem_cache_store
|
50
|
+
|
51
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
52
|
+
# config.active_job.queue_adapter = :resque
|
53
|
+
# config.active_job.queue_name_prefix = "script_runner_api_production"
|
54
|
+
|
55
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
56
|
+
# the I18n.default_locale when a translation cannot be found).
|
57
|
+
config.i18n.fallbacks = true
|
58
|
+
|
59
|
+
# Don't log any deprecations.
|
60
|
+
config.active_support.report_deprecations = false
|
61
|
+
|
62
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
63
|
+
config.log_formatter = ::Logger::Formatter.new
|
64
|
+
|
65
|
+
# Use a different logger for distributed setups.
|
66
|
+
# require "syslog/logger"
|
67
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
68
|
+
|
69
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
70
|
+
logger.formatter = config.log_formatter
|
71
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
72
|
+
|
73
|
+
# Disable ActionCable logging
|
74
|
+
# ActionCable.server.config.logger = Logger.new(STDOUT, level: Logger::ERROR)
|
75
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
|
8
|
+
Rails.application.configure do
|
9
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
10
|
+
|
11
|
+
# Turn false under Spring and add config.action_view.cache_template_loading = true.
|
12
|
+
config.cache_classes = true
|
13
|
+
|
14
|
+
# Eager loading loads your whole application. When running a single test locally,
|
15
|
+
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
16
|
+
# system, or in some way before deploying your code.
|
17
|
+
config.eager_load = ENV["CI"].present?
|
18
|
+
|
19
|
+
# Configure public file server for tests with Cache-Control for performance.
|
20
|
+
config.public_file_server.enabled = true
|
21
|
+
config.public_file_server.headers = {
|
22
|
+
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
23
|
+
}
|
24
|
+
|
25
|
+
# Show full error reports and disable caching.
|
26
|
+
config.consider_all_requests_local = true
|
27
|
+
config.action_controller.perform_caching = false
|
28
|
+
config.cache_store = :null_store
|
29
|
+
|
30
|
+
# Raise exceptions instead of rendering exception templates.
|
31
|
+
config.action_dispatch.show_exceptions = false
|
32
|
+
|
33
|
+
# Disable request forgery protection in test environment.
|
34
|
+
config.action_controller.allow_forgery_protection = false
|
35
|
+
|
36
|
+
# Print deprecation notices to the stderr.
|
37
|
+
config.active_support.deprecation = :stderr
|
38
|
+
|
39
|
+
# Raise exceptions for disallowed deprecations.
|
40
|
+
config.active_support.disallowed_deprecation = :raise
|
41
|
+
|
42
|
+
# Tell Active Support which deprecation messages to disallow.
|
43
|
+
config.active_support.disallowed_deprecation_warnings = []
|
44
|
+
|
45
|
+
# Raises error for missing translations.
|
46
|
+
# config.i18n.raise_on_missing_translations = true
|
47
|
+
|
48
|
+
# Annotate rendered view with file names.
|
49
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
50
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2023 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# Licensed for Evaluation and Educational Use
|
7
|
+
#
|
8
|
+
# This file may only be used commercially under the terms of a commercial license
|
9
|
+
# purchased from OpenC3, Inc.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
#
|
15
|
+
# The development of this software was funded in-whole or in-part by MethaneSAT LLC.
|
16
|
+
|
17
|
+
require 'cfdp_mib'
|
18
|
+
require 'cfdp_user'
|
19
|
+
|
20
|
+
if ENV['RAILS_ENV'] != 'test'
|
21
|
+
CfdpMib.setup
|
22
|
+
$cfdp_user = CfdpUser.new
|
23
|
+
$cfdp_user.start
|
24
|
+
else
|
25
|
+
$cfdp_user = CfdpUser.new
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Avoid CORS issues when API is called from the frontend app.
|
4
|
+
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
|
5
|
+
|
6
|
+
# Read more: https://github.com/cyu/rack-cors
|
7
|
+
|
8
|
+
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
9
|
+
allow do
|
10
|
+
origins "*"
|
11
|
+
|
12
|
+
resource "*",
|
13
|
+
headers: :any,
|
14
|
+
methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
|
4
|
+
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
|
5
|
+
# notations and behaviors.
|
6
|
+
Rails.application.config.filter_parameters += [
|
7
|
+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
8
|
+
]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
8
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
9
|
+
# inflect.irregular "person", "people"
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym "RESTful"
|
16
|
+
# end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# To use a different locale, set it with `I18n.locale`:
|
10
|
+
#
|
11
|
+
# I18n.locale = :es
|
12
|
+
#
|
13
|
+
# This would use the information in config/locales/es.yml.
|
14
|
+
#
|
15
|
+
# The following keys must be escaped otherwise they will not be retrieved by
|
16
|
+
# the default I18n backend:
|
17
|
+
#
|
18
|
+
# true, false, on, off, yes, no
|
19
|
+
#
|
20
|
+
# Instead, surround them with single quotes.
|
21
|
+
#
|
22
|
+
# en:
|
23
|
+
# 'true': 'foo'
|
24
|
+
#
|
25
|
+
# To learn more, please read the Rails Internationalization guide
|
26
|
+
# available at https://guides.rubyonrails.org/i18n.html.
|
27
|
+
|
28
|
+
en:
|
29
|
+
hello: "Hello world"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
2
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
3
|
+
# Any libraries that use thread pools should be configured to match
|
4
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
5
|
+
# and maximum; this matches the default thread size of Active Record.
|
6
|
+
#
|
7
|
+
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
8
|
+
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
9
|
+
threads min_threads_count, max_threads_count
|
10
|
+
|
11
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
12
|
+
#
|
13
|
+
port ENV.fetch("PORT") { <%= cfdp_port %> }
|
14
|
+
|
15
|
+
# Specifies the `environment` that Puma will run in.
|
16
|
+
#
|
17
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
18
|
+
|
19
|
+
# Specifies the `pidfile` that Puma will use.
|
20
|
+
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
21
|
+
|
22
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
23
|
+
# Workers are forked web server processes. If using threads and workers together
|
24
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
25
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
26
|
+
# processes).
|
27
|
+
#
|
28
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
29
|
+
|
30
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
31
|
+
# This directive tells Puma to first boot the application and load code
|
32
|
+
# before forking the application. This takes advantage of Copy On Write
|
33
|
+
# process behavior so workers use less memory.
|
34
|
+
#
|
35
|
+
# preload_app!
|
36
|
+
|
37
|
+
# Allow puma to be restarted by `rails restart` command.
|
38
|
+
plugin :tmp_restart
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
prefix = ENV['OPENC3_ROUTE_PREFIX'] || "/cfdp"
|
3
|
+
prefix = prefix[1..-1] if prefix[0] == '/'
|
4
|
+
scope prefix do
|
5
|
+
post "/put" => "cfdp#put"
|
6
|
+
post "/cancel" => "cfdp#cancel"
|
7
|
+
post "/suspend" => "cfdp#suspend"
|
8
|
+
post "/resume" => "cfdp#resume"
|
9
|
+
post "/report" => "cfdp#report"
|
10
|
+
post "/directorylisting" => "cfdp#directory_listing"
|
11
|
+
get "/subscribe" => "cfdp#subscribe"
|
12
|
+
get "/indications/:transaction_id" => "cfdp#indications"
|
13
|
+
get "/indications" => "cfdp#indications"
|
14
|
+
get "/transactions" => "cfdp#transactions"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2023 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# Licensed for Evaluation and Educational Use
|
7
|
+
#
|
8
|
+
# This file may only be used commercially under the terms of a commercial license
|
9
|
+
# purchased from OpenC3, Inc.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
#
|
15
|
+
# The development of this software was funded in-whole or in-part by MethaneSAT LLC.
|
16
|
+
|
17
|
+
class CfdpPdu < OpenC3::Packet
|
18
|
+
def self.decom_ack_pdu_contents(pdu, pdu_hash, variable_data)
|
19
|
+
s = pdu.define_ack_pdu_contents
|
20
|
+
s.buffer = variable_data
|
21
|
+
pdu_hash["ACK_DIRECTIVE_CODE"] = s.read("ACK_DIRECTIVE_CODE")
|
22
|
+
pdu_hash["ACK_DIRECTIVE_SUBTYPE"] = s.read("ACK_DIRECTIVE_SUBTYPE")
|
23
|
+
pdu_hash["CONDITION_CODE"] = s.read("CONDITION_CODE")
|
24
|
+
pdu_hash["TRANSACTION_STATUS"] = s.read("TRANSACTION_STATUS")
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.build_ack_pdu(
|
28
|
+
source_entity:,
|
29
|
+
transaction_seq_num:,
|
30
|
+
destination_entity:,
|
31
|
+
segmentation_control: "NOT_PRESERVED",
|
32
|
+
transmission_mode: nil,
|
33
|
+
condition_code:,
|
34
|
+
ack_directive_code:,
|
35
|
+
transaction_status:)
|
36
|
+
|
37
|
+
pdu = build_initial_pdu(type: "FILE_DIRECTIVE", destination_entity: destination_entity, transmission_mode: transmission_mode, file_size: 0, segmentation_control: segmentation_control)
|
38
|
+
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
|
39
|
+
pdu_header = pdu.build_variable_header(source_entity_id: source_entity['id'], transaction_seq_num: transaction_seq_num, destination_entity_id: destination_entity['id'], directive_code: "ACK")
|
40
|
+
pdu_header_part_2_length = pdu_header.length
|
41
|
+
if ack_directive_code == "FINISHED" or ack_directive_code == 5
|
42
|
+
pdu.write("DIRECTION", "TOWARD_FILE_RECEIVER")
|
43
|
+
else
|
44
|
+
pdu.write("DIRECTION", "TOWARD_FILE_SENDER")
|
45
|
+
end
|
46
|
+
pdu_contents = pdu.build_ack_pdu_contents(ack_directive_code: ack_directive_code, condition_code: condition_code, transaction_status: transaction_status)
|
47
|
+
pdu.write("VARIABLE_DATA", pdu_header + pdu_contents)
|
48
|
+
pdu.write("PDU_DATA_LENGTH", pdu.length - pdu_header_part_1_length - pdu_header_part_2_length)
|
49
|
+
if destination_entity['crcs_required']
|
50
|
+
crc16 = OpenC3::Crc16.new
|
51
|
+
pdu.write("CRC", crc16.calc(pdu.buffer(false)[0..-3]))
|
52
|
+
end
|
53
|
+
return pdu.buffer(false)
|
54
|
+
end
|
55
|
+
|
56
|
+
def define_ack_pdu_contents
|
57
|
+
s = OpenC3::Packet.new(nil, nil, :BIG_ENDIAN)
|
58
|
+
item = s.append_item("ACK_DIRECTIVE_CODE", 4, :UINT)
|
59
|
+
item.states = DIRECTIVE_CODES
|
60
|
+
s.append_item("ACK_DIRECTIVE_SUBTYPE", 4, :UINT)
|
61
|
+
item = s.append_item("CONDITION_CODE", 4, :UINT)
|
62
|
+
item.states = CONDITION_CODES
|
63
|
+
s.append_item("SPARE", 2, :UINT)
|
64
|
+
item = s.append_item("TRANSACTION_STATUS", 2, :UINT)
|
65
|
+
item.states = TRANSACTION_STATUS_CODES
|
66
|
+
return s
|
67
|
+
end
|
68
|
+
|
69
|
+
def build_ack_pdu_contents(ack_directive_code:, condition_code:, transaction_status:)
|
70
|
+
s = define_ack_pdu_contents()
|
71
|
+
s.write("ACK_DIRECTIVE_CODE", ack_directive_code)
|
72
|
+
if s.read("ACK_DIRECTIVE_CODE") == "FINISHED"
|
73
|
+
s.write("ACK_DIRECTIVE_SUBTYPE", 1)
|
74
|
+
else
|
75
|
+
s.write("ACK_DIRECTIVE_SUBTYPE", 0)
|
76
|
+
end
|
77
|
+
s.write("CONDITION_CODE", condition_code)
|
78
|
+
s.write("SPARE", 0)
|
79
|
+
s.write("TRANSACTION_STATUS", transaction_status)
|
80
|
+
return s.buffer(false)
|
81
|
+
end
|
82
|
+
end
|