Skip to content

Commit

Permalink
Add directive code byte to data length
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmelt committed Nov 14, 2023
1 parent 0994d0e commit a9db04c
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def self.build_ack_pdu(
pdu = build_initial_pdu(type: "FILE_DIRECTIVE", destination_entity: destination_entity, transmission_mode: transmission_mode, file_size: 0, segmentation_control: segmentation_control)
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
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")
pdu_header_part_2_length = pdu_header.length
pdu_header_part_2_length = pdu_header.length - 1 # Minus 1 = Directive code is part of data per 5.2.1.1
if ack_directive_code == "FINISHED" or ack_directive_code == 5
pdu.write("DIRECTION", "TOWARD_FILE_RECEIVER")
else
Expand Down
2 changes: 1 addition & 1 deletion microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def self.build_eof_pdu(
pdu = build_initial_pdu(type: "FILE_DIRECTIVE", destination_entity: destination_entity, transmission_mode: transmission_mode, file_size: file_size, segmentation_control: segmentation_control)
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
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: "EOF")
pdu_header_part_2_length = pdu_header.length
pdu_header_part_2_length = pdu_header.length - 1 # Minus 1 = Directive code is part of data per 5.2.1.1
pdu_contents = pdu.build_eof_pdu_contents(condition_code: condition_code, file_checksum: file_checksum, file_size: file_size, canceling_entity_id: canceling_entity_id)
pdu.write("VARIABLE_DATA", pdu_header + pdu_contents)
pdu.write("PDU_DATA_LENGTH", pdu.length - pdu_header_part_1_length - pdu_header_part_2_length)
Expand Down
2 changes: 1 addition & 1 deletion microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def self.build_finished_pdu(
pdu.write("DIRECTION", "TOWARD_FILE_SENDER")
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
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: "FINISHED")
pdu_header_part_2_length = pdu_header.length
pdu_header_part_2_length = pdu_header.length - 1 # Minus 1 = Directive code is part of data per 5.2.1.1
pdu_contents = pdu.build_finished_pdu_contents(condition_code: condition_code, delivery_code: delivery_code, file_status: file_status, filestore_responses: filestore_responses, fault_location_entity_id: fault_location_entity_id)
pdu.write("VARIABLE_DATA", pdu_header + pdu_contents)
pdu.write("PDU_DATA_LENGTH", pdu.length - pdu_header_part_1_length - pdu_header_part_2_length)
Expand Down
2 changes: 1 addition & 1 deletion microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def self.build_keep_alive_pdu(
pdu.write("DIRECTION", "TOWARD_FILE_SENDER")
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
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: "KEEP_ALIVE")
pdu_header_part_2_length = pdu_header.length
pdu_header_part_2_length = pdu_header.length - 1 # Minus 1 = Directive code is part of data per 5.2.1.1
pdu_contents = pdu.build_keep_alive_pdu_contents(progress: progress)
pdu.write("VARIABLE_DATA", pdu_header + pdu_contents)
pdu.write("PDU_DATA_LENGTH", pdu.length - pdu_header_part_1_length - pdu_header_part_2_length)
Expand Down
2 changes: 1 addition & 1 deletion microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def self.build_metadata_pdu(
pdu = build_initial_pdu(type: "FILE_DIRECTIVE", destination_entity: destination_entity, transmission_mode: transmission_mode, file_size: file_size, segmentation_control: segmentation_control)
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
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: "METADATA")
pdu_header_part_2_length = pdu_header.length
pdu_header_part_2_length = pdu_header.length - 1 # Minus 1 = Directive code is part of data per 5.2.1.1
if checksum_type_implemented(destination_entity['default_checksum_type'])
checksum_type = destination_entity['default_checksum_type']
else
Expand Down
2 changes: 1 addition & 1 deletion microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.build_nak_pdu(
pdu.write("DIRECTION", "TOWARD_FILE_SENDER")
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
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: "NAK")
pdu_header_part_2_length = pdu_header.length
pdu_header_part_2_length = pdu_header.length - 1 # Minus 1 = Directive code is part of data per 5.2.1.1
pdu_contents = pdu.build_nak_pdu_contents(start_of_scope: start_of_scope, end_of_scope: end_of_scope, segment_requests: segment_requests)
pdu.write("VARIABLE_DATA", pdu_header + pdu_contents)
pdu.write("PDU_DATA_LENGTH", pdu.length - pdu_header_part_1_length - pdu_header_part_2_length)
Expand Down
2 changes: 1 addition & 1 deletion microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.build_prompt_pdu(
pdu = build_initial_pdu(type: "FILE_DIRECTIVE", destination_entity: destination_entity, transmission_mode: transmission_mode, file_size: 0, segmentation_control: segmentation_control)
pdu_header_part_1_length = pdu.length # Measured here before writing variable data
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: "PROMPT")
pdu_header_part_2_length = pdu_header.length
pdu_header_part_2_length = pdu_header.length - 1 # Minus 1 = Directive code is part of data per 5.2.1.1
pdu_contents = pdu.build_prompt_pdu_contents(response_required: response_required)
pdu.write("VARIABLE_DATA", pdu_header + pdu_contents)
pdu.write("PDU_DATA_LENGTH", pdu.length - pdu_header_part_1_length - pdu_header_part_2_length)
Expand Down

0 comments on commit a9db04c

Please sign in to comment.