diff --git a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb index 4adb7c5..e9d161d 100644 --- a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb +++ b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb @@ -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 diff --git a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb index 46b25e6..3aea8d7 100644 --- a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb +++ b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb @@ -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) diff --git a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb index d0e6f1a..ee45aca 100644 --- a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb +++ b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb @@ -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) diff --git a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb index ebeee54..e754319 100644 --- a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb +++ b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb @@ -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) diff --git a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb index 82cef25..b4664f8 100644 --- a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb +++ b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb @@ -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 diff --git a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb index 72531c2..f168b79 100644 --- a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb +++ b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb @@ -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) diff --git a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb index 3444ac6..f57627f 100644 --- a/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb +++ b/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb @@ -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)